Class VBOBufferLoaderForArrays
- java.lang.Object
-
- org.jzy3d.plot3d.primitives.vbo.drawable.loaders.VBOBufferLoader
-
- org.jzy3d.plot3d.primitives.vbo.drawable.loaders.VBOBufferLoaderForArrays
-
- All Implemented Interfaces:
IGLLoader<DrawableVBO2>
public class VBOBufferLoaderForArrays extends VBOBufferLoader implements IGLLoader<DrawableVBO2>
A utility class to build buffers to feed aDrawableVBO2
. Reading VBO javadoc may be helpful as well Not all parameters are mandatory, so we depict the effect of providing or not some of them.Points
This holds the x,y,z coordinates and is mandatory.Colors
The loader can be given- A non null colormap with null colors array
- A non null color array with null colormap
- None of the above, in that case, the color will uniform to the whole drawable
- If both colormap and colors are given, an exception is thrown.
Normals
Normals allow processing light. There are four modesNormalMode.REPEATED
lead to autonomous processing of normals where each polygon get a single normal processed for the whole geometry (but the normal is repeated for each point).NormalMode.SHARED
lead to autonomous processing of normals where each point get a normal processed as the average normal of all the polygons it belongs to.- A normal array can be provided externally to rely on other algorithms.
- If neither
Normal.NormalMode
neither a normal array are provided, no normal is will be buffered in the VBO.
DrawableVBO2.setComputeNormals(boolean)
to false. In that case, the result looks like :Elements
Elements are optional and are used to avoid repeating intput points. In that case, geometries are defined by the indices and the point they refer to.- Author:
- Martin Pernollet
-
-
Field Summary
Fields Modifier and Type Field Description protected float[]
coloring
protected IColorMap
colormap
protected boolean
debug
protected int[]
elements
protected int[][]
elementsIndices
protected int[]
elementsLength
protected int[]
elementsStarts
protected static org.apache.logging.log4j.Logger
log
protected Normal.NormalMode
normalMode
protected float[]
normals
protected int
pointDimensions
protected float[]
points
protected int
verticesPerGeometry
-
Fields inherited from class org.jzy3d.plot3d.primitives.vbo.drawable.loaders.VBOBufferLoader
verifyUniquePoints
-
-
Constructor Summary
Constructors Constructor Description VBOBufferLoaderForArrays(float[] points, int pointDimensions, int[][] elementIndices, IColorMap colormap, float[] coloring, float[] normals)
VBOBufferLoaderForArrays(float[] points, int pointDimensions, int[][] elementIndices, IColorMap colormap, float[] coloring, Normal.NormalMode normalMode)
VBOBufferLoaderForArrays(float[] points, int pointDimensions, int[] elementStarts, int[] elementLength, IColorMap colormap, float[] coloring, Normal.NormalMode normalMode)
VBOBufferLoaderForArrays(float[] points, int pointDimensions, int[] geometries, int verticesPerGeometry, IColorMap colormap, float[] coloring, Normal.NormalMode normalMode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
load(IPainter painter, DrawableVBO2 drawable)
protected void
verifyColorBufferSizeConsistency(DrawableVBO2 drawable, FloatBuffer verticeBuffer, FloatBuffer colorBuffer)
-
Methods inherited from class org.jzy3d.plot3d.primitives.vbo.drawable.loaders.VBOBufferLoader
computeAverageNormalsForEachVertex, computeSharedNormals, computeSharedNormals, computeSimpleNormals, isVerifyUniquePoints, loadColorBufferFromArray, loadColorBufferFromColormap, loadNormalsFromArray, loadVerticesFromArray, setVerifyUniquePoints, verifyDoublons
-
-
-
-
Field Detail
-
log
protected static org.apache.logging.log4j.Logger log
-
points
protected float[] points
-
pointDimensions
protected int pointDimensions
-
normals
protected float[] normals
-
elements
protected int[] elements
-
verticesPerGeometry
protected int verticesPerGeometry
-
elementsStarts
protected int[] elementsStarts
-
elementsLength
protected int[] elementsLength
-
elementsIndices
protected int[][] elementsIndices
-
colormap
protected IColorMap colormap
-
coloring
protected float[] coloring
-
normalMode
protected Normal.NormalMode normalMode
-
debug
protected boolean debug
-
-
Constructor Detail
-
VBOBufferLoaderForArrays
public VBOBufferLoaderForArrays(float[] points, int pointDimensions, int[] elementStarts, int[] elementLength, IColorMap colormap, float[] coloring, Normal.NormalMode normalMode)
-
VBOBufferLoaderForArrays
public VBOBufferLoaderForArrays(float[] points, int pointDimensions, int[][] elementIndices, IColorMap colormap, float[] coloring, Normal.NormalMode normalMode)
-
VBOBufferLoaderForArrays
public VBOBufferLoaderForArrays(float[] points, int pointDimensions, int[][] elementIndices, IColorMap colormap, float[] coloring, float[] normals)
-
VBOBufferLoaderForArrays
public VBOBufferLoaderForArrays(float[] points, int pointDimensions, int[] geometries, int verticesPerGeometry, IColorMap colormap, float[] coloring, Normal.NormalMode normalMode)
-
-
Method Detail
-
load
public void load(IPainter painter, DrawableVBO2 drawable) throws Exception
- Specified by:
load
in interfaceIGLLoader<DrawableVBO2>
- Throws:
Exception
-
verifyColorBufferSizeConsistency
protected void verifyColorBufferSizeConsistency(DrawableVBO2 drawable, FloatBuffer verticeBuffer, FloatBuffer colorBuffer)
-
-