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 classVolume3DRenderer.Mode -
Field Summary
Fields Modifier and Type Field Description floatalphadoubleangleBufferprotected org.jogamp.java3d.SwitchaxisSwitchstatic intBACKstatic intFRONTprotected org.jogamp.vecmath.Vector3dprevAngleprotected Camera3Dref_cameraVolume3DRenderer.Moderender_modebooleansetAlphaprotected Volume3DTexturetexture3Dprotected Volume3DIntvolume3Dprotected java.util.HashMap<InterfaceGraphic2D,org.jogamp.java3d.Shape3D>window_nodesstatic intX_AXISstatic intX_AXIS_NEGstatic intX_AXIS_POSstatic intY_AXISstatic intY_AXIS_NEGstatic intY_AXIS_POSstatic intZ_AXISstatic intZ_AXIS_NEGstatic intZ_AXIS_POS -
Constructor Summary
Constructors Constructor Description Volume3DRenderer(Volume3DInt volume) -
Method Summary
Modifier and Type Method Description voidcameraAngleChanged(CameraEvent e)voidcameraChanged(CameraEvent e)voiddestroySectionNode(InterfaceGraphic2D window)protected org.jogamp.vecmath.Point3f[]flipCoords(org.jogamp.vecmath.Point3f[] coords)protected voidflipCoords(org.jogamp.vecmath.TexCoord3f[] coords)protected org.jogamp.vecmath.Vector3dgetAxisVector(int axis)org.jogamp.java3d.ImageComponent3DgetImageComponent()protected intgetNearestAxis(org.jogamp.vecmath.Vector3d v)protected intgetNearestAxis(org.jogamp.vecmath.Vector3d v, boolean buffer)org.jogamp.java3d.BranchGroupgetNode()Sets and returns a Java3D node from the given Grid3D and Texture3Dorg.jogamp.java3d.BranchGroupgetNodeAsSections()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.BranchGroupgetNodeAsVolume()Sets and returns a Java3D node from the given Grid3D and Texture3D; node will be a 3D volume textureprotected org.jogamp.java3d.OrderedGroupgetOrderedGroup()static java.util.ArrayList<java.lang.String>getRenderModes()java.lang.StringgetRenderModeStr()protected org.jogamp.vecmath.TexCoord3fgetTexCoord(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)Volume3DTexturegetTexture()voidgraphicSourceChanged(GraphicEvent e)voidgraphicUpdated(GraphicEvent e)Respond to a window event; this is relevant for section nodesprotected intpowerOfTwo(int value)voidremoveSectionNode(InterfaceGraphic2D window)protected voidsetAxis()voidsetReferenceCamera(Camera3D camera)Sets the reference camera for this renderer.voidsetRenderMode(java.lang.String mode)voidsetRenderMode(Volume3DRenderer.Mode mode)voidsetTexture()Sets the current texture for this volume's renderer.voidsetTexture(ColourMap cmap)Sets a Volume3DTexture object from the current grid and data sizebooleansetTransparency(float alpha)voidsetVolume(Volume3DInt volume)voidupdateAxis()Update the rendering planes of this renderer, based on the reference camera angle, if one is set.voidupdateAxis(Camera3D camera)Update the rendering planes of this renderer, based on the current camera anglevoidupdateData(Grid3D grid, int index, int x, int y, int width, int height)protected voidupdateSection(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:
graphicUpdatedin 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:
cameraChangedin interfaceCamera3DListener
-
cameraAngleChanged
- Specified by:
cameraAngleChangedin 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:
graphicSourceChangedin interfaceInterfaceGraphicListener
-