Horde3D
http://horde3d.org/forums/

change material at runtime
http://horde3d.org/forums/viewtopic.php?f=2&t=424
Page 1 of 1

Author:  newbie3D [ 16.07.2008, 12:03 ]
Post subject:  change material at runtime

hi guys,

I'm looking for a function that could change material of an object at runtime.
I use the Horde3D::findResource (with ResourceTypes::Material) to find the resource handle. But then, which function is used to apply the new resource to the object?

Author:  Volker [ 16.07.2008, 12:38 ]
Post subject:  Re: change material at runtime

Horde3D::setNodeParami, unfortunately there is a typo in the documentation there are two times the setNodeParamf method. Instead the second setNodeParamf has to be setNodeParami:
Code:
Horde3D::setNodeParami( meshNodeID, MeshNodeParams::MaterialRes, newMaterialRes);

Author:  newbie3D [ 17.07.2008, 03:08 ]
Post subject:  Re: change material at runtime

Thanks Volker. I got it now.

Author:  sellee [ 05.04.2010, 00:51 ]
Post subject:  python code

Code:
envMat = h3d.addResource(h3d.ResTypes.Material,"models/knight/env.material.xml",0)
h3d.utils.loadResourcesFromDisk("Content")      
h3d.findNodes(self._knight, 'osh_body', h3d.NodeTypes.Mesh)
osh_body = h3d.getNodeFindResult(0)
h3d.setNodeParamI(osh_body,h3d.Mesh.MatResI ,envMat)

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/