Working out of a vertex array for destrucible objects
Posted
by
bobobobo
on Game Development
See other posts from Game Development
or by bobobobo
Published on 2012-09-29T16:17:10Z
Indexed on
2012/09/29
21:51 UTC
Read the original article
Hit count: 253
I have diamond-shaped polygonal bullets. There are lots of them on the screen.
I did not want to create a vertex array for each, so I packed them into a single vertex array and they're all drawn at once.
| bullet1.xyz | bullet1.rgb | bullet2.xyz | bullet2.rgb
This is great for performance.. there is
struct Bullet
{
vector<Vector3f*> verts ; // pointers into the vertex buffer
} ;
This works fine, the bullets can move and do collision detection, all while having their data in one place.
Except when a bullet "dies"
Then you have to clear a slot, and pack all the bullets towards the beginning of the array.
Is this a good approach to handling lots of low poly objects? How else would you do it?
© Game Development or respective owner