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); }
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; }