java.lang.Object
WildMagic.LibApplications.OpenGLApplication.Application
WildMagic.LibApplications.OpenGLApplication.JavaApplication
WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
gov.nih.mipav.view.renderer.WildMagic.GPURenderBase
gov.nih.mipav.view.renderer.WildMagic.flythroughview.FlyThroughRender
All Implemented Interfaces:
com.jogamp.opengl.GLEventListener, SpaceNavigatorListener, FlyThroughRenderInterface, FlyPathBehavior_WM.Callback, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, Serializable, EventListener

public class FlyThroughRender extends GPURenderBase implements FlyThroughRenderInterface, FlyPathBehavior_WM.Callback, com.jogamp.opengl.GLEventListener, MouseWheelListener
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • m_kParent

      protected VolumeTriPlanarInterface m_kParent
      Parent user-interface and display frame.
    • m_kVolumeLayout

      private ModelImage3DLayout m_kVolumeLayout
      3D Layout of the ModelImage.
    • m_kSkeleton

      private Skeleton3D m_kSkeleton
      3D Skeleton of the ModelImage.
    • m_kFlyPathGraphCurve

      private FlyPathGraphCurve m_kFlyPathGraphCurve
      Fly path curve.
    • m_kFlyPathBehavior

      private FlyPathBehavior_WM m_kFlyPathBehavior
      Fly path behavior.
    • m_kAnnotateList

      private FlyPathAnnotateList_WM m_kAnnotateList
      Annotations along the fly path.
    • m_kMaskImage

      private ModelImage m_kMaskImage
      ModelImage used to generate the fly path.
    • m_iLastSelectedBranchIndex

      private int m_iLastSelectedBranchIndex
      Keep track of the last branch that was selected (at a branch point).
    • m_aiBranchIndexUnvisitedMax

      private int[] m_aiBranchIndexUnvisitedMax
      This is the range of path samples for each branch that are unvisited.
    • m_kNormalColorPathVisited

      private WildMagic.LibFoundation.Mathematics.ColorRGB m_kNormalColorPathVisited
      Color for the parts of the path that have been visited (Light Green)
    • m_kNormalColorPathUnvisited

      private WildMagic.LibFoundation.Mathematics.ColorRGB m_kNormalColorPathUnvisited
      Color for the parts of the path that have not yet been visited (Dark Green)
    • m_kSelectColorPathVisited

      private WildMagic.LibFoundation.Mathematics.ColorRGB m_kSelectColorPathVisited
      Color for selecting previously-visited parts of the path at a branch (Red)
    • m_kSelectColorPathUnvisited

      private WildMagic.LibFoundation.Mathematics.ColorRGB m_kSelectColorPathUnvisited
      Color for selecting previously-unvisited parts of the path at a branch (Dark Red)
    • m_aiBranchIndexUnvisitedMin

      private int[] m_aiBranchIndexUnvisitedMin
      This is the range of path samples for each branch that are unvisited.
    • m_kSurface

      private WildMagic.LibGraphics.SceneGraph.TriMesh m_kSurface
      The surface to fly through.
    • m_kLight

      private WildMagic.LibGraphics.Rendering.Light m_kLight
      Lighting in the scene.
    • m_kOptions

      private FlyThroughRender.SetupOptions m_kOptions
      Setup options.
    • m_kControlFrame

      private JPanelVirtualEndoscopySetup_WM m_kControlFrame
      This is the control frame which may need to be updated as the view changes.
    • m_kRotation

      private WildMagic.LibGraphics.SceneGraph.Node m_kRotation
      Mouse rotation.
    • m_kCortical

      private MjCorticalMesh_WM m_kCortical
      Calculating the mesh curvatures.
    • m_kCenter

      private WildMagic.LibFoundation.Mathematics.Vector3f m_kCenter
      Center of Mesh
    • m_kMeanCurvaturesLUT

      private ModelLUT m_kMeanCurvaturesLUT
      kMean curvature LUT. Pseudo color look up table.
    • m_kLightShader

      private SurfaceLightingEffect m_kLightShader
      Lighting effect.
    • m_akColorBackup

      private WildMagic.LibFoundation.Mathematics.ColorRGB[] m_akColorBackup
      Original surface color for undoing the pseudo-color curvature map.
    • pressed

      private volatile boolean pressed
      If any of the mouse move button pressed.
    • lookup

      public static int lookup
    • lookdown

      public static int lookdown
    • lookright

      public static int lookright
    • lookleft

      public static int lookleft
  • Constructor Details

    • FlyThroughRender

      public FlyThroughRender(com.jogamp.opengl.awt.GLCanvas kCanvas, VolumeTriPlanarInterface kParent, com.jogamp.opengl.util.Animator kAnimator, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB, WildMagic.LibFoundation.Mathematics.Vector3f kTranslate)
      Construct the FlyThroughRenderer.
      Parameters:
      kParent - parent user-interface and frame.
      kAnimator - animator used to display the canvas.
      kVolumeImageA - volume data and textures for ModelImage A.
      kVolumeImageB - volume data and textures for ModelImage B.
  • Method Details

    • main

      public static FlyThroughRender main(com.jogamp.opengl.awt.GLCanvas kCanvas, VolumeTriPlanarInterface kParent, VolumeImage kVolumeImageA, VolumeImage kVolumeImageB, WildMagic.LibFoundation.Mathematics.Vector3f kTranslate, boolean displayInSeparateFrame)
    • addSurface

      public void addSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kSurface, WildMagic.LibFoundation.Mathematics.Vector3f kCenter)
      Add the fly-through surface.
      Parameters:
      kSurface - the TriMesh surface to fly through.
    • autoRun

      public void autoRun()
      Description copied from interface: FlyThroughRenderInterface
      Causes the FlyPathBehavior to fly down the current path from start to finish and back again.
      Specified by:
      autoRun in interface FlyThroughRenderInterface
    • display

      public void display(com.jogamp.opengl.GLAutoDrawable arg0)
      Specified by:
      display in interface com.jogamp.opengl.GLEventListener
    • doPseudoColor

      public void doPseudoColor(boolean bOn)
      Turn curvature-based color map on/off.
      Parameters:
      bOn - turns curvature-based color map on when true and off when false.
    • getBranchState

      public Object getBranchState()
      Specified by:
      getBranchState in interface FlyThroughRenderInterface
      Returns:
      the current BranchState from the FlyPatheBehavior class.
    • getCameraDirection

      public WildMagic.LibFoundation.Mathematics.Vector3f getCameraDirection()
      Return the camera direction vector.
      Returns:
      camera direction vector.
    • getCameraUp

      public WildMagic.LibFoundation.Mathematics.Vector3f getCameraUp()
      Return the camera up vector.
      Returns:
      camera up vector.
    • getCanvas

      public Canvas getCanvas()
      Specified by:
      getCanvas in interface FlyThroughRenderInterface
      Returns:
      the Canvas from the Fly-through renderer.
    • getHeight

      public int getHeight()
      Specified by:
      getHeight in interface FlyThroughRenderInterface
      Returns:
      the frame height.
    • getPositionScaled

      public WildMagic.LibFoundation.Mathematics.Vector3f getPositionScaled(WildMagic.LibFoundation.Mathematics.Vector3f kPoint)
      Scaled coordinates for the current position along the path for viewing.
      Parameters:
      Point - in normalized path coordinates.
      Returns:
      Point3f A new instance created which contains the path position coordinates, scaled to match the TriMesh in JPanelSurface.
    • getPositionUnScaled

      public WildMagic.LibFoundation.Mathematics.Vector3f getPositionUnScaled(WildMagic.LibFoundation.Mathematics.Vector3f kPoint)
      Scaled coordinates for the current position along the path for viewing.
      Parameters:
      The - path position coordinates, scaled to match the TriMesh.
      Returns:
      Point in normalized path coordinates.
    • getWidth

      public int getWidth()
      Specified by:
      getWidth in interface FlyThroughRenderInterface
      Returns:
      the frame width.
    • init

      public void init(com.jogamp.opengl.GLAutoDrawable arg0)
      Specified by:
      init in interface com.jogamp.opengl.GLEventListener
    • keyPressed

      public void keyPressed(KeyEvent e)
      Description copied from class: GPURenderBase
      Part of the KeyListener interface.
      Specified by:
      keyPressed in interface KeyListener
      Overrides:
      keyPressed in class GPURenderBase
      Parameters:
      e - the key event.
    • makeMove

      public void makeMove(String cmd)
      Description copied from interface: FlyThroughRenderInterface
      Passes move command from the JPanelFlythruMove to the FlyPathBehavior class.
      Specified by:
      makeMove in interface FlyThroughRenderInterface
      Parameters:
      cmd - move command.
    • mouseDragged

      public void mouseDragged(MouseEvent event)
      Specified by:
      mouseDragged in interface MouseMotionListener
      Overrides:
      mouseDragged in class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
      Overrides:
      mousePressed in class GPURenderBase
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
      Overrides:
      mouseReleased in class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
    • mouseWheelMoved

      public void mouseWheelMoved(MouseWheelEvent event)
      Mouse wheel event invoked from the middle mouse button roller. Rolling forward to track the fly-thru path in forward direction. Rolling backward to track the fly-thru path in backward direction.
      Specified by:
      mouseWheelMoved in interface MouseWheelListener
      Overrides:
      mouseWheelMoved in class WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
      Parameters:
      event - mouse middle mouse roller event.
    • setCurrentState

      public void setCurrentState(Object _state)
      Description copied from interface: FlyThroughRenderInterface
      Set the BranchState in the FlyPathBehavior.
      Specified by:
      setCurrentState in interface FlyThroughRenderInterface
      Parameters:
      _state -
    • setupRender

      public void setupRender(ModelImage kImage, FlyThroughRender.SetupOptions kOptions)
      Setup flythru renderer.
      Parameters:
      kOptions - setup options reference.
      _kImage - original model image reference.
    • setupRenderControl

      public void setupRenderControl(JPanelVirtualEndoscopySetup_WM _control)
      Set the JPanelVirtualEndoscopySetup user-interface.
      Parameters:
      _control - the JPanelVirtualEndoscopySetup user-interface.
    • update

      public void update()
      Update the representation of the current viewpoint in the Volume Tri-Planar renderer.
    • updateLighting

      public void updateLighting(WildMagic.LibGraphics.Rendering.Light[] akGLights)
      Description copied from class: GPURenderBase
      Called from JPanelLight. Updates the lighting parameters.
      Overrides:
      updateLighting in class GPURenderBase
      Parameters:
      akGLights - the set of GeneralLight objects.
    • viewChanged

      public void viewChanged(FlyPathBehavior_WM behavior, int iEvent)
      Description copied from interface: FlyPathBehavior_WM.Callback
      ViewChanged callback for flythrough renderers.
      Specified by:
      viewChanged in interface FlyPathBehavior_WM.Callback
      Parameters:
      behavior - reference to this MjFlyPathBehavior in which the view changed.
      iEvent - Bitmask identifies the event(s) which caused the view to change. Bitmask created from OR of EVENT_* defintions.
    • createAnnotatePoint

      private void createAnnotatePoint(WildMagic.LibFoundation.Mathematics.Vector3f kPosition)
      Create a new Annotation point at the position specified.
      Parameters:
      kPosition - position of new annotation point.
    • createBranchConnectGeometryScaled

      private WildMagic.LibGraphics.SceneGraph.Polyline createBranchConnectGeometryScaled(int iBranch)
      Get the geometry to be used for rendering the connection of the specified branch to its parent branch.
      Parameters:
      iBranch - Index which identifies the branch.
      Returns:
      Polyline instance that can be attached to a scene-graph Node for rendering
    • createBranchPathGeometryScaled

      private WildMagic.LibGraphics.SceneGraph.Polyline createBranchPathGeometryScaled(int iBranch)
      Get the geometry to be used for rendering the path of the specified branch.
      Parameters:
      iBranch - Index which identifies the branch.
      Returns:
      Polyline instance that can be attached to a scene-graph Node for rendering

      The coordinates are scaled to match the TriMesh in JPanelSurface.

    • CreateScene

      private void CreateScene()
      Called by the init() function. Creates and initialized the scene-graph.
      Parameters:
      arg0 - the GLCanvas
    • Render

      private void Render()
      Render the scene-graph.
    • resizeImage

      private ModelImage resizeImage(ModelImage kInput)
    • updateCamera

      private void updateCamera()
      Update the camera location and view direction. Called from mouse dragged. Implements "inside looking out" object rotation.
    • Move

      protected void Move()
      Description copied from class: GPURenderBase
      Updates the camera and displayed objects for rendering.
      Overrides:
      Move in class GPURenderBase
    • Pick

      protected void Pick()
      Picking support for adding Annotation points to the scene.
    • resetRenderBranchConnect

      protected void resetRenderBranchConnect()
      Called any time a change has been made to a new branch so that the connection between the branch and its parent can be rendered.
    • resetRenderBranchPath

      protected void resetRenderBranchPath()
      Called any time the position along the current curve changes and the color of the curve needs to change to show what has been visited.