コード例 #1
0
        protected override void on_curve_validated()
        {
            if (previewGO != null)
            {
                RemoveGO((fGameObject)previewGO);
                previewGO.Destroy();
            }


            if (EnableRegionOverlay)
            {
                if (TargetModelSO == null)
                {
                    throw new InvalidOperationException("EnclosedPatchSO.on_curve_validated: curve is not connected to a Target");
                }
                if (TransformMode != OutputCurveTransform.ToTargetSO)
                {
                    throw new InvalidOperationException("EnclosedPatchSO.on_curve_validated: curve is not transformed to TargetSO");
                }

                DCurve3           target_curve = RequestCurveCopyFromMainThread();
                MeshFacesFromLoop loop         = new MeshFacesFromLoop(TargetModel.SourceMesh,
                                                                       target_curve, TargetModel.SourceSpatial);
                MeshFaceSelection face_selection = loop.ToSelection();

                DSubmesh3 submesh = new DSubmesh3(TargetModel.SourceMesh, face_selection, face_selection.Count);

                MeshNormals normals = new MeshNormals(submesh.SubMesh);
                normals.Compute();
                foreach (int vid in submesh.SubMesh.VertexIndices())
                {
                    Vector3d n = normals.Normals[vid];
                    Vector3d v = submesh.SubMesh.GetVertex(vid);
                    v += 0.1 * n;
                    v  = SceneTransforms.TransformTo(v, TargetModelSO, this);
                    submesh.SubMesh.SetVertex(vid, v);
                }

                previewGO = GameObjectFactory.CreateMeshGO("patch",
                                                           new fMesh(submesh.SubMesh), false, true);
                previewGO.SetMaterial(previewMaterial, true);
                previewGO.SetLayer(FPlatform.WidgetOverlayLayer);
                previewGO.SetIgnoreMaterialChanges();
                AppendNewGO(previewGO, root, false);
            }
        }
コード例 #2
0
ファイル: MeshTubePreview.cs プロジェクト: tomleetv/gsCore
 public void Destroy()
 {
     meshObject.SetParent(null);
     meshObject.Destroy();
 }
コード例 #3
0
 public void Destroy()
 {
     meshObject.Destroy();
 }