// Update is called once per frame void Update() { // yield return new WaitForEndOfFrame(); if (mMaskTexture == null) { return; } if (mJointCalculator == null) { mJointCalculator = new TJointCalculator(); } if (mDebugJoint) { TJoint joint = new TJoint(); joint.mStart = new float2(0, 0); joint.mMiddle = new float2(0.2f, 0.2f); joint.mEnd = new float2(0.4f, 0.5f); mJoints = new List <TJoint> (); mJoints.Add(joint); } else { mJoints = mJointCalculator.CalculateJoints(ref mDebug, mMaskTexture, mRayTexture, mRayMaterial, mSecondJointTexture, mSecondJointMaterial, mMaxColumnTest, mReadBackFormat, mMinJointLength); if (mBestJointOnly) { // filter out best int Best = 0; for (int i = 1; i < mJoints.Count; i++) { if (mJoints[i].Length() > mJoints[Best].Length()) { Best = i; } } if (mJoints.Count > 0) { TJoint joint = mJoints[Best]; mJoints.Clear(); mJoints.Add(joint); } } } }
void OnDisable() { mJoints.Clear(); mJointCalculator = null; }