Thursday, June 23, 2011

Meshes

 3D Models are made up of vertices that can form drawing primitives.
Thus conceptually a mesh can be defined by a set of vertices and a set of indices.
Vertices have information for position, color, texturing, lighting etc.
And indices group those vertices into drawing primitives.

//A simple vertex will have the following data
Vertex
{
position,
normal,
texture coordinate
};

//A mesh will have the following data
VertexArray[] = {...} //What are the vertices that form the model
IndexArray[] = {...} //What is the order of the vertices that form the drawing primitive

Where
drawing primitive = {point, line, triangle, ... }

Now we can.

Stream the mesh data between graphics card memory and system memory.
Define local axes,angles, axial and object bounding volumes.
Connect the mesh with a scene graph system.
Connect the mesh with a physics system.
Apply transforms on meshes to make simple animations;
Register a bone hierarchy suitable to the mesh with transforms and weights.
Chain a list of morph targets.
Chain a list of meshes with decreasing level of detail.
Add a list of vertex/fragment shaders.
Change the state of rendering/animation with game/graphics events.

and so on.

All of this start from how to render the vertices with less space and in minimum time.

Ref:
OpenGL : begin .. end paradigm, vertex arrays, VBO

For commercial file formats refer
3D File formats: Obj, 3DS, PVR, X, COLLADA, FBX