Пример #1
0
 public override void Setup()
 {
     sphereGO       = GameObjectFactory.CreateMeshGO("sphere", UnityUtil.GetSphereMesh(), false);
     sphereMaterial = MaterialF();
     sphereGO.SetMaterial(sphereMaterial);
     sphereMaterial.color = ColorF();
     MaterialUtil.DisableShadows(sphereGO);
 }
Пример #2
0
 public override void Setup()
 {
     planeGO       = GameObjectFactory.CreateMeshGO("section_plane", UnityUtil.GetTwoSidedPlaneMesh(), false);
     planeMaterial = MaterialF();
     planeGO.SetMaterial(planeMaterial);
     planeMaterial.color = ColorF();
     MaterialUtil.DisableShadows(planeGO);
     //planeGO.SetLayer(FPlatform.WidgetOverlayLayer);
 }
Пример #3
0
        public void AddComponent(MeshDecomposition.Component C)
        {
            fMesh           submesh    = new fMesh(C.triangles, mesh, C.source_vertices, true, true);
            fMeshGameObject submesh_go = GameObjectFactory.CreateMeshGO("component", submesh, false);

            submesh_go.SetMaterial(new fMaterial(CurrentMaterial));
            displayComponents.Add(new DisplayMeshComponent()
            {
                go = submesh_go, source_vertices = C.source_vertices
            });

            AppendNewGO(submesh_go, parentGO, false);
        }
Пример #4
0
        public void AddComponent(MeshDecomposition.Component C)
        {
            fMesh           submesh    = new fMesh(C.triangles, mesh, C.source_vertices, true, true, true);
            fMeshGameObject submesh_go = GameObjectFactory.CreateMeshGO("component", submesh, true);

            submesh_go.SetMaterial(SourceSO.CurrentMaterial, true);
            submesh_go.SetLayer(SourceSO.RootGameObject.GetLayer());
            displayComponents.Add(new DisplayMeshComponent()
            {
                go = submesh_go, source_vertices = C.source_vertices
            });
            if (SourceSO.ShadowsEnabled == false)
            {
                MaterialUtil.DisableShadows(submesh_go, true, true);
            }
            SourceSO.AppendNewGO(submesh_go, SourceSO.RootGameObject, false);
        }
Пример #5
0
        static public fGameObject EmitDebugMesh(string name, DMesh3 meshIn, Colorf color, GameObject parent = null, bool bIsInWorldPos = true)
        {
            DMesh3 mesh = new DMesh3(meshIn);

            if (FPlatform.InMainThread() == false)
            {
                ThreadMailbox.PostToMainThread(() => { DebugUtil.EmitDebugMesh(name, mesh, color, parent, bIsInWorldPos); });
                return(null);
            }
            fMeshGameObject fMeshGO = GameObjectFactory.CreateMeshGO(name, new fMesh(mesh), false, true);

            fMeshGO.SetMaterial(MaterialUtil.CreateStandardMaterialF(color));
            if (parent != null)
            {
                parent.AddChild(fMeshGO, bIsInWorldPos);
            }
            return(fMeshGO);
        }
Пример #6
0
        public List <fGameObject> Generate()
        {
            fMesh           mesh    = FResources.LoadMesh(Path);
            fMeshGameObject fMeshGO = GameObjectFactory.CreateMeshGO("iconMesh", mesh, false, true);

            fMeshGO.SetMaterial(MaterialUtil.CreateStandardMaterial(this.Color), true);

            // apply orientation
            fMeshGO.SetLocalScale(new Vector3f(Scale, Scale, Scale));
            fMeshGO.SetLocalPosition(fMeshGO.GetLocalPosition() + Translate);
            fMeshGO.SetLocalRotation(Rotate);

            // ignore material changes when we add to GameObjectSet
            fMeshGO.AddComponent <IgnoreMaterialChanges>();

            return(new List <fGameObject>()
            {
                fMeshGO
            });
        }
Пример #7
0
        public virtual void ValidateViewMeshes()
        {
            if (decomp_valid)
            {
                return;
            }

            fMesh unityMesh = UnityUtil.DMeshToUnityMesh(mesh, false, true);

            viewMeshGO = GameObjectFactory.CreateMeshGO("component", unityMesh, false, true);
            viewMeshGO.SetMaterial(SourceSO.CurrentMaterial, true);
            viewMeshGO.SetLayer(SourceSO.RootGameObject.GetLayer());
            if (SourceSO.ShadowsEnabled == false)
            {
                MaterialUtil.DisableShadows(viewMeshGO, true, true);
            }
            SourceSO.AppendNewGO(viewMeshGO, SourceSO.RootGameObject, false);

            decomp_valid = true;
        }
Пример #8
0
        static public fGameObject EmitDebugBox(string name, Box3d box, Colorf color, GameObject parent = null, bool bIsInWorldPos = true)
        {
            if (FPlatform.InMainThread() == false)
            {
                ThreadMailbox.PostToMainThread(() => { DebugUtil.EmitDebugBox(name, box, color, parent, bIsInWorldPos); });
                return(null);
            }
            TrivialBox3Generator boxgen = new TrivialBox3Generator()
            {
                Box = box, NoSharedVertices = true, Clockwise = true
            };

            boxgen.Generate();
            DMesh3          mesh    = boxgen.MakeDMesh();
            fMeshGameObject fMeshGO = GameObjectFactory.CreateMeshGO(name, new fMesh(mesh), false, true);

            fMeshGO.SetMaterial(MaterialUtil.CreateStandardMaterialF(color));
            if (parent != null)
            {
                parent.AddChild(fMeshGO, bIsInWorldPos);
            }
            return(fMeshGO);
        }
Пример #9
0
 public override void Setup()
 {
     sphereGO = GameObjectFactory.CreateMeshGO("brush_roi_sphere");
     sphereGO.SetMesh(UnityUtil.GetSphereMesh());
     sphereGO.SetLayer(FPlatform.WidgetOverlayLayer);
 }