public static IModel Load(string name, string path, float height) { if (!System.IO.File.Exists(path)) { throw new System.IO.FileNotFoundException("Could not load model '" + path + "'", path); } Model loadedModel = new Model(); loadedModel._key = name; // todo: fix bounding radius loadedModel._RadiusSquared = 100; try { R3D_3DStudio _3dsfile = new R3D_3DStudio(); _3dsfile.File_Open(path); _3dsfile.File_ReadMaterials(); _3dsfile.File_ReadTextures(); //_3dsfile.File_ReadScene(loadedModel.Key, true, false, true); _3dsfile.File_ReadMeshes(name, true, true, true, true, true); _3dsfile.File_Close(); loadedModel._id = Engine.MeshBuilder.Mesh_Create(name); //Engine.Meshbuilder.Mesh_SetCullMode(R3DCULLMODE.R3DCULLMODE_DOUBLESIDED); //Engine.Meshbuilder.Mesh_SetLayerConfig(0, R3DLAYERCONFIG.R3DLAYERCONFIG_MONOCHROME); //System.Windows.Forms.MessageBox.Show(Engine.TextureLib.Class_GetNumTextures().ToString()); loadedModel._RadiusSquared = 1000; } catch (Exception e) { throw new ModelNotLoadedException(path, e); } loadedModel.Position = Vector3D.Origin; return(loadedModel); }
public static IModel Load( string name, string path, float height ) { if(!System.IO.File.Exists(path)) { throw new System.IO.FileNotFoundException("Could not load model '" + path + "'", path); } Model loadedModel = new Model(); loadedModel._key = name; // todo: fix bounding radius loadedModel._RadiusSquared = 100; try { R3D_3DStudio _3dsfile = new R3D_3DStudio(); _3dsfile.File_Open(path); _3dsfile.File_ReadMaterials(); _3dsfile.File_ReadTextures(); //_3dsfile.File_ReadScene(loadedModel.Key, true, false, true); _3dsfile.File_ReadMeshes(name, true, true,true,true,true); _3dsfile.File_Close(); loadedModel._id = Engine.MeshBuilder.Mesh_Create( name ); //Engine.Meshbuilder.Mesh_SetCullMode(R3DCULLMODE.R3DCULLMODE_DOUBLESIDED); //Engine.Meshbuilder.Mesh_SetLayerConfig(0, R3DLAYERCONFIG.R3DLAYERCONFIG_MONOCHROME); //System.Windows.Forms.MessageBox.Show(Engine.TextureLib.Class_GetNumTextures().ToString()); loadedModel._RadiusSquared = 1000; } catch(Exception e) { throw new ModelNotLoadedException(path, e); } loadedModel.Position = Vector3D.Origin; return loadedModel; }