Original Post
How? Some easy tuts online?
// Begin loading a mesh ExtendedMaterial[] mtrl; private Material[] meshMat; private Texture[] meshTex; Mesh sysMesh = Mesh.FromFile("fileName.x", MeshFlags.Managed, device, out mtrl); //store mesh materials if ((mtrl != null) && (mtrl.Length > 0)) { meshMat = new Material[mtrl.Length]; meshTex = new Texture[mtrl.Length]; for (int i = 0; i < mtrl.Length; i++) { meshMat = mtrl.Material3D; if ((mtrl.TextureFilename != null) && (mtrl.TextureFilename != string.Empty)) { //There's a texture, load it meshTex = TextureLoader.FromFile(device, mtrl.TextureFilename); } } } public void OnResetDevice(object sender, EventArgs e) { ExtendedMaterial[] materials = null; Directory.SetCurrentDirectory(Application.StartupPath + @"\"); Device dev = (Device) sender; dev.RenderState.ZBufferEnable = true; dev.RenderState.Ambient = System.Drawing.Color.White; mesh = Mesh.FromFile("tiger.x", MeshFlags.SystemMemory, device, out materials); if(meshTextures == null) { meshTextures = new Texture[materials.Length]; meshMaterials = new Direct3D.Material[materials.Length]; for(int i=0; i<materials.Length; i++) { meshMaterials = materials.Material3D; meshMaterials.Ambient = meshMaterials.Diffuse; meshTextures = TextureLoader.FromFile(dev, materials.TextureFilename); } } }This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more