/// <summary> /// Loads the mesh data. /// </summary> protected override void LoadImpl() { // meshLoadMeter.Enter(); // load this bad boy if it is not to be manually defined if (!isManual) { // get the resource data from MeshManager Stream data = MeshManager.Instance.FindResourceData(name); string extension = Path.GetExtension(name); // mesh loading stats int before, after; // get the tick count before loading the mesh before = Environment.TickCount; if (extension == ".mesh") { // instantiate a mesh reader and pass in the stream data MeshSerializer meshReader = new MeshSerializer(); // import the .mesh file meshReader.ImportMesh(data, this); } else if (extension == ".xml") { OgreXmlMeshReader meshReader = new OgreXmlMeshReader(data); // import the .xml file meshReader.Import(this); } else if (extension == ".dae") { ColladaMeshReader meshReader = new ColladaMeshReader(data, "tmp"); // import the .dae file meshReader.Import(this); } else { data.Close(); throw new AxiomException("Unsupported mesh format '{0}'", extension); } // get the tick count after loading the mesh after = Environment.TickCount; // record the time elapsed while loading the mesh log.InfoFormat("Mesh: Loaded '{0}', took {1}ms", this.name, (after - before)); // close the stream (we don't need to leave it open here) data.Close(); } // prepare the mesh for a shadow volume? if (MeshManager.Instance.PrepareAllMeshesForShadowVolumes) { if (edgeListsBuilt || autoBuildEdgeLists) { PrepareForShadowVolume(); } if (!edgeListsBuilt && autoBuildEdgeLists) { BuildEdgeList(); } } // meshLoadMeter.Exit(); }