3d sprites?
Hi, I want to use sprites in 3d space. I havn''t tried it yet but can i just set the transform z distance and get the sprite to move around in 3d space???
I''d appreciate any input on 3d sprites and what things I should avoid doing...
i dunno how to get DX''s modelview matrix
but here is for OpenGL
where pos is the position in 3d space of the sprite
but here is for OpenGL
glGetFloatv(GL_MODELVIEW_MATRIX, mat); CVector3 vx(mat[0], mat[4], mat[8] ); CVector3 vy(mat[1], mat[5], mat[9] ); glBegin(GL_QUADS); glColor4fv(color); glTexCoord2f(0.0f, 0.0f); tmp = (pos + (vx + vy) * -sizeX) ; p1[0] = tmp.x; p1[1] = tmp.y; p1[2] = tmp.z; glVertex3fv(p1); glTexCoord2f(1.0f, 0.0f); tmp = (pos + (vx - vy) * sizeX) ; p2[0] = tmp.x; p2[1] = tmp.y; p2[2] = tmp.z; glVertex3fv(p2); glTexCoord2f(1.0f, 1.0f); tmp = (pos + (vx + vy) * sizeX) ; p3[0] = tmp.x; p3[1] = tmp.y; p3[2] = tmp.z; glVertex3fv(p3); glTexCoord2f(0.0f, 1.0f); tmp = (pos + (vy - vx) * sizeX) ; p4[0] = tmp.x; p4[1] = tmp.y; p4[2] = tmp.z; glVertex3fv(p4); glEnd();
where pos is the position in 3d space of the sprite
I don't need to get the matrix since I have it in the first place... but how do I apply that to move and rotate my sprites in 3d space?
Do I do a normal transform before calling the render or what?
Or should I look into billboarding or some for of that...
[edited by - vi2 on April 21, 2003 11:45:35 AM]
Do I do a normal transform before calling the render or what?
Or should I look into billboarding or some for of that...
[edited by - vi2 on April 21, 2003 11:45:35 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement