Commit 38c2e903 authored by 16이상민's avatar 16이상민

Assets/Script/CoordinateMapperView.cs:

Refactoring code because the code that sets the buffer is structurally redundant.
Refactoring code because the Release () function is called unnecessarily in the constructor and the internal implementation of the OnDisable () function calls the Release () function when the call syntax is removed.

Assets/Script/CoordinateMapperManager.cs:
Extract method because Update () function of 'CoordinateMapperManager' class is big.
Extract module because 'CoordinateMapperManager' class is big.
parent 44937dcd
This diff is collapsed.
......@@ -12,11 +12,9 @@ public class CoordinateMapperView : MonoBehaviour
void Start ()
{
Release();
CoordinateMapperManager CoordinateMapperManager = GameObject.Find("Managers").GetComponent<CoordinateMapperManager>();
GetComponent<Renderer>().material.SetTexture("_MainTex", CoordinateMapperManager.GetColorTexture());
GetComponent<Renderer>().material.SetTexture("_MainTex", CoordinateMapperManager.ColorTexture);
Func<Array, Array, Action<string, ComputeBuffer, int>> setBuffer = (srcPoints, dstPoints) =>
{
......@@ -28,10 +26,10 @@ public class CoordinateMapperView : MonoBehaviour
};
};
setBuffer(CoordinateMapperManager.GetDepthCoordinates(), DepthPoints)
setBuffer(CoordinateMapperManager.DepthCoordinates, DepthPoints)
("depthCoordinates", DepthBuffer, sizeof(float) * 2);
setBuffer(CoordinateMapperManager.GetBodyIndexBuffer(), BodyIndexPoints)
setBuffer(CoordinateMapperManager.BodyIndexBuffer, BodyIndexPoints)
("BodyIndexBuffer", BodyIndexBuffer, sizeof(float));
}
......@@ -43,20 +41,12 @@ public class CoordinateMapperView : MonoBehaviour
BodyIndexBuffer.SetData(System.Array.ConvertAll(BodyIndexPoints, System.Convert.ToSingle));
}
private void Release()
{
if (DepthBuffer != null)
DepthBuffer.Release();
if (BodyIndexBuffer != null)
BodyIndexBuffer.Release();
DepthPoints = null;
BodyIndexPoints = null;
}
void OnDisable()
{
Release();
}
DepthBuffer.Release();
BodyIndexBuffer.Release();
DepthPoints = null;
BodyIndexPoints = null;
}
}
......@@ -34,7 +34,7 @@ public class MotionView : MonoBehaviour {
_coordinateMapperManager
= CoordinateMapperManager.GetComponent<CoordinateMapperManager>();
body = _coordinateMapperManager.GetBodyBuffer();
body = _coordinateMapperManager.BodyBuffer;
IsInitialized = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment