Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Training Tutorials
01-26-2008, 10:06 PM,
#12
 
Okay, so the steps are:
1) Create a SCENENODE and DRAWABLE in the scenegraph
2) Set up the drawable
3) Generate the vertex array

You just have to do those once, and then it gets drawn every frame automatically.

When you're done you need to:
4) Tell the scenegraph to delete your SCENENODE

Here's how you do step 1:
Code:
SCENENODE & my_node = game.graphics.GetScene().GetRoot().AddNode();
DRAWABLE & my_drawable = my_node.AddDrawable();

Of course, you'll want to store the SCENENODE and DRAWABLE in some container class as pointers or something so you can access them later.

Step 2:
Code:
TEXTUREINFO tex;
tex.SetName("path/to/texture.png");
my_drawable.SetDiffuseMap(tex);
my_drawable.SetLit(false);
my_drawable.SetPartialTransparency(true);
VERTEXARRAY & my_vertarray = my_drawable.SetToVertexArray();

Step 3:
You need to build up arrays of normals (optional), vertices, faces, and texture coordinates, then do:
Code:
my_vertexarray.SetFaces(facearray,facearraysize);
my_vertexarray.SetVertices(vertexarray,vertexarraysize);
my_vertexarray.SetTexCoordSets(1);
my_vertexarray.SetTexCoords(texcoordarray,texcoordarraysize);

The face array is an array of int values where each 3 consecutive int values are indices into the 3 vertices/texcoords for the face. The vertex array is an array of floats where each 3 consecutive floats represent a vertex. The texcoord array is an array of floats where each 2 consecutive floats represent a texture coordinate. That might not make sense on the first read, so ask me to clarify if needed.

Step 4:
Code:
game.graphics.GetScene().GetRoot().Delete(&my_node);
Reply


Messages In This Thread
Training Tutorials - by thelusiv - 01-21-2008, 12:06 AM
[No subject] - by joevenzon_phpbb2_import3 - 01-21-2008, 09:10 PM
[No subject] - by thelusiv - 01-21-2008, 09:38 PM
[No subject] - by joevenzon_phpbb2_import3 - 01-24-2008, 02:06 AM
[No subject] - by thelusiv - 01-24-2008, 05:11 PM
[No subject] - by rookie1 - 01-25-2008, 01:04 AM
[No subject] - by joevenzon_phpbb2_import3 - 01-25-2008, 10:39 PM
[No subject] - by rookie1 - 01-26-2008, 03:45 AM
[No subject] - by thelusiv - 01-26-2008, 04:26 AM
[No subject] - by joevenzon_phpbb2_import3 - 01-26-2008, 11:26 AM
[No subject] - by thelusiv - 01-26-2008, 02:31 PM
[No subject] - by joevenzon_phpbb2_import3 - 01-26-2008, 10:06 PM
[No subject] - by rookie1 - 01-31-2008, 10:08 PM
[No subject] - by thelusiv - 02-02-2008, 11:03 PM
[No subject] - by joevenzon_phpbb2_import3 - 02-05-2008, 01:44 AM
[No subject] - by rookie1 - 03-08-2008, 12:19 AM
[No subject] - by thelusiv - 03-08-2008, 02:06 PM
[No subject] - by joevenzon_phpbb2_import3 - 03-08-2008, 02:14 PM
[No subject] - by rookie1 - 03-10-2008, 08:14 AM
[No subject] - by thelusiv - 03-11-2008, 12:54 AM
[No subject] - by thelusiv - 03-11-2008, 03:01 AM
[No subject] - by joevenzon_phpbb2_import3 - 03-12-2008, 10:48 AM
[No subject] - by rookie1 - 03-13-2008, 09:36 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)