Class AWTFrameProcessor

java.lang.Object
com.jme3.system.AWTFrameProcessor
All Implemented Interfaces:
SceneProcessor, PropertyChangeListener, EventListener

public class AWTFrameProcessor extends Object implements 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)

  • Field Details

  • Constructor Details

    • AWTFrameProcessor

      public AWTFrameProcessor()
  • Method Details

    • initialize

      public void initialize(RenderManager rm, ViewPort vp)
      Description copied from interface: SceneProcessor
      Called in the render thread to initialize the scene processor.
      Specified by:
      initialize in interface SceneProcessor
      Parameters:
      rm - The render manager to which the SP was added to
      vp - The viewport to which the SP is assigned
    • reshape

      public void reshape(ViewPort vp, int w, int h)
      Description copied from interface: SceneProcessor
      Called when the resolution of the viewport has been changed.
      Specified by:
      reshape in interface SceneProcessor
      Parameters:
      vp - the affected ViewPort
      w - the new width (in pixels)
      h - the new height (in pixels)
    • isInitialized

      public boolean isInitialized()
      Specified by:
      isInitialized in interface SceneProcessor
      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 interface SceneProcessor
      Parameters:
      tpf - Time per frame
    • postQueue

      public void postQueue(RenderQueue rq)
      Description copied from interface: SceneProcessor
      Called after the scene graph has been queued, but before it is flushed.
      Specified by:
      postQueue in interface SceneProcessor
      Parameters:
      rq - The render queue
    • postFrame

      public void postFrame(FrameBuffer out)
      Description copied from interface: SceneProcessor
      Called after a frame has been rendered and the queue flushed.
      Specified by:
      postFrame in interface SceneProcessor
      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 interface SceneProcessor
    • setProfiler

      public void setProfiler(AppProfiler profiler)
      Description copied from interface: SceneProcessor
      Sets a profiler Instance for this processor.
      Specified by:
      setProfiler in interface SceneProcessor
      Parameters:
      profiler - the profiler instance.
    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      Specified by:
      propertyChange in interface PropertyChangeListener
    • notifyChangedRatio

      protected void notifyChangedRatio(Boolean newValue)
      Notify about that the ratio was changed.
      Parameters:
      newValue - the new value of the ratio.
    • notifyChangedHeight

      protected void notifyChangedHeight(Number newValue)
      Notify about that the height was changed.
      Parameters:
      newValue - the new value of the height.
    • notifyChangedWidth

      protected void notifyChangedWidth(Number newValue)
      Notify about that the width was changed.
      Parameters:
      newValue - the new value of the width.
    • getApplication

      protected Application getApplication()
      Gets the application.
      Returns:
      the application.
    • setApplication

      protected void setApplication(Application application)
      Sets the application.
      Parameters:
      application - the application.
    • getDestination

      protected Component getDestination()
      Gets the current destination.
      Returns:
      the current destination.
    • setDestination

      protected void setDestination(Component destination)
      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

      protected AWTComponentRenderer getFrameTransfer()
      Gets the frame transfer.
      Returns:
      the file transfer.
    • setFrameTransfer

      protected void setFrameTransfer(AWTComponentRenderer frameTransfer)
      Sets the frame transfer.
      Parameters:
      frameTransfer - the file transfer.
    • getViewPort

      protected ViewPort getViewPort()
      Gets the view port.
      Returns:
      the view port.
    • getRenderManager

      protected 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

      public void bind(Component destination, Application application)
      Bind this processor.
      Parameters:
      destination - the destination.
      application - the application.
    • bind

      public void bind(Component destination, Application application, ViewPort viewPort)
      Bind this processor.
      Parameters:
      destination - the destination.
      application - the application.
      viewPort - the view port.
    • bind

      public void bind(Component destination, Application application, 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

      protected void bindDestination(Application application, Component destination)
      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

      protected AWTComponentRenderer reshapeInThread(int width, int height, boolean fixAspect)
      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(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

      public AWTFrameProcessor.TransferMode getTransferMode()
    • setTransferMode

      public void setTransferMode(AWTFrameProcessor.TransferMode transferMode)