RenderManager : Changed renderScene to reset the camera plane state to 0 (the first node to render is not always a root, it can be a sub part of the scene graph) and call renderSubScene.

Created a private method renderSubScene that recursively renders the scene graph.
This fixes culling issues with the reflection/redraction processors for the water effects se this post
http://jmonkeyengine.org/groups/graphics/forum/topic/possibly-bug-simplewater-postprocessor-renders-entire-scene-no-frustrum-of-objects/?#post-192561

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9790 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 12 years ago
parent 3afb803c68
commit 281d38d609
  1. 14
      engine/src/core/com/jme3/renderer/RenderManager.java

@ -636,9 +636,15 @@ public class RenderManager {
* contain the flattened scene graph. * contain the flattened scene graph.
*/ */
public void renderScene(Spatial scene, ViewPort vp) { public void renderScene(Spatial scene, ViewPort vp) {
if (scene.getParent() == null) { //reset of the camera plane state for proper culling (must be 0 for the first note of the scene to be rendered)
vp.getCamera().setPlaneState(0); vp.getCamera().setPlaneState(0);
} //rendering the scene
renderSubScene(scene, vp);
}
// recursively renders the scene
private void renderSubScene(Spatial scene, ViewPort vp) {
// check culling first. // check culling first.
if (!scene.checkCulling(vp.getCamera())) { if (!scene.checkCulling(vp.getCamera())) {
// move on to shadow-only render // move on to shadow-only render
@ -658,7 +664,7 @@ public class RenderManager {
for (int i = 0; i < children.size(); i++) { for (int i = 0; i < children.size(); i++) {
// Restoring cam state before proceeding children recusively // Restoring cam state before proceeding children recusively
vp.getCamera().setPlaneState(camState); vp.getCamera().setPlaneState(camState);
renderScene(children.get(i), vp); renderSubScene(children.get(i), vp);
} }
} else if (scene instanceof Geometry) { } else if (scene instanceof Geometry) {
// add to the render queue // add to the render queue

Loading…
Cancel
Save