Original Post
Hi guys.
I have a rendering system, where every frame I iterate a list (std::vector<>) of objects pointers to change a particular “field”, (member variable) . For example, in the beginning of the rendering loop, I set all of my object to invisible, and then after traversing the octree, I set the objects that belong to a visible octree node(leaf) to visible in order to render them later on.
If I have something like this
How can I fast change all member variables of the g_pObjects list b_visible to false, whitout iterating over the list like this
Can I do some smart memory copy operation with some kind of mask, in order to zero only the b_visible variables of the list without iterating over the list ?
Same issue appears when I try to render my impostors. I have an array of D3DXVECTOR3 for visible positions that is updated every frame, but then I need to update my vertex buffer positions so all the impostors be rendered with one draw call. How can I merge the array with the positions(3D vectors) with the array of 3D vertices that contain other stuff like texture coordinates, color etc..
I have a rendering system, where every frame I iterate a list (std::vector<>) of objects pointers to change a particular “field”, (member variable) . For example, in the beginning of the rendering loop, I set all of my object to invisible, and then after traversing the octree, I set the objects that belong to a visible octree node(leaf) to visible in order to render them later on.
If I have something like this
Class object
{
bool b_visible ;
D3DXVECTOR3 v_position ;
} ;
std::vector<object*> g_pObjects ;How can I fast change all member variables of the g_pObjects list b_visible to false, whitout iterating over the list like this
for(int i = 0 ; i < g_pObjects.size() ; i++) g_pObjects->b_visible = false ; Can I do some smart memory copy operation with some kind of mask, in order to zero only the b_visible variables of the list without iterating over the list ?
Same issue appears when I try to render my impostors. I have an array of D3DXVECTOR3 for visible positions that is updated every frame, but then I need to update my vertex buffer positions so all the impostors be rendered with one draw call. How can I merge the array with the positions(3D vectors) with the array of 3D vertices that contain other stuff like texture coordinates, color etc..