Models Vertex

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
djoker
Posts: 39
Joined: Thu Dec 22, 2005 10:25 pm
Location: Portugal

Models Vertex

Post by djoker »

hi ppl ;)

i will try my best 2 explain my problem
sorry my English :(

i try to load new models to IRR and
all models have this way +-

Code: Select all


for(int i = 0; i < g_3DModel.numOfObjects; i++)
{
t3DObject *pObject = &g_3DModel.pObject[i];

glBegin(GLTriangles);					
// Go through all of the faces (polygons) of the object and draw them

for(int j = 0; j < pObject->numOfFaces; j++)
    {
   // Go through each corner of the triangle and draw it.

for(int whichVertex = 0; whichVertex < 3; whichVertex++)
    {

// Get the vertex index for each point of the face
int vertIndex = pObject->pFaces[j].vertIndex[whichVertex];

// Pass in the current vertex of the object (Corner of current face)
glVertex3f(pObject->pVerts[ vertIndex ].x, pObject->pVerts[ vertIndex ].y, pObject->pVerts[ vertIndex ].z);

				}
			}

		glEnd();								
// End the drawing
	}

i get the triangles this way

int vertIndex = pObject->pFaces[j].vertIndex[whichVertex];
pObject->pVerts[ vertIndex ]//vertex

we have all triangles .
on IRR we draw by index (drawIndexedTriangleList)

in this code we get the triangle by index
my problem is how i pass the triangles and index :(

Vertices[0] = video::S3DVertex(
pObject->pVerts[ vertIndex ].x, pObject->pVerts[ vertIndex ].y, pObject->pVerts[ vertIndex ].z,
pObject->pNormals[ vertIndex ].x, pObject->pNormals[ vertIndex ].y, pObject->pNormals[ vertIndex ].z,
video::SColor(255,255,255,255),
pObject->pTexVerts[ coordIndex ].x, pObject->pTexVerts[ coordIndex ].y);

driver->drawIndexedTriangleList(&Vertices[0], 3, ?????, 3);


i next irr version irr must have drawTringleList :roll:
Never underestimate the power of Delphi....Ignorance is bliss, but knowledge is power...
Lekane
Posts: 31
Joined: Thu Jun 01, 2006 7:07 pm

Post by Lekane »

you should have a look at tutorial 3
djoker
Posts: 39
Joined: Thu Dec 22, 2005 10:25 pm
Location: Portugal

Post by djoker »

Lekane wrote:you should have a look at tutorial 3
:( dude my pronb is not in IRR


i try the code from gametutorial

i just want 2 render external models

on tut 2 you have the indices define

u16 indices[] = { 0,2,3, 2,1,3, 1,0,3, 2,0,1 };
Never underestimate the power of Delphi....Ignorance is bliss, but knowledge is power...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

So what's your problem then? Just draw the index vertices from the example and you should understand the mechanism. If you just draw independent triangles without using vertices twice you just make the indices 0,1,2,...,n for n vertices.
djoker
Posts: 39
Joined: Thu Dec 22, 2005 10:25 pm
Location: Portugal

Post by djoker »

hybrid wrote:So what's your problem then? Just draw the index vertices from the example and you should understand the mechanism. If you just draw independent triangles without using vertices twice you just make the indices 0,1,2,...,n for n vertices.
hybrid i love you ;)
Never underestimate the power of Delphi....Ignorance is bliss, but knowledge is power...
Post Reply