Skip to main content
GameDev.net gamedev.net
🔒 Locked

Meshes

Started by illadel4life Jul 2, 2004 at 8:54 AM 4 replies 900+ views
Original Post
illadel4life
illadel4life
Yea what up peeps. If you don't know already I'm workin on that FG that everyone thinks I'm over my head but anyways I got a quick question. I wanna just say the question but it won't sound right so heres the situation. Making a Sonic level but in 3d. My first step was to think of how to save an entire level, so I went with a BMP file to represent all objects and "floor" polygons. Second step was to load the bmp and using the value of the pixel I could tell what object/objects are placed within the game world, so I made a parser and I am able to store the "floor" polygons and use a scale BMP->Game world pixel 1:10 ratio. Now its time to test the whole thing and load the floor meshes, thing is I'm at work and not in contact to my Graphics engine (Tricks of 3D Game Guru Andre LaMonth??) so just wondering what is the lowest form way of creating a mesh in Direct3D? I have all the vertexs and the distance away from the origin. I am looking at the .X file format "Tiger.x" from the tutorial but no Docs really describ the .X format so I can utilize it. Well untill someone replies I'll be looking for .X docs and try to figure this out. I just wanna see my level! If I can load an entire level for my game thats like a solid 45% of the game is done. Pce and thanks in advance.
illadel4life
illadel4life
sup sup, upen reading the file itself many times over and a web site that explains the file format I have 1 remaining question. What are these templats I see? I get the Vertex list, and the Text coord list blah blah, but these templates I see no use for and if anything they do not define the values. Is there a simple cube example? Anybody got anything that could help me. I just want to make some progress on the map editor for my game, thanks again. pce
Jim Adams
Jim Adams
Comments pretty much say it all. First few lines are the .X header that defines it as a text source file using 64-bit floats and provides a generic Header object (defines version #s for your apps):

xof 0303txt 0064Header { 1; 0; 1; }// Start mesh data object - name it MeshNameMesh MeshName {  4;  // # of vertices in mesh (4 here for example)  0.00000, 0.00000, 0.00000;,  // 1st vert coords  0.00000, 0.00000, 0.00000;,  // 2nd vert coords  0.00000, 0.00000, 0.00000;,  // 3rd vert coords  0.00000, 0.00000, 0.00000;;  // 4th vert coords    2;  // # of faces in mesh (2 polygon faces for example)  3;0,1,2;,  // Face #0 uses 3 faces: 0, 1, 2  3;1,2,3;;  // Face #1 uses 3 faces: 1, 2, 3  // Define texture coords - match vertex order w/above  MeshTextureCoords {    4;  // Matches 4 vertices above    0.00000, 0.00000;,  // Vert #0 texture coords    0.00000, 0.00000;,  // Vert #1 texture coords    0.00000, 0.00000;,  // Vert #2 texture coords    0.00000, 0.00000;;  // Vert #3 texture coords  }  // Define a material for mesh  MeshMaterialList {    1;    // # materials (1 in this case)    2;    // # faces in first material (2 here)    0,    // Use material #0 (1st) on polygon #0    0;;   // Use material #0 (1st) on polygon #1    Material {      1.00000;1.00000;1.00000;;  // Diffuse      1.00000;                   // Power      0.00000;0.00000;0.00000;;  // Specular      0.00000;0.00000;0.00000;;  // Emmissive      // Use a texture map (exclude object if none)      TextureFilename {        "texture.bmp";   // Texture filename      }    }  }}
illadel4life
illadel4life
Thanks man, Like from the examples I've been reading and the code u just sent, I think I can make a simple cube. GOnna go try in like 4 minutes. But I'm assuming that code u sent is a COMPLETE mesh ?? I just can't believe all those templates were useless(I know they have uses!) I mean I just want to make a cube I suppose I didn't need 20+ templates. Thanks again. pce
Stevieboy
Stevieboy
Hey,hi.
Templates are like forward declarations, just as you have class declartions or something.
RenderTarget
RenderTarget
You don't need the standard mesh templates if you're loading the file with D3DXLoadMeshFromX() or its variants. Templates come in handy when you want to design your own file format or extensions to the standard stuff. You can define a template and make objects with it that the loader will understand. But that's purely an optional thing.
[sub]My spoon is too big.[/sub]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.