I’m refactoring all our shader and textures system, this time using panda’s priority.
But I’ve got a problem with meshes.
I’ve got an architecture that look like this:
Node ( setTextureOff(25) )
'--> Procedural Mesh ( setTexture(25)) [ work]
'--> Procedural mesh without texture ( setTextureOff(25) ) [ work ]
'--> Mesh ( from loader.loadMesh) [ doesn't work ]
so I can override the first setTextureOff with a setTexture of the same or higher priority.
But with meshes that used texture, I can’t put a ‘setTexture(25)’ since the texture are in the mesh( .egg)
So knowing that I can’t change the original setTextureOff(25). ( I haven’t got access to it from where I’m, and is it useful some of other node
Is there a way to still displaying the meshes_textures ?
a ‘setTextureOn(25)’ function ?
Let me see if I understand. You’ve got a node that you have called setTextureOff(25) on. This call, of course, disables all textures at that node and below. Below this node, you have a mesh node that you loaded from an egg file which contains textures that you really want to display after all. You want to force those textures to display?
My first answer would be to find a different way to structure your scene graph. It sounds like you are rather abusing the hierarchical state system. For instance, do you really need to call setTextureOff() on the whole root? Maybe you could have a different node that only gets the setTextureOff(), and your mesh is parented to a sibling or parent of that node?
Another possibility would be to figure out what textures you have on your mesh, and reapply then with a new setTexture() call, this time specifying a priority override of 25.
But, finally, there actually is a workaround that does exactly what you need. Use mesh.adjustAllPriorities(25). This will find all of the attributes at the mesh node and below, and add 25 to their priority override values, changing the default value of 0 to 25. Suddenly your textures will become visible. It’s a dangerous call, though, because if you call it repeatedly, the priorities will be adjusted each time. Also, it changes every priority, not just the TextureAttrib priorities.
I agree the scene is quite strange.
It’s because it’s part of an editor, and I want to apply a shader ( to show the selection) to one element only.
Each node has a setTextureOff to override the property of its parent. Then apply its own texture. its own texture depending on the selection,…
But I found a way to stay on standard priority so that the mesh’s texture are still displayed.