MeshView gets a textured object, but I don't
Hi all (again),
I'm trying to render a mesh, which is loaded from a .x-file. The problem is that I got none texture information at all, but the DirectX SDK's MeshView got it! How come? I'm really confused about this, guys and need help.
PS. I'm using managed DirectX if that matter and I'm using the methods in Tom Miller's "Managed DirectX"-book.
// Daniel
Ok. If that the case, let's be a little more technical then. I do something like this:
All entries in mtrl's members's TextureFilename is null. =(
Mesh tempMesh = Mesh.FromFile(file, MeshFlags.Managed, device, out mtrl);
All entries in mtrl's members's TextureFilename is null. =(
Hmm. Here you have some more code if it's requiered.
public Ship(Device device) { this.device = device; ExtendedMaterial[] em; mesh = Mesh.FromFile(path, MeshFlags.Managed, device, out em); if (em != null && em.Length > 0) { materials = new Material[em.Length]; textures = new Texture[em.Length]; for (int i = 0; i < em.Length; i++) { this.materials = em.Material3D; if (em.TextureFilename != null && em.TextureFilename != string.Empty) this.textures = TextureLoader.FromFile(device, @"..\..\" + em.TextureFilename); } } } public void Draw(float yaw, float pitch, float roll, Vector3 pos) { this.device.Transform.World = Matrix.RotationYawPitchRoll(yaw, pitch, roll); this.device.Transform.World *= Matrix.Translation(pos); for (int i = 0; i < materials.Length; i++) { this.device.Material = this.materials; this.device.SetTexture(0, this.textures); mesh.DrawSubset(i); } }
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement