Class sceneToImage

java.lang.Object
name.moore.kevin.ze.swing.sceneToImage
All Implemented Interfaces:
com.jme3.post.SceneProcessor

public class sceneToImage extends Object implements com.jme3.post.SceneProcessor
This added to a viewport where it copies rendered frames (in memory) onto a specified Swing panel. The processor wont function until attached to a viewport and the imagepanel has been set.
Author:
Kevin Moore <dev@kevin.moore.name>
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • cpuBuf

      private final ByteBuffer cpuBuf
    • jimagepanel

      private zImagePanel jimagepanel
    • viewport

      private com.jme3.renderer.ViewPort viewport
    • rendermanger

      private com.jme3.renderer.RenderManager rendermanger
    • init

      private boolean init
  • Constructor Details

    • sceneToImage

      public sceneToImage(int w, int h)
      Parameters:
      w -
      h -
  • Method Details

    • setPanel

      public void setPanel(zImagePanel zp)
    • initialize

      public void initialize(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp)
      Called when the viewport is rendered.
      Specified by:
      initialize in interface com.jme3.post.SceneProcessor
      Parameters:
      rm -
      vp -
    • 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)
      Update the CPU image's contents after the scene has been rendered to the framebuffer. Called after a frame has been rendered and the queue flushed.
      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
    • updateImageContents

      public void updateImageContents()
      called when the frame is completed - takes a copy of the offscreen buffer and paints it onto the swing component.