|
Author Topic:   3d sprites
Cthulhu
Member
posted April 23, 2000 02:25 PM            
Quite stupid question but my brain's too stuck; what is a good way to draw 3d sprites? I mean just pictures that have z-coordinate and that scale with distance. No billboards.

Something like smoke, flashes, etc.

I use D3D (7).

IP:

Effin Goose
Member
posted April 23, 2000 08:37 PM            
Just give your sprite a xyz position in world space, and when it comes time to render, set up a polygon at that point with the sprites dimensions. eg. (Nb cut and paste from some old code)
mVertex[0].mPnt.x = -(mSizeX * 0.5) + WrldPnt.x;
mVertex[0].mPnt.y = -(mSizeY * 0.5) + WrldPnt.y;
mVertex[0].mPnt.z = WrldPnt.z;
mVertex[1].mPnt.x = (mSizeX * 0.5) + WrldPnt.x;
mVertex[1].mPnt.y = -(mSizeY * 0.5) + WrldPnt.y;
mVertex[1].mPnt.z = WrldPnt.z;
mVertex[2].mPnt.x = (mSizeX * 0.5) + WrldPnt.x;
mVertex[2].mPnt.y = (mSizeY * 0.5) + WrldPnt.y;
mVertex[2].mPnt.z = WrldPnt.z;
mVertex[3].mPnt.x = -(mSizeX * 0.5) + WrldPnt.x;
mVertex[3].mPnt.y = (mSizeY * 0.5) + WrldPnt.y;
mVertex[3].mPnt.z = WrldPnt.z;

Give the vertices texture coordinates, pass them in as world-space coordinates, and let your engine scale them with the world to screen transform. If thats too vague, sorry, in a rush..

Ryan

------------------
I dont like it, and Im sorry I ever had anything to do with it
- Schrodinger

IP: