Horde3D http://horde3d.org/forums/ |
|
Changing material http://horde3d.org/forums/viewtopic.php?f=2&t=1499 |
Page 1 of 1 |
Author: | mikel [ 13.04.2011, 17:45 ] |
Post subject: | Changing material |
Hi again. Having problems with setNodeParamI, dont know how to use it correctly. I try to change a material of my wall object (called wallNode), to make it transparent. Code: int wallNode = h3d.addNodes(h3d.H3DRootNode, wallRes); transparentWallRes = h3d.addResource((int)h3d.H3DResTypes.Material, "models/transparent_wall.material.xml", 0); Horde3DUtils.loadResourcesFromDisk(Settings.ContentDir); // I have tried this h3d.setNodeParamI(wallNode, (int)h3d.H3DMesh.MatResI, transparentWallRes); // and this // h3d.setNodeParamI(wallNode, (int)h3d.H3DMatRes.MatLinkI, transparentWallRes); // and even this // h3d.setNodeParamStr(wallNode, (int)h3d.H3DMatRes.MatClassStr, "Translucent"); //( class="Translucent" is the difference with original material and transparent_wall.material.xml) I always get 'Invalid param in h3dSetNodeParam'. |
Author: | AlexL [ 13.04.2011, 19:37 ] |
Post subject: | Re: Changing material |
I assume your wallRes is a Scenegraph and wallNode is a Model node. Have a look at http://www.horde3d.org/docs/html/_api.html#H3DModel It does not have a MatResI param, that's why you get the Invalid Param. You can change the material resource on a Mesh node only. If you only have a Model node at hand, use the h3dFindNodes function to search for your specific Mesh below the Model node. |
Author: | mikel [ 13.04.2011, 23:01 ] |
Post subject: | Re: Changing material |
Ahaa, I understand now little better that setNodeParamI method. I wrote Code: if (h3d.findNodes(wallNode, "Rectangle01", (int)h3d.H3DNodeTypes.Mesh) != 0) { int mesh = h3d.getNodeFindResult(0); h3d.setNodeParamI(mesh, (int)h3d.H3DMesh.MatResI, transparentWallRes); } and it worked. Thanks! |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |