Class VBOBufferLoaderForArrays

  • All Implemented Interfaces:
    IGLLoader<DrawableVBO2>

    public class VBOBufferLoaderForArrays
    extends VBOBufferLoader
    implements IGLLoader<DrawableVBO2>
    A utility class to build buffers to feed a DrawableVBO2. 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 modes
    • NormalMode.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.
    We observed that when no normal is processed at all, there is still an automatic processing of light "somehow". This is enabled by toggling 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 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
      • coloring

        protected float[] coloring
      • 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)