Horde3D http://horde3d.org/forums/ |
|
How to change the H3Dres for a model during the simulation? http://horde3d.org/forums/viewtopic.php?f=1&t=2287 |
Page 1 of 1 |
Author: | jacmy [ 16.07.2016, 10:14 ] |
Post subject: | How to change the H3Dres for a model during the simulation? |
How to change the H3Dres for a model during the simulation? |
Author: | Volker [ 17.07.2016, 22:41 ] |
Post subject: | Re: How to change the H3Dres for a model during the simulati |
Did you already read the wiki entry for how to modify vertex data? |
Author: | jacmy [ 18.07.2016, 06:28 ] |
Post subject: | Re: How to change the H3Dres for a model during the simulati |
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 20952 times ] Attachment:
File comment: Fig.2 20160718131438.png [ 77.69 KiB | Viewed 20952 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 20952 times ] Thanks. |
Author: | Irdis [ 26.07.2016, 18:25 ] |
Post subject: | Re: How to change the H3Dres for a model during the simulati |
There are several ways to achieve what you want. 1) You can modify a uniform in material through h3dSetMaterialUniform. For example, you have a color uniform that you can change in application. But this way requires modification of shaders. 2) Change a material of a mesh. h3dSetNodeParamI( meshID, H3DMatRes::MaterialElem, materialID ); You can also change a texture in a material, if needed: h3dSetResParamI( materialID, H3DMatRes::SamplerElem, 0, H3DMatRes::SampTexResI, TextureID) |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |