Class Texture3D
java.lang.Object
org.jzy3d.plot3d.primitives.Drawable
org.jzy3d.plot3d.primitives.volume.Texture3D
- All Implemented Interfaces:
IMultiColorable, IGLBindedResource, IGLRenderer, ISortableDraw
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Bufferprotected ColormapTextureprotected booleanprotected ColorMapperprotected floatprotected floatprotected booleanprotected GLSLProgramprotected int[]protected DrawableVBOprotected intThe GL texture ID.Fields inherited from class Drawable
bbox, boundingBoxColor, boundingBoxDisplayed, displayed, hasListeners, legend, legendDisplayed, listeners, spaceTransformer, transform, transformBefore -
Constructor Summary
ConstructorsConstructorDescriptionTexture3D(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
Modifier and TypeMethodDescriptionvoidapplyGeometryTransform(Transform transform) voidvoiddispose()Performs all required operation to cleanup the Drawable.voidCall OpenGL2 routines for rendering the object.Get the colormapper.booleanReturn true if mount(...) has been called at least one timeprotected static float[]invertMatrix(float[] m, float[] out) Invert a column major 4x4 matrix.voidMount resources to gl contextprotected static float[]multMatrixVec(float[] m, float[] vec, float[] out) Multiply a column major 4x4 matrix with a 4 component vector.protected static float[]normalizeVec3(float[] vec) Normalize the 3 first components of a vector, or set them to 0 if the vector is null.voidsetColorMapper(ColorMapper mapper) Set the colormapper that will be used by the Drawable, instead of using precomputed colors.voidvoidvoidsetTextureData(IPainter painter, Buffer buffer, int[] shape) Load buffer data into memoryvoidvoidprotected booleanvalidateTexID(IPainter painter, boolean throwException) Methods inherited from class 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 Details
-
texID
protected int texIDThe GL texture ID. -
buffer
-
shape
protected int[] shape -
mounted
protected boolean mounted -
shapeVBO
-
shaderProgram
-
min
protected float min -
max
protected float max -
colormapTexure
-
disposed
protected boolean disposed -
mapper
-
-
Constructor Details
-
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
A convenient constructor that configure the volume value range based on the colormapper settings.Texture3D(Buffer, int[], float, float, ColorMapper, BoundingBox3d)
-
-
Method Details
-
mount
Description copied from interface:IGLBindedResourceMount resources to gl context- Specified by:
mountin interfaceIGLBindedResource
-
setMin
-
setMax
-
hasMountedOnce
public boolean hasMountedOnce()Description copied from interface:IGLBindedResourceReturn true if mount(...) has been called at least one time- Specified by:
hasMountedOncein interfaceIGLBindedResource
-
bind
-
unbind
-
setTextureData
-
validateTexID
-
draw
-
applyGeometryTransform
- Specified by:
applyGeometryTransformin classDrawable
-
dispose
-
updateBounds
public void updateBounds()- Specified by:
updateBoundsin classDrawable
-
getColorMapper
Description copied from interface:IMultiColorableGet the colormapper.- Specified by:
getColorMapperin interfaceIMultiColorable
-
setColorMapper
Description copied from interface:IMultiColorableSet the colormapper that will be used by the Drawable, instead of using precomputed colors.- Specified by:
setColorMapperin interfaceIMultiColorable
-
invertMatrix
protected static float[] invertMatrix(float[] m, float[] out) Invert a column major 4x4 matrix.- Returns:
- the inverted matrix stored in out, or null if the matrix is not invertible.
-
multMatrixVec
protected static float[] multMatrixVec(float[] m, float[] vec, float[] out) Multiply a column major 4x4 matrix with a 4 component vector. Components of out are written one after the other, hence using the same array for vec and out makes the computation of a component use the components already computed. -
normalizeVec3
protected static float[] normalizeVec3(float[] vec) Normalize the 3 first components of a vector, or set them to 0 if the vector is null.
-