Version | |
1.2 - April 9, 2002 | |
Description | |
A simple wrapper for Direct3D8 Vertex Buffers. It's not meant to be high performance, it's meant to make prototyping and demoing quicker and easier. There's no documentation put together yet, but the header file is well commented. 2 examples programs are included in the zip file. I converted 2 of my D3D8 tutorials (Lesson 2b & Lesson 6) to show how it can be used. | |
Example Use | |
First the declaration:dhSimpleMesh my_cube(NUM_VERTICES, //Number of Vertices D3D8T_CUSTOMVERTEX, //Vertex specification D3DPT_TRIANGLELIST, //Primitive Type NUM_VERTICES/3); //Number of trianglesAfter you have your Device created: my_cube.SetDevice(g_d3d_device); my_cube.Alloc();Then either use one of the Fill methods or Lock/Unlock and fill it yourself: my_cube.Fill(g_vertices); //g_vertices is a pointer to an array of vertices or my_vertex *ptr; ptr=my_cube.Lock() //Loop through the vertices doing stuff my_cube.Unlock()To draw you have 3 options: Get a point to the vertex buffer and do it yourself IDirect3DVertexBuffer8 *vb; vb=my_cube.GetVB();You can set the textures, matrices, stream source and then call the Draw method: //Setup up all the rendering context my_cube.Draw();Or you can associate the texture and matrix information with the object and use DrawWithContext() my_cube.SetTexture(texture); //Associates a texture with the object (Does an AddRef too) my_cube.SetWorldMatrix(world_matrix); my_cube.DrawWithContext();When you're done: my_cube.Free(); | |
Download | |