Package com.jme3.niftygui
Class NiftyJmeDisplay
java.lang.Object
com.jme3.niftygui.NiftyJmeDisplay
- All Implemented Interfaces:
SceneProcessor
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected AssetManager
protected JmeBatchRenderBackend
protected int
protected boolean
protected InputManager
protected InputSystemJme
protected de.lessvoid.nifty.Nifty
protected RenderDeviceJme
protected Renderer
protected RenderManager
protected NiftyJmeDisplay.ResourceLocationJme
protected SoundDeviceJme
protected ViewPort
protected int
-
Constructor Summary
ConstructorDescriptionNiftyJmeDisplay
(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, ViewPort vp) Create a standard NiftyJmeDisplay.NiftyJmeDisplay
(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, ViewPort viewport, int atlasWidth, int atlasHeight) Deprecated.NiftyJmeDisplay
(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, ViewPort vp, ColorSpace colorSpace) Create a standard NiftyJmeDisplay. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Called when the SP is removed from the RM.de.lessvoid.nifty.Nifty
getNifty()
void
initialize
(RenderManager rm, ViewPort vp) Called in the render thread to initialize the scene processor.boolean
static NiftyJmeDisplay
newNiftyJmeDisplay
(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, ViewPort viewport) Create a new NiftyJmeDisplay for use with the Batched Nifty Renderer.static NiftyJmeDisplay
newNiftyJmeDisplay
(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, ViewPort viewport, de.lessvoid.nifty.render.batch.BatchRenderConfiguration batchRenderConfiguration) Create a new NiftyJmeDisplay for use with the Batched Nifty Renderer.void
postFrame
(FrameBuffer out) Called after a frame has been rendered and the queue flushed.void
postQueue
(RenderQueue rq) Called after the scene graph has been queued, but before it is flushed.void
preFrame
(float tpf) Called before a framevoid
Called when the resolution of the viewport has been changed.void
setProfiler
(AppProfiler profiler) Sets a profiler Instance for this processor.void
simulateKeyEvent
(KeyInputEvent event) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jme3.post.SceneProcessor
rescale
-
Field Details
-
inited
protected boolean inited -
nifty
protected de.lessvoid.nifty.Nifty nifty -
assetManager
-
renderManager
-
inputManager
-
renderDev
-
batchRendererBackend
-
inputSys
-
soundDev
-
renderer
-
vp
-
resourceLocation
-
w
protected int w -
h
protected int h
-
-
Constructor Details
-
NiftyJmeDisplay
public NiftyJmeDisplay() -
NiftyJmeDisplay
public NiftyJmeDisplay(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, ViewPort viewport, int atlasWidth, int atlasHeight) Deprecated.use the static factory methodsnewNiftyJmeDisplay(com.jme3.asset.AssetManager, com.jme3.input.InputManager, com.jme3.audio.AudioRenderer, com.jme3.renderer.ViewPort)
ornewNiftyJmeDisplay(com.jme3.asset.AssetManager, com.jme3.input.InputManager, com.jme3.audio.AudioRenderer, com.jme3.renderer.ViewPort, de.lessvoid.nifty.render.batch.BatchRenderConfiguration)
instead of this constructor.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 AssetManagerinputManager
- jME InputManageraudioRenderer
- jME AudioRendererviewport
- Viewport to useatlasWidth
- 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(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, 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 AssetManagerinputManager
- jME InputManageraudioRenderer
- jME AudioRenderervp
- Viewport to use
-
NiftyJmeDisplay
public NiftyJmeDisplay(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, ViewPort vp, 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 AssetManagerinputManager
- jME InputManageraudioRenderer
- jME AudioRenderervp
- Viewport to usecolorSpace
- the ColorSpace to use for Nifty colors (sRGB or Linear)
-
-
Method Details
-
newNiftyJmeDisplay
public static NiftyJmeDisplay newNiftyJmeDisplay(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, 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 methodnewNiftyJmeDisplay(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 AssetManagerinputManager
- jME InputManageraudioRenderer
- jME AudioRendererviewport
- Viewport to use- Returns:
- new NiftyJmeDisplay instance
-
newNiftyJmeDisplay
public static NiftyJmeDisplay newNiftyJmeDisplay(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, 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 AssetManagerinputManager
- jME InputManageraudioRenderer
- jME AudioRendererviewport
- Viewport to usebatchRenderConfiguration
- 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
Description copied from interface:SceneProcessor
Called in the render thread to initialize the scene processor.- Specified by:
initialize
in interfaceSceneProcessor
- Parameters:
rm
- The render manager to which the SP was added tovp
- The viewport to which the SP is assigned
-
getNifty
public de.lessvoid.nifty.Nifty getNifty() -
simulateKeyEvent
-
reshape
Description copied from interface:SceneProcessor
Called when the resolution of the viewport has been changed.- Specified by:
reshape
in interfaceSceneProcessor
- Parameters:
vp
- the affected ViewPortw
- the new width (in pixels)h
- the new height (in pixels)
-
isInitialized
public boolean isInitialized()- Specified by:
isInitialized
in interfaceSceneProcessor
- Returns:
- True if initialize() has been called on this SceneProcessor, false if otherwise.
-
preFrame
public void preFrame(float tpf) Description copied from interface:SceneProcessor
Called before a frame- Specified by:
preFrame
in interfaceSceneProcessor
- Parameters:
tpf
- Time per frame
-
postQueue
Description copied from interface:SceneProcessor
Called after the scene graph has been queued, but before it is flushed.- Specified by:
postQueue
in interfaceSceneProcessor
- Parameters:
rq
- The render queue
-
postFrame
Description copied from interface:SceneProcessor
Called after a frame has been rendered and the queue flushed.- Specified by:
postFrame
in interfaceSceneProcessor
- Parameters:
out
- The FB to which the scene was rendered.
-
cleanup
public void cleanup()Description copied from interface:SceneProcessor
Called when the SP is removed from the RM.- Specified by:
cleanup
in interfaceSceneProcessor
-
setProfiler
Description copied from interface:SceneProcessor
Sets a profiler Instance for this processor.- Specified by:
setProfiler
in interfaceSceneProcessor
- Parameters:
profiler
- the profiler instance.
-
newNiftyJmeDisplay(com.jme3.asset.AssetManager, com.jme3.input.InputManager, com.jme3.audio.AudioRenderer, com.jme3.renderer.ViewPort)
ornewNiftyJmeDisplay(com.jme3.asset.AssetManager, com.jme3.input.InputManager, com.jme3.audio.AudioRenderer, com.jme3.renderer.ViewPort, de.lessvoid.nifty.render.batch.BatchRenderConfiguration)
instead of this constructor.