Class Texture3D
- java.lang.Object
-
- org.jzy3d.plot3d.primitives.Drawable
-
- org.jzy3d.plot3d.primitives.volume.Texture3D
-
- All Implemented Interfaces:
IMultiColorable
,IGLBindedResource
,IGLRenderer
,ISortableDraw
public class Texture3D extends Drawable implements IGLBindedResource, IMultiColorable
-
-
Field Summary
Fields Modifier and Type Field Description protected Buffer
buffer
protected ColormapTexture
colormapTexure
protected boolean
disposed
protected ColorMapper
mapper
protected float
max
protected float
min
protected boolean
mounted
protected GLSLProgram
shaderProgram
protected int[]
shape
protected DrawableVBO
shapeVBO
protected int
texID
The GL texture ID.-
Fields inherited from class org.jzy3d.plot3d.primitives.Drawable
bbox, boundingBoxColor, boundingBoxDisplayed, displayed, hasListeners, legend, legendDisplayed, listeners, spaceTransformer, transform, transformBefore
-
-
Constructor Summary
Constructors Constructor Description Texture3D(Buffer buffer, int[] shape, float min, float max, ColorMapper mapper, BoundingBox3d bbox)
Instanciate a drawable volume.Texture3D(Buffer buffer, int[] shape, ColorMapper mapper, BoundingBox3d bbox)
A convenient constructor that configure the volume value range based on the colormapper settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyGeometryTransform(Transform transform)
void
bind(com.jogamp.opengl.GL gl)
void
dispose()
Performs all required operation to cleanup the Drawable.void
draw(IPainter painter)
Call OpenGL2 routines for rendering the object.ColorMapper
getColorMapper()
Get the colormapper.boolean
hasMountedOnce()
Return true if mount(...) has been called at least one timevoid
mount(IPainter painter)
Mount resources to gl contextvoid
setColorMapper(ColorMapper mapper)
Set the colormapper that will be used by the Drawable, instead of using precomputed colors.void
setMax(Number max)
void
setMin(Number min)
void
setTextureData(com.jogamp.opengl.GL gl, Buffer buffer, int[] shape)
Load buffer data into memoryvoid
unbind(com.jogamp.opengl.GL gl)
void
updateBounds()
protected boolean
validateTexID(com.jogamp.opengl.GL gl, boolean throwException)
-
Methods inherited from class org.jzy3d.plot3d.primitives.Drawable
addDrawableListener, asWireframeable, doDrawBoundsIfDisplayed, doTransform, fireDrawableChanged, fireDrawableChanged, getBarycentre, getBoundingBoxColor, getBounds, getDistance, getLegend, getLongestDistance, getShortestDistance, getSpaceTransformer, getTransform, getTransformBefore, hasLegend, isBoundingBoxDisplayed, isDisplayed, isLegendDisplayed, removeDrawableListener, setBoundingBoxColor, setBoundingBoxDisplayed, setDisplayed, setLegend, setLegendDisplayed, setSpaceTransformer, setTransform, setTransformBefore, toString, toString
-
-
-
-
Field Detail
-
texID
protected int texID
The GL texture ID.
-
buffer
protected Buffer buffer
-
shape
protected int[] shape
-
mounted
protected boolean mounted
-
shapeVBO
protected DrawableVBO shapeVBO
-
shaderProgram
protected GLSLProgram shaderProgram
-
min
protected float min
-
max
protected float max
-
colormapTexure
protected ColormapTexture colormapTexure
-
disposed
protected boolean disposed
-
mapper
protected ColorMapper mapper
-
-
Constructor Detail
-
Texture3D
public Texture3D(Buffer buffer, int[] shape, float min, float max, ColorMapper mapper, BoundingBox3d bbox)
Instanciate a drawable volume.- Parameters:
buffer
- provides (x,y,z,V) tuples where (x,y,z) are voxel index in the volume and V the value used for coloring voxelsshape
- a 3 element array indicating the number of voxels for each dimensionmin
- the minimum V value provided in the input buffer which must be set consistently with the colormappermax
- the maximum V value provided in the input buffer which must be set consistently with the colormappermapper
- the colormap handler that will apply a colormap to a value rangebbox
- the real world range of each axis, since the input buffer provide tuples with index and not coordinates
-
Texture3D
public Texture3D(Buffer buffer, int[] shape, ColorMapper mapper, BoundingBox3d bbox)
A convenient constructor that configure the volume value range based on the colormapper settings.Texture3D(Buffer, int[], float, float, ColorMapper, BoundingBox3d)
-
-
Method Detail
-
mount
public void mount(IPainter painter)
Description copied from interface:IGLBindedResource
Mount resources to gl context- Specified by:
mount
in interfaceIGLBindedResource
-
setMin
public void setMin(Number min)
-
setMax
public void setMax(Number max)
-
hasMountedOnce
public boolean hasMountedOnce()
Description copied from interface:IGLBindedResource
Return true if mount(...) has been called at least one time- Specified by:
hasMountedOnce
in interfaceIGLBindedResource
-
bind
public void bind(com.jogamp.opengl.GL gl) throws com.jogamp.opengl.GLException
- Throws:
com.jogamp.opengl.GLException
-
unbind
public void unbind(com.jogamp.opengl.GL gl)
-
setTextureData
public void setTextureData(com.jogamp.opengl.GL gl, Buffer buffer, int[] shape)
Load buffer data into memory- Parameters:
gl
-buffer
- texture datashape
- the dimensions of 3d texture.
-
validateTexID
protected boolean validateTexID(com.jogamp.opengl.GL gl, boolean throwException)
-
draw
public void draw(IPainter painter)
Description copied from class:Drawable
Call OpenGL2 routines for rendering the object.- Specified by:
draw
in interfaceIGLRenderer
- Specified by:
draw
in classDrawable
-
applyGeometryTransform
public void applyGeometryTransform(Transform transform)
- Specified by:
applyGeometryTransform
in classDrawable
-
dispose
public void dispose()
Description copied from class:Drawable
Performs all required operation to cleanup the Drawable.
-
updateBounds
public void updateBounds()
- Specified by:
updateBounds
in classDrawable
-
getColorMapper
public ColorMapper getColorMapper()
Description copied from interface:IMultiColorable
Get the colormapper.- Specified by:
getColorMapper
in interfaceIMultiColorable
-
setColorMapper
public void setColorMapper(ColorMapper mapper)
Description copied from interface:IMultiColorable
Set the colormapper that will be used by the Drawable, instead of using precomputed colors.- Specified by:
setColorMapper
in interfaceIMultiColorable
-
-