The StandardGame PassManager

Hi,



I'm currently working with StandardGame as the base of my application.



Until now I've managed to make things work sucessfully (mainly using the GameState architecture), however I'm annoyed by the presence of a PassManager instance in the StandardGame class. Maybe I'm using gamestates incorrectly.



What I have is a LevelRenderState which has the following render method (basically, it renders my level rootNode):



   /**
    * Draws the level (and debug info, if needed).
    */
   public void render(float tpf) {
      
      DisplaySystem.getDisplaySystem().getRenderer().draw(System.getLevel().getRootNode());
      
      if (System.getSettings().getRender().isDrawNormals()) {
         Debugger.drawNormals(System.getLevel().getRootNode(), DisplaySystem.getDisplaySystem().getRenderer());
      }
      if (System.getSettings().getRender().isDrawBounds()) {
         Debugger.drawBounds(System.getLevel().getRootNode(), DisplaySystem.getDisplaySystem().getRenderer());
      }      
      if (System.getSettings().getRender().isDrawPhysics()) {
         PhysicsDebugger.drawPhysics( System.getLevel().getPhysicsSpace(), DisplaySystem.getDisplaySystem().getRenderer());
      }
      super.render (tpf);
   }



And, in my ConsoleState I have the following render method (it renders the console rootNode):


   /**
    * Draws the console.
    */
   public void render(float tpf) {
      DisplaySystem.getDisplaySystem().getRenderer().draw(rootNode);
      super.render (tpf);
   }



This works nice, as my level is rendered first (with debugging info if needed), then I render anything contained within the LevelRenderState, and then my console will be rendered if its GameState is active.

However, the implementation of the render method in StandardGame is as follows:


   protected void render(float interpolation) {
      display.getRenderer().clearBuffers();

      // Execute renderQueue item
      GameTaskQueueManager.getManager().getQueue(GameTaskQueue.RENDER).execute();

      GameStateManager.getInstance().render(interpolation);

      // Render PassManager
      passManager.renderPasses(display.getRenderer());

      // Render FPS
      display.getRenderer().draw(fpsNode);
   }



Does this mean that whatever I put in that passManager will be always rendered after all my GameStates have rendered?

I would prefer to manage my own PassManager in the states where it is needed. I think it suits more the GameState architecture.

Maybe I'm doing things incorrectly calling Renderer.draw() in each state for the geometry contained in that state?

Thanks, and sorry for the poor english  :oops:

Hmmm…I think you're correct.  I think I just got carried away trying to add features and was thinking, "Gee, it would be really awesome if it was just a couple lines of code to add shadow support in a game via StandardGame".  I think I'll probably still try to do that, but probably using ShadowedGameState or something instead…



Is anyone relying on the PassManager in StandardGame currently?

Oh!  This is exactly what I just whined about in the other thread.  The loading game state looks funny when a bloom effect is applied to it.  :wink:



edit:  well, maybe not exactly…but close. hehe

Okay you whiners!  :stuck_out_tongue:



I just checked in the following changes:


* Moved the FPS counter out of StandardGame and into DebugGameState
* Fixed bug in StandardGame defaulting to mouse cursor being visible
* Removed PassManager from StandardGame



I'm also working on another update to the GameControl system that I'll be releasing fairly soon.

Hooray!! I was waiting for that FPS change.



No need for my "custom" version anymore.

I'd kiss you, but perhaps you would then turn into a darkprincess, which we don't want  }:-@

jjmontes said:

I'd kiss you, but perhaps you would then turn into a darkprincess, which we don't want  }:-@


First my wife would slap you, then I'd hit you, then you'd get warts....I wouldn't recommend it.  :P