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)
  • Field Details

  • Constructor Details

    • AWTFrameProcessor

      public AWTFrameProcessor()
  • Method Details

    • initialize

      public void initialize(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp)
      Specified by:
      initialize in interface com.jme3.post.SceneProcessor
    • 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
    • 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 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

      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 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

      public void bind(Component destination, com.jme3.app.Application application)
      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

      protected void bindDestination(com.jme3.app.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(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

      public AWTFrameProcessor.TransferMode getTransferMode()
    • setTransferMode

      public void setTransferMode(AWTFrameProcessor.TransferMode transferMode)