public override void Unload() { if (Root.Children.Length > 0) Root.RemoveAll(); node = null; base.Unload(); }
private void UpdateBoundingBox(MeshSceneNode node) { if (node == null) return; Mesh mesh = node.GetMesh(); if (mesh == null) return; Box3D box = new Box3D(0, 0, 0, 0, 0, 0); for (int i = 0; i < mesh.MeshBufferCount; i++) { mesh.GetMeshBuffer(i).RecalculateBoundingBox(); box.AddInternalBox(mesh.GetMeshBuffer(i).BoundingBox); } mesh.BoundingBox = box; }
private void GeneratePickTile() { AnimatedMesh animMesh = Reference.SceneManager.GetMesh(Util.ApplicationDataDirectory + @"/media/models/tile.x"); if (animMesh != null) { Mesh mesh = animMesh.GetMesh(0); pickSceneNode = Reference.SceneManager.AddMeshSceneNode(mesh, ParentNode, -1); pickSceneNode.TriangleSelector = Reference.SceneManager.CreateTriangleSelector(mesh, pickSceneNode); pickSceneNode.TriangleSelector.Drop(); pickSceneNode.SetMaterialType(MaterialType.TransparentAlphaChannel); } }
private void CreatePicker() { string path = Path.Combine(dir, "tile.x"); if (File.Exists(path)) { AnimatedMesh mesh = Render.Scene.GetMesh(path); if (mesh != null) node = Render.Scene.AddMeshSceneNode(mesh.GetMesh(0), Root, -1); if (node != null) { node.TriangleSelector = Render.Scene.CreateTriangleSelector(mesh.GetMesh(0), node); node.SetMaterialType(MaterialType.TransparentAlphaChannel); node.Rotation = Util.ROTATION_OFFSET; } } }