示例#1
0
        public IEnumerator UpdateGeometryOnMainThread()
        {
            if (InteriorComponents == null)
            {
                yield break;
            }
            if (is_disconnected)
            {
                yield break;
            }
            ComponentData interior = InteriorComponents;

            // if mesh was modified before we got here, push it back onto dirty list
            if (interior.timestamp != SO.Mesh.ShapeTimestamp)
            {
                OnComputeUpdateRequired?.Invoke(this);
                yield break;
            }

            foreach (DMesh3 mesh in interior.InteriorMeshes)
            {
                if (is_disconnected || interior.timestamp != SO.Mesh.ShapeTimestamp)
                {
                    yield break;
                }
                fMeshGameObject go = GameObjectFactory.CreateMeshGO("interior_comp", new fMesh(mesh), false, true);
                SO.RootGameObject.AddChild(go, false);
                go.SetMaterial(CavityMaterial, true);
                go.SetLayer(FPlatform.WidgetOverlayLayer);
                MeshGOs.Add(go);
                yield return(null);
            }
        }
示例#2
0
        public IEnumerator UpdateGeometryOnMainThread()
        {
            if (BoundaryInfo == null)
            {
                yield break;
            }
            if (is_disconnected)
            {
                yield break;
            }
            MeshBoundaryData boundary_info = BoundaryInfo;

            // if mesh was modified before we got here, push it back onto dirty list
            if (boundary_info.timestamp != SO.Mesh.ShapeTimestamp)
            {
                OnComputeUpdateRequired?.Invoke(this);
                yield break;
            }

            int add_per_frame = 100;
            int counter       = 0;

            foreach (DCurve3 loop in boundary_info.Loops)
            {
                if (is_disconnected || boundary_info.timestamp != SO.Mesh.ShapeTimestamp)
                {
                    yield break;
                }
                List <Vector3f> vertices = new List <Vector3f>(loop.Vertices.Select(x => (Vector3f)x).ToList());
                vertices.Add(vertices[0]);
                fPolylineGameObject go = GameObjectFactory.CreatePolylineGO("boundary_curve", vertices, BoundaryLoopColor, BoundaryCurveWidth, LineWidthType.Pixel);
                SO.RootGameObject.AddChild(go, false);
                BoundaryCurveGOs.Add(go);
                if (counter++ == add_per_frame)
                {
                    counter = 0;
                    yield return(null);
                }
            }
            foreach (DCurve3 span in boundary_info.Spans)
            {
                if (is_disconnected || boundary_info.timestamp != SO.Mesh.ShapeTimestamp)
                {
                    yield break;
                }
                List <Vector3f>     vertices = new List <Vector3f>(span.Vertices.Select(x => (Vector3f)x).ToList());
                fPolylineGameObject go       = GameObjectFactory.CreatePolylineGO("boundary_span", vertices, BoundaryLoopColor, BoundaryCurveWidth, LineWidthType.Pixel);
                SO.RootGameObject.AddChild(go, false);
                BoundaryCurveGOs.Add(go);
                if (counter++ == add_per_frame)
                {
                    counter = 0;
                    yield return(null);
                }
            }
        }
示例#3
0
 private void OnInputMeshModified(DMeshSO so)
 {
     OnComputeUpdateRequired?.Invoke(this);
 }
 private void OnInputModified(ToolpathSO so)
 {
     OnComputeUpdateRequired?.Invoke(this);
 }