States of spatials

Hi folks,



I am currently quickly progressing in sorting things out for my game. Looking good so far.



While I am doing so, I noticed some things I’d like to ask you.



RenderStates have a wonderful feature. They can be enabled/disabled. While at the beginning I was at war with this feature, always forgetting to enable them, I meanwhile think this is a good thing. Now, if I currently want to enable/disable Spatials in the scene graph, I’ve found no other way than to detach them and attach them again later. Do you think it would be feasible to add an enable/disable property to Spatials, too? In case you ask why I need this: I need to switch on/of parts of my hud depending on the state of my game.



Second thing: RenderStates get propagated from tree nodes to their children. That is, if I set a TextureState for a node, its children will have this, too. Is it possible to set a TextureState for a child which overwrites the inherited one so that I can set my generaly HUD texture at the HUD root node and then overwrite this with a special one for only one or two quads?


I need to switch on/of parts of my hud depending on the state of my game

Ah, you'r facing the very same situation as I did a couple of weeks ago. I'm using setForceCull(boolean) which works as a charm.

/Per
  1. As Per said, use force Cull.
  2. TextureStates and LightStates are unique in the fact that they combine inherited states rather than overwriting. However, you can overwrite by setting the combine mode. See http://www.mojomonkeycoding.com/jmeforum/viewtopic.php?t=556

Thanks all, works perfectly. I think I was too fixated on words like enable or visible when looking for appropriate methods ://