Package com.jme3.system
Class AWTFrameProcessor
java.lang.Object
com.jme3.system.AWTFrameProcessor
- All Implemented Interfaces:
com.jme3.post.SceneProcessor,PropertyChangeListener,EventListener
public class AWTFrameProcessor
extends Object
implements com.jme3.post.SceneProcessor, PropertyChangeListener
A frame processor that enables to render JMonkey frame buffer onto an AWT component.
This class is based on the JavaFX original code provided by Alexander Brui (see JME3-FX)
- Author:
- Julien Seinturier - COMEX SA - http://www.seinturier.fr, Alexander Brui (JavaSaBr)
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ComponentThe destination of jMe frames.protected PropertyChangeListenerThe height listener.protected PropertyChangeListenerThe ration listener.protected PropertyChangeListenerThe width listener. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidBind this processor.voidbind(Component destination, com.jme3.app.Application application, com.jme3.renderer.ViewPort viewPort) Bind this processor.voidbind(Component destination, com.jme3.app.Application application, com.jme3.renderer.ViewPort viewPort, boolean main) Bind this processor.protected voidbindDestination(com.jme3.app.Application application, Component destination) Bind this processor.protected voidvoidcleanup()protected AWTComponentRenderercreateFrameTransfer(com.jme3.texture.FrameBuffer frameBuffer, int width, int height) Create a new frame transfer.protected com.jme3.app.ApplicationGets the application.protected intGets camera angle.protected ComponentGets the current destination.protected intGets destination height.protected intGets destination width.protected AWTComponentRendererGets the frame transfer.protected com.jme3.renderer.RenderManagerGets the render manager.protected com.jme3.renderer.ViewPortGets the view port.protected booleanChecks of existing application.protected booleanChecks of existing destination.voidinitialize(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) booleanbooleanbooleanisMain()protected booleanIs preserve ratio.protected voidnotifyChangedHeight(Number newValue) Notify about that the height was changed.protected voidnotifyChangedRatio(Boolean newValue) Notify about that the ratio was changed.protected voidnotifyChangedWidth(Number newValue) Notify about that the width was changed.protected voidnotifyComponentResized(int newWidth, int newHeight, boolean fixAspect) Handle resizing.voidpostFrame(com.jme3.texture.FrameBuffer out) voidpostQueue(com.jme3.renderer.queue.RenderQueue rq) voidpreFrame(float tpf) voidvoidreshape()voidreshape(com.jme3.renderer.ViewPort vp, int w, int h) protected voidreshapeCurrentViewPort(int width, int height) Reshape the current view port.protected AWTComponentRendererreshapeInThread(int width, int height, boolean fixAspect) Reshape the current frame transfer for the new size.protected voidsetApplication(com.jme3.app.Application application) Sets the application.protected voidsetDestination(Component destination) Sets the destination.voidsetEnabled(boolean enabled) protected voidsetFrameTransfer(AWTComponentRenderer frameTransfer) Sets the frame transfer.voidsetProfiler(com.jme3.profile.AppProfiler profiler) voidsetTransferMode(AWTFrameProcessor.TransferMode transferMode) voidunbind()Unbind this processor from its current destination.protected voidUnbind this processor from destination.protected voidMethods 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
-
widthListener
The width listener. -
heightListener
The height listener. -
rationListener
The ration listener. -
destination
The destination of jMe frames.
-
-
Constructor Details
-
AWTFrameProcessor
public AWTFrameProcessor()
-
-
Method Details
-
initialize
public void initialize(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) - Specified by:
initializein interfacecom.jme3.post.SceneProcessor
-
reshape
public void reshape(com.jme3.renderer.ViewPort vp, int w, int h) - Specified by:
reshapein interfacecom.jme3.post.SceneProcessor
-
isInitialized
public boolean isInitialized()- Specified by:
isInitializedin interfacecom.jme3.post.SceneProcessor
-
preFrame
public void preFrame(float tpf) - Specified by:
preFramein interfacecom.jme3.post.SceneProcessor
-
postQueue
public void postQueue(com.jme3.renderer.queue.RenderQueue rq) - Specified by:
postQueuein interfacecom.jme3.post.SceneProcessor
-
postFrame
public void postFrame(com.jme3.texture.FrameBuffer out) - Specified by:
postFramein interfacecom.jme3.post.SceneProcessor
-
cleanup
public void cleanup()- Specified by:
cleanupin interfacecom.jme3.post.SceneProcessor
-
setProfiler
public void setProfiler(com.jme3.profile.AppProfiler profiler) - Specified by:
setProfilerin interfacecom.jme3.post.SceneProcessor
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
notifyChangedRatio
Notify about that the ratio was changed.- Parameters:
newValue- the new value of the ratio.
-
notifyChangedHeight
Notify about that the height was changed.- Parameters:
newValue- the new value of the height.
-
notifyChangedWidth
Notify about that the width was changed.- Parameters:
newValue- the new value of the width.
-
getApplication
protected com.jme3.app.Application getApplication()Gets the application.- Returns:
- the application.
-
setApplication
protected void setApplication(com.jme3.app.Application application) Sets the application.- Parameters:
application- the application.
-
getDestination
Gets the current destination.- Returns:
- the current destination.
-
setDestination
Sets the destination.- Parameters:
destination- the destination.
-
hasDestination
protected boolean hasDestination()Checks of existing destination.- Returns:
- true if destination is exists.
-
hasApplication
protected boolean hasApplication()Checks of existing application.- Returns:
- true if destination is exists.
-
getFrameTransfer
Gets the frame transfer.- Returns:
- the file transfer.
-
setFrameTransfer
Sets the frame transfer.- Parameters:
frameTransfer- the file transfer.
-
getViewPort
protected com.jme3.renderer.ViewPort getViewPort()Gets the view port.- Returns:
- the view port.
-
getRenderManager
protected com.jme3.renderer.RenderManager getRenderManager()Gets the render manager.- Returns:
- the render manager.
-
isMain
public boolean isMain() -
isEnabled
public boolean isEnabled() -
setEnabled
public void setEnabled(boolean enabled) -
notifyComponentResized
protected void notifyComponentResized(int newWidth, int newHeight, boolean fixAspect) Handle resizing.- Parameters:
newWidth- the new width.newHeight- the new height.fixAspect- true to fix the aspect ratio.
-
reshape
public void reshape() -
isPreserveRatio
protected boolean isPreserveRatio()Is preserve ratio.- Returns:
- is preserve ratio.
-
getDestinationWidth
protected int getDestinationWidth()Gets destination width.- Returns:
- the destination width.
-
getDestinationHeight
protected int getDestinationHeight()Gets destination height.- Returns:
- the destination height.
-
bind
Bind this processor.- Parameters:
destination- the destination.application- the application.
-
bind
public void bind(Component destination, com.jme3.app.Application application, com.jme3.renderer.ViewPort viewPort) Bind this processor.- Parameters:
destination- the destination.application- the application.viewPort- the view port.
-
bind
public void bind(Component destination, com.jme3.app.Application application, com.jme3.renderer.ViewPort viewPort, boolean main) Bind this processor.- Parameters:
destination- the destination.application- the application.viewPort- the view port.main- true if this processor is main.
-
unbind
public void unbind()Unbind this processor from its current destination. -
bindDestination
Bind this processor.- Parameters:
application- the application.destination- the destination.
-
unbindDestination
protected void unbindDestination()Unbind this processor from destination. -
bindListeners
protected void bindListeners() -
unbindListeners
protected void unbindListeners() -
reshapeInThread
Reshape the current frame transfer for the new size.- Parameters:
width- the width.height- the height.fixAspect- true to fix the aspect ratio.- Returns:
- the new frame transfer.
-
createFrameTransfer
protected AWTComponentRenderer createFrameTransfer(com.jme3.texture.FrameBuffer frameBuffer, int width, int height) Create a new frame transfer.- Parameters:
frameBuffer- the frame buffer.width- the width.height- the height.- Returns:
- the new frame transfer.
-
reshapeCurrentViewPort
protected void reshapeCurrentViewPort(int width, int height) Reshape the current view port.- Parameters:
width- the width.height- the height.
-
getCameraAngle
protected int getCameraAngle()Gets camera angle.- Returns:
- the camera angle.
-
getTransferMode
-
setTransferMode
-