public bool AddTrangle(TTrangle trangle) { CleanUp(); if (TCameraTrangles.Contains(trangle)) { return(false); } TCameraTrangles.Add(trangle); return(true); }
protected virtual void Update() { Profiler.BeginSample("TCamreraMesh"); if (TCameraTrangles.Count < 1) { Profiler.EndSample(); return; } CleanUp(); if (Target == null) { Profiler.EndSample(); return; } if (PerformanceOptimizationOn) { PerformanceOptimizationSetup(); } if (CurrentTrangle != null) { if (IsTrangleValid(CurrentTrangle) && TrangleCheckAndProcess(CurrentTrangle)) { Profiler.EndSample(); return; } CurrentTrangle = null; } for (int i = 0; i < TCameraTrangles.Count; i++) { var tri = TCameraTrangles[i]; if (IsTrangleValid(tri) && TrangleCheckAndProcess(tri)) { LastTrangle = CurrentTrangle; CurrentTrangle = tri; break; } } Profiler.EndSample(); }
protected bool IsTrangleValid(TTrangle tri) { if (tri == null) { return(false); } if (!tri.PowerOn) { return(false); } if (!tri.Valid()) { return(false); } return(true); }
protected override bool TrangleCheckAndProcess(TTrangle tri) { var vertices = tri.Vertices.ToArray(); float[] weight; if (TCameraUtility.IsInsideTrangle(vertices, Target.position, out weight)) { if (PowerOn) { if (CurrentTrangle != tri) { var etri = tri as TEventTrangle; if (!etri.AnyRelationship(CurrentTrangle as TEventTrangle)) { tri.OnEnterTrangle(); } } } return(true); } return(false); }
protected override bool TrangleCheckAndProcess(TTrangle tri) { var vertices = tri.Vertices.ToArray(); float[] weight; if (TCameraUtility.IsInsideTrangle(vertices, Target.position, out weight)) { if (PowerOn) { var tVertices = tri.vertices; var eulerAngles = (tVertices[0] as TCameraVertex).EularAngle * weight[0] + (tVertices[1] as TCameraVertex).EularAngle * weight[1] + (tVertices[2] as TCameraVertex).EularAngle * weight[2]; var pivotPosition = (tVertices[0] as TCameraVertex).PivotPosition * weight[0] + (tVertices[1] as TCameraVertex).PivotPosition * weight[1] + (tVertices[2] as TCameraVertex).PivotPosition * weight[2]; //Add Other args if (OnPositionChanged != null) { OnPositionChanged.Invoke(eulerAngles, pivotPosition); } if (OnPositionChangedWithSplitArgs != null) { OnPositionChangedWithSplitArgs.Invoke(eulerAngles.x, eulerAngles.y, eulerAngles.z); } if (OnComplexEvent != null) { OnComplexEvent.Invoke(eulerAngles, pivotPosition, weight); } } return(true); } return(false); }
protected abstract bool TrangleCheckAndProcess(TTrangle tri);
public static bool IsPositiveOrder(TTrangle tTrangle) { return(CalOrienttionSign(tTrangle.vertices) < 0); }