Volker wrote:
Did you already read the
wiki entry for how to modify vertex data?
Sorry, i'm still not clear about it.
In my crowd simulation, i prepared 64 materials of different colors, as shown in Fig.1. For each model, it has the independent "scene.xml" and "material.xml"(Fig.2).
Attachment:
File comment: Fig.1
20160718131312.png [ 59.96 KiB | Viewed 36251 times ]
Attachment:
File comment: Fig.2
20160718131438.png [ 77.69 KiB | Viewed 36251 times ]
Right now, i use the following codes to achieve the change of each crowd node:
Code:
for( unsigned int i = 0; i < _particles.size(); ++i )
{
Particle &p = _particles[i];
h3dRemoveNode(p.node);
p.node = h3dAddNodes( H3DRootNode, walk[cl[i]]);
h3dSetupModelAnimStage( p.node, 0, walka[cl[i]], 0, "", false );
}
where
vector<H3DRes> walk, walka;
cl is the latest index of the H3DRes.
Although it works(refer to Fig.3), it's time consuming. Is there a better method with high efficiency?
Attachment:
File comment: Fig.3
crowd.jpg [ 114.96 KiB | Viewed 36251 times ]
Thanks.