Package com.jme3.niftygui
Class NiftyJmeDisplay
java.lang.Object
com.jme3.niftygui.NiftyJmeDisplay
- All Implemented Interfaces:
SceneProcessor
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AssetManagerprotected JmeBatchRenderBackendprotected intprotected booleanprotected InputManagerprotected InputSystemJmeprotected de.lessvoid.nifty.Niftyprotected RenderDeviceJmeprotected Rendererprotected RenderManagerprotected NiftyJmeDisplay.ResourceLocationJmeprotected SoundDeviceJmeprotected ViewPortprotected int -
Constructor Summary
ConstructorsConstructorDescriptionNiftyJmeDisplay(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 TypeMethodDescriptionvoidcleanup()Called when the SP is removed from the RM.de.lessvoid.nifty.NiftygetNifty()voidinitialize(RenderManager rm, ViewPort vp) Called in the render thread to initialize the scene processor.booleanstatic NiftyJmeDisplaynewNiftyJmeDisplay(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, ViewPort viewport) Create a new NiftyJmeDisplay for use with the Batched Nifty Renderer.static NiftyJmeDisplaynewNiftyJmeDisplay(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.voidpostFrame(FrameBuffer out) Called after a frame has been rendered and the queue flushed.voidpostQueue(RenderQueue rq) Called after the scene graph has been queued, but before it is flushed.voidpreFrame(float tpf) Called before a framevoidCalled when the resolution of the viewport has been changed.voidsetProfiler(AppProfiler profiler) Sets a profiler Instance for this processor.voidsimulateKeyEvent(KeyInputEvent event) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:SceneProcessorCalled in the render thread to initialize the scene processor.- Specified by:
initializein 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:SceneProcessorCalled when the resolution of the viewport has been changed.- Specified by:
reshapein interfaceSceneProcessor- Parameters:
vp- the affected ViewPortw- the new width (in pixels)h- the new height (in pixels)
-
isInitialized
public boolean isInitialized()- Specified by:
isInitializedin interfaceSceneProcessor- Returns:
- True if initialize() has been called on this SceneProcessor, false if otherwise.
-
preFrame
public void preFrame(float tpf) Description copied from interface:SceneProcessorCalled before a frame- Specified by:
preFramein interfaceSceneProcessor- Parameters:
tpf- Time per frame
-
postQueue
Description copied from interface:SceneProcessorCalled after the scene graph has been queued, but before it is flushed.- Specified by:
postQueuein interfaceSceneProcessor- Parameters:
rq- The render queue
-
postFrame
Description copied from interface:SceneProcessorCalled after a frame has been rendered and the queue flushed.- Specified by:
postFramein interfaceSceneProcessor- Parameters:
out- The FB to which the scene was rendered.
-
cleanup
public void cleanup()Description copied from interface:SceneProcessorCalled when the SP is removed from the RM.- Specified by:
cleanupin interfaceSceneProcessor
-
setProfiler
Description copied from interface:SceneProcessorSets a profiler Instance for this processor.- Specified by:
setProfilerin 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.