Class NiftyJmeDisplay

java.lang.Object
com.jme3.niftygui.NiftyJmeDisplay
All Implemented Interfaces:
com.jme3.post.SceneProcessor

public class NiftyJmeDisplay extends Object implements com.jme3.post.SceneProcessor
  • Field Details

    • inited

      protected boolean inited
    • nifty

      protected de.lessvoid.nifty.Nifty nifty
    • assetManager

      protected com.jme3.asset.AssetManager assetManager
    • renderManager

      protected com.jme3.renderer.RenderManager renderManager
    • inputManager

      protected com.jme3.input.InputManager inputManager
    • renderDev

      protected RenderDeviceJme renderDev
    • batchRendererBackend

      protected JmeBatchRenderBackend batchRendererBackend
    • inputSys

      protected InputSystemJme inputSys
    • soundDev

      protected SoundDeviceJme soundDev
    • renderer

      protected com.jme3.renderer.Renderer renderer
    • vp

      protected com.jme3.renderer.ViewPort vp
    • resourceLocation

      protected NiftyJmeDisplay.ResourceLocationJme resourceLocation
    • w

      protected int w
    • h

      protected int h
  • Constructor Details

    • NiftyJmeDisplay

      public NiftyJmeDisplay()
    • NiftyJmeDisplay

      public NiftyJmeDisplay(com.jme3.asset.AssetManager assetManager, com.jme3.input.InputManager inputManager, com.jme3.audio.AudioRenderer audioRenderer, com.jme3.renderer.ViewPort viewport, int atlasWidth, int atlasHeight)
      Create a new NiftyJmeDisplay for use with the Batched Nifty Renderer (improved Nifty rendering performance). Nifty will use a single texture of the given dimensions (see atlasWidth and atlasHeight parameters). Every graphical asset you're rendering through Nifty will be placed into this big texture. The goal is to render all Nifty components in a single (or at least very few) draw calls. This should speed up rendering quite a bit. Currently you have to make sure to not use more image space than this single texture provides. However, Nifty tries to be smart about this and internally will make sure that only the images are uploaded that your GUI really needs. So in general this shouldn't be an issue. A complete re-organisation of the texture atlas happens when a Nifty screen ends and another begins. Dynamically adding images while a screen is running is supported as well.
      Parameters:
      assetManager - jME AssetManager
      inputManager - jME InputManager
      audioRenderer - jME AudioRenderer
      viewport - Viewport to use
      atlasWidth - the width of the texture atlas Nifty uses to speed up rendering (2048 is a good value)
      atlasHeight - the height of the texture atlas Nifty uses to speed up rendering (2048 is a good value)
    • NiftyJmeDisplay

      public NiftyJmeDisplay(com.jme3.asset.AssetManager assetManager, com.jme3.input.InputManager inputManager, com.jme3.audio.AudioRenderer audioRenderer, com.jme3.renderer.ViewPort vp)
      Create a standard NiftyJmeDisplay. This uses the old Nifty renderer. It's probably slower than the batched renderer and is mainly here for backwards compatibility. Nifty colors are assumed to be in Linear colorspace (no gamma correction).
      Parameters:
      assetManager - jME AssetManager
      inputManager - jME InputManager
      audioRenderer - jME AudioRenderer
      vp - Viewport to use
    • NiftyJmeDisplay

      public NiftyJmeDisplay(com.jme3.asset.AssetManager assetManager, com.jme3.input.InputManager inputManager, com.jme3.audio.AudioRenderer audioRenderer, com.jme3.renderer.ViewPort vp, com.jme3.texture.image.ColorSpace colorSpace)
      Create a standard NiftyJmeDisplay. This uses the old Nifty renderer. It's probably slower than the batched renderer and is mainly here for backwards compatibility.
      Parameters:
      assetManager - jME AssetManager
      inputManager - jME InputManager
      audioRenderer - jME AudioRenderer
      vp - Viewport to use
      colorSpace - the ColorSpace to use for Nifty colors (sRGB or Linear)
  • Method Details

    • newNiftyJmeDisplay

      public static NiftyJmeDisplay newNiftyJmeDisplay(com.jme3.asset.AssetManager assetManager, com.jme3.input.InputManager inputManager, com.jme3.audio.AudioRenderer audioRenderer, com.jme3.renderer.ViewPort viewport)
      Create a new NiftyJmeDisplay for use with the Batched Nifty Renderer. Nifty will use texture atlases for rendering. Every graphical asset you're rendering through Nifty will be placed into a texture atlas. The goal is to render all Nifty components in a single (or at least very few) draw calls. This should speed up rendering quite a bit. This call will use a default BatchRenderConfiguration for Nifty. See the other method newNiftyJmeDisplay(com.jme3.asset.AssetManager, com.jme3.input.InputManager, com.jme3.audio.AudioRenderer, com.jme3.renderer.ViewPort, de.lessvoid.nifty.render.batch.BatchRenderConfiguration) when you want to change the default BatchRenderConfiguration and provide your own.
      Parameters:
      assetManager - jME AssetManager
      inputManager - jME InputManager
      audioRenderer - jME AudioRenderer
      viewport - Viewport to use
      Returns:
      new NiftyJmeDisplay instance
    • newNiftyJmeDisplay

      public static NiftyJmeDisplay newNiftyJmeDisplay(com.jme3.asset.AssetManager assetManager, com.jme3.input.InputManager inputManager, com.jme3.audio.AudioRenderer audioRenderer, com.jme3.renderer.ViewPort viewport, de.lessvoid.nifty.render.batch.BatchRenderConfiguration batchRenderConfiguration)
      Create a new NiftyJmeDisplay for use with the Batched Nifty Renderer. Nifty will use texture atlas for rendering. Every graphical asset you're rendering through Nifty will be placed into a texture atlas. The goal is to render all Nifty components in a single (or at least very few) draw calls. This should speed up rendering quite a bit.
      Parameters:
      assetManager - jME AssetManager
      inputManager - jME InputManager
      audioRenderer - jME AudioRenderer
      viewport - Viewport to use
      batchRenderConfiguration - the Nifty BatchRenderConfiguration that you can use to further configure batch rendering. If unsure you can simply use new BatchRenderConfiguration() in here for the default configuration which should give you good default values.
      Returns:
      new NiftyJmeDisplay instance
    • initialize

      public void initialize(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp)
      Specified by:
      initialize in interface com.jme3.post.SceneProcessor
    • getNifty

      public de.lessvoid.nifty.Nifty getNifty()
    • simulateKeyEvent

      public void simulateKeyEvent(com.jme3.input.event.KeyInputEvent event)
    • reshape

      public void reshape(com.jme3.renderer.ViewPort vp, int w, int h)
      Specified by:
      reshape in interface com.jme3.post.SceneProcessor
    • isInitialized

      public boolean isInitialized()
      Specified by:
      isInitialized in interface com.jme3.post.SceneProcessor
    • preFrame

      public void preFrame(float tpf)
      Specified by:
      preFrame in interface com.jme3.post.SceneProcessor
    • postQueue

      public void postQueue(com.jme3.renderer.queue.RenderQueue rq)
      Specified by:
      postQueue in interface com.jme3.post.SceneProcessor
    • postFrame

      public void postFrame(com.jme3.texture.FrameBuffer out)
      Specified by:
      postFrame in interface com.jme3.post.SceneProcessor
    • cleanup

      public void cleanup()
      Specified by:
      cleanup in interface com.jme3.post.SceneProcessor
    • setProfiler

      public void setProfiler(com.jme3.profile.AppProfiler profiler)
      Specified by:
      setProfiler in interface com.jme3.post.SceneProcessor