help me about smeshbuffer

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
pakata
Posts: 18
Joined: Tue Sep 23, 2008 11:51 pm
Location: korea rep of

help me about smeshbuffer

Post by pakata »

1. what is normal position???
2. and indices format... it's right?
i received indices from 3ds a , b , c (unsigned short)
it working well in ==code 2==
but convert to node is something problem...

Code: Select all


    // add all of the verts 
   printf( "Adding %d verts\n", gr[k].grcnt ); 
    smeshbuffer->Vertices.set_used(gr[k].grcnt); 
    for ( i = 0; i < gr[k].grcnt; i++ ) 
    { 
        smeshbuffer->Vertices[i].Pos.set( 
                                            verts[k][i].x, 
                                            verts[k][i].y, 
                                            verts[k][i].z ); 
//        smeshbuffer->Vertices[i].Normal.set( 
//                                            verts[k][i].x, 
//                                            verts[k][i].y, 
//                                            verts[k][i].z ); 
		smeshbuffer->Vertices[i].Color = video::SColor(0,255,255,255); 
        smeshbuffer->Vertices[i].TCoords.set( 
                                            coord[k][i].a, 
                                            coord[k][i].a ); 
    } 

    // add all of the indices 
	printf( "Adding %d indicies\n", gr[k].pollycnt ); 
	smeshbuffer->Indices.set_used(gr[k].pollycnt); 
    for ( i = 0; i < gr[k].pollycnt; i++ ) 
    { 
		smeshbuffer->Indices[i] = polys[k][i].a;
		smeshbuffer->Indices[i] = polys[k][i].b; 
		smeshbuffer->Indices[i] = polys[k][i].c; 
    } 


===============code2==================================

Code: Select all

for(k=1;k<=grcnt;k++){
	for(i=0;i<(gr[k].pollycnt-1);i++){
		a=polys[k][i].a;
		b=polys[k][i].b;
		c=polys[k][i].c;
		core::vector3df ta,tb,tc;
		ta=core::vector3df(verts[k][a].x,verts[k][a].y,verts[k][a].z);
		tb=core::vector3df(verts[k][b].x,verts[k][b].y,verts[k][b].z);
		tc=core::vector3df(verts[k][c].x,verts[k][c].y,verts[k][c].z);
		driver->draw3DTriangle(	core::triangle3df(ta,tb,tc),video::SColor(0,255,255,0) );
	}
}
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

normals are not positions, but directions. It's a vector which is perpendicular to the face the vertex belongs to, pointing away from the front face of the poly. It's necessary for proper lighting of the faces.
Indices format is just the number of the vertex in the vertex list, starting with 0 as first vertex. So for a quad (two triangles with two shared vertices) you will only need 4 vertices and 6 indices: 0,1,2, 0,2,3
Due to the s3dvertex being much larger than a s16 value you can save much memory using indices.
pakata
Posts: 18
Joined: Tue Sep 23, 2008 11:51 pm
Location: korea rep of

Post by pakata »

thank u
um...
but i can't find normal..
normal mean... next vertices by index..?
or inner,outer mean?
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

pakata
Posts: 18
Joined: Tue Sep 23, 2008 11:51 pm
Location: korea rep of

Post by pakata »

oh thank u
i have no idea of normal
but just look that link picture
i see @@;;
Post Reply