Lazlo Posted March 2, 2005 Posted March 2, 2005 I´m using the code below to load a .x file, but can´t figure out how to load the textures from the X file. :confused: Plz help me with som code snippets showing how to do this. Mesh = Mesh.FromFile(Application.StartupPath & "/Map.X", MeshFlags.Dynamic, obj3DDevice) MeshMaterials = New Material MeshMaterials.Ambient = Color.White obj3DDevice.Material = MeshMaterials MeshTextures = TextureLoader.FromFile(obj3DDevice, Application.StartupPath & "/texture.bmp") Quote
ThePentiumGuy Posted March 3, 2005 Posted March 3, 2005 I didn't even know that .x files would come WITH textures... Odd I know that there's something called Mesh.TextureFileName. This is what I use to load meshes with textures (not within the mesh, but seperately) <Edit: Please ignore. The code I pasted ended up being one HUGE (wide) line. See next post> Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
ThePentiumGuy Posted March 3, 2005 Posted March 3, 2005 Argh. iNet. Public Sub LoadMesh(ByVal FileName As String, ByVal TextureFileName As String) Dim intX As Integer objMesh = Mesh.FromFile(FileName, MeshFlags.SystemMemory, d3ddev, extMaterials) ReDim MeshTexture(extMaterials.Length) ReDim Mat(extMaterials.Length) For intX = 0 To extMaterials.Length - 1 Mat(intX) = extMaterials(intX).Material3D Mat(intX).Ambient = Mat(intX).Diffuse extMaterials(intX).TextureFilename = TextureFileName MeshTexture(intX) = TextureLoader.FromFile(d3ddev, extMaterials(intX).TextureFilename) Next End Sub Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
Lazlo Posted March 4, 2005 Author Posted March 4, 2005 Problem Solved I solved the problem and it´s working just fine ;) Quote
ThePentiumGuy Posted March 9, 2005 Posted March 9, 2005 So... .x files come with textures? Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
ayhanozgul Posted June 13, 2005 Posted June 13, 2005 I solved the problem and it´s working just fine ;) can you send me the code Quote
DrunkenHyena Posted June 20, 2005 Posted June 20, 2005 So... .x files come with textures? They can embed the texture name. A common problem is that the texture filename may have a complete or partial path in the .x file (it all depends on the modeler and exporter) and that path will rarely match up with where your loading app expects them to be. Quote
Knight Chat X Posted August 4, 2005 Posted August 4, 2005 Simple process, the good thing about this is you load .fx shaders the same way given you add some extra code to handle the rendering passes. The reference information is in the .X File. If your mesh has been saved with the appropriate references then when you load it it will automatically load this information for you in arrays, all you need to do is setup a simple render loop for the object and apply your textures, etc.. :D :rolleyes: :p :cool: Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.