Package mgui.interfaces.shapes.volume
Class Volume3DRenderer
java.lang.Object
mgui.interfaces.shapes.volume.Volume3DRenderer
- All Implemented Interfaces:
InterfaceGraphicListener
,Camera3DListener
- Direct Known Subclasses:
Volume4DRenderer
public class Volume3DRenderer extends java.lang.Object implements Camera3DListener, InterfaceGraphicListener
Class providing functions for rendering a Volume3DInt object. Based on the rendering
code provided in the VolRend package: org.jscience.medicine.volumetric
- Author:
- Andrew Reid
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Volume3DRenderer.Mode
-
Field Summary
Fields Modifier and Type Field Description float
alpha
double
angleBuffer
protected org.jogamp.java3d.Switch
axisSwitch
static int
BACK
static int
FRONT
protected org.jogamp.vecmath.Vector3d
prevAngle
protected Camera3D
ref_camera
Volume3DRenderer.Mode
render_mode
boolean
setAlpha
protected Volume3DTexture
texture3D
protected Volume3DInt
volume3D
protected java.util.HashMap<InterfaceGraphic2D,org.jogamp.java3d.Shape3D>
window_nodes
static int
X_AXIS
static int
X_AXIS_NEG
static int
X_AXIS_POS
static int
Y_AXIS
static int
Y_AXIS_NEG
static int
Y_AXIS_POS
static int
Z_AXIS
static int
Z_AXIS_NEG
static int
Z_AXIS_POS
-
Constructor Summary
Constructors Constructor Description Volume3DRenderer(Volume3DInt volume)
-
Method Summary
Modifier and Type Method Description void
cameraAngleChanged(CameraEvent e)
void
cameraChanged(CameraEvent e)
void
destroySectionNode(InterfaceGraphic2D window)
protected org.jogamp.vecmath.Point3f[]
flipCoords(org.jogamp.vecmath.Point3f[] coords)
protected void
flipCoords(org.jogamp.vecmath.TexCoord3f[] coords)
protected org.jogamp.vecmath.Vector3d
getAxisVector(int axis)
org.jogamp.java3d.ImageComponent3D
getImageComponent()
protected int
getNearestAxis(org.jogamp.vecmath.Vector3d v)
protected int
getNearestAxis(org.jogamp.vecmath.Vector3d v, boolean buffer)
org.jogamp.java3d.BranchGroup
getNode()
Sets and returns a Java3D node from the given Grid3D and Texture3Dorg.jogamp.java3d.BranchGroup
getNodeAsSections()
Sets and returns a Java3D node from the given Grid3D and Texture3D; node will be a set of 2D planes corresponding the the section sets in the volume's parent setorg.jogamp.java3d.BranchGroup
getNodeAsVolume()
Sets and returns a Java3D node from the given Grid3D and Texture3D; node will be a 3D volume textureprotected org.jogamp.java3d.OrderedGroup
getOrderedGroup()
static java.util.ArrayList<java.lang.String>
getRenderModes()
java.lang.String
getRenderModeStr()
protected org.jogamp.vecmath.TexCoord3f
getTexCoord(org.jogamp.vecmath.Point3f p)
protected org.jogamp.vecmath.TexCoord3f[]
getTexCoords(java.lang.String coords, int i, float scale)
protected org.jogamp.vecmath.TexCoord3f[]
getTexCoordsForPoly(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes)
protected org.jogamp.vecmath.TexCoord3f[]
getTexCoordsX(int i, float scale)
protected org.jogamp.vecmath.TexCoord3f[]
getTexCoordsY(int i, float scale)
protected org.jogamp.vecmath.TexCoord3f[]
getTexCoordsZ(int i, float scale)
Volume3DTexture
getTexture()
void
graphicSourceChanged(GraphicEvent e)
void
graphicUpdated(GraphicEvent e)
Respond to a window event; this is relevant for section nodesprotected int
powerOfTwo(int value)
void
removeSectionNode(InterfaceGraphic2D window)
protected void
setAxis()
void
setReferenceCamera(Camera3D camera)
Sets the reference camera for this renderer.void
setRenderMode(java.lang.String mode)
void
setRenderMode(Volume3DRenderer.Mode mode)
void
setTexture()
Sets the current texture for this volume's renderer.void
setTexture(ColourMap cmap)
Sets a Volume3DTexture object from the current grid and data sizeboolean
setTransparency(float alpha)
void
setVolume(Volume3DInt volume)
void
updateAxis()
Update the rendering planes of this renderer, based on the reference camera angle, if one is set.void
updateAxis(Camera3D camera)
Update the rendering planes of this renderer, based on the current camera anglevoid
updateData(Grid3D grid, int index, int x, int y, int width, int height)
protected void
updateSection(InterfaceGraphic2D window)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
volume3D
-
texture3D
-
axisSwitch
protected org.jogamp.java3d.Switch axisSwitch -
prevAngle
protected org.jogamp.vecmath.Vector3d prevAngle -
angleBuffer
public double angleBuffer -
setAlpha
public boolean setAlpha -
alpha
public float alpha -
window_nodes
-
ref_camera
-
render_mode
-
X_AXIS
public static final int X_AXIS- See Also:
- Constant Field Values
-
Y_AXIS
public static final int Y_AXIS- See Also:
- Constant Field Values
-
Z_AXIS
public static final int Z_AXIS- See Also:
- Constant Field Values
-
FRONT
public static final int FRONT- See Also:
- Constant Field Values
-
BACK
public static final int BACK- See Also:
- Constant Field Values
-
X_AXIS_POS
public static final int X_AXIS_POS- See Also:
- Constant Field Values
-
Y_AXIS_POS
public static final int Y_AXIS_POS- See Also:
- Constant Field Values
-
Z_AXIS_POS
public static final int Z_AXIS_POS- See Also:
- Constant Field Values
-
X_AXIS_NEG
public static final int X_AXIS_NEG- See Also:
- Constant Field Values
-
Y_AXIS_NEG
public static final int Y_AXIS_NEG- See Also:
- Constant Field Values
-
Z_AXIS_NEG
public static final int Z_AXIS_NEG- See Also:
- Constant Field Values
-
-
Constructor Details
-
Volume3DRenderer
-
-
Method Details
-
getRenderModes
public static java.util.ArrayList<java.lang.String> getRenderModes() -
setReferenceCamera
Sets the reference camera for this renderer. This is used to determine the correct axis for 3D volume rendering.- Parameters:
camera
-
-
setRenderMode
public void setRenderMode(java.lang.String mode) -
setRenderMode
-
getRenderModeStr
public java.lang.String getRenderModeStr() -
setTexture
public void setTexture()Sets the current texture for this volume's renderer. -
setTexture
Sets a Volume3DTexture object from the current grid and data size -
getTexture
-
getImageComponent
public org.jogamp.java3d.ImageComponent3D getImageComponent() -
setVolume
-
setTransparency
public boolean setTransparency(float alpha) -
getNode
public org.jogamp.java3d.BranchGroup getNode()Sets and returns a Java3D node from the given Grid3D and Texture3D- Returns:
- Shape3D node
-
getNodeAsVolume
public org.jogamp.java3d.BranchGroup getNodeAsVolume()Sets and returns a Java3D node from the given Grid3D and Texture3D; node will be a 3D volume texture- Returns:
- Shape3D node
-
getNodeAsSections
public org.jogamp.java3d.BranchGroup getNodeAsSections()Sets and returns a Java3D node from the given Grid3D and Texture3D; node will be a set of 2D planes corresponding the the section sets in the volume's parent set- Returns:
- Shape3D node
-
updateSection
-
getTexCoordsForPoly
protected org.jogamp.vecmath.TexCoord3f[] getTexCoordsForPoly(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes) -
graphicUpdated
Respond to a window event; this is relevant for section nodes- Specified by:
graphicUpdated
in interfaceInterfaceGraphicListener
- Parameters:
g
-
-
destroySectionNode
-
removeSectionNode
-
getTexCoord
protected org.jogamp.vecmath.TexCoord3f getTexCoord(org.jogamp.vecmath.Point3f p) -
flipCoords
protected org.jogamp.vecmath.Point3f[] flipCoords(org.jogamp.vecmath.Point3f[] coords) -
flipCoords
protected void flipCoords(org.jogamp.vecmath.TexCoord3f[] coords) -
getOrderedGroup
protected org.jogamp.java3d.OrderedGroup getOrderedGroup() -
getTexCoords
protected org.jogamp.vecmath.TexCoord3f[] getTexCoords(java.lang.String coords, int i, float scale) -
getTexCoordsX
protected org.jogamp.vecmath.TexCoord3f[] getTexCoordsX(int i, float scale) -
getTexCoordsY
protected org.jogamp.vecmath.TexCoord3f[] getTexCoordsY(int i, float scale) -
getTexCoordsZ
protected org.jogamp.vecmath.TexCoord3f[] getTexCoordsZ(int i, float scale) -
cameraChanged
- Specified by:
cameraChanged
in interfaceCamera3DListener
-
cameraAngleChanged
- Specified by:
cameraAngleChanged
in interfaceCamera3DListener
-
updateAxis
public void updateAxis()Update the rendering planes of this renderer, based on the reference camera angle, if one is set. -
updateAxis
Update the rendering planes of this renderer, based on the current camera angle -
getAxisVector
protected org.jogamp.vecmath.Vector3d getAxisVector(int axis) -
getNearestAxis
protected int getNearestAxis(org.jogamp.vecmath.Vector3d v) -
getNearestAxis
protected int getNearestAxis(org.jogamp.vecmath.Vector3d v, boolean buffer) -
setAxis
protected void setAxis() -
powerOfTwo
protected int powerOfTwo(int value) -
updateData
-
graphicSourceChanged
- Specified by:
graphicSourceChanged
in interfaceInterfaceGraphicListener
-