Class VBOBufferLoader

    • Field Detail

      • verifyUniquePoints

        protected boolean verifyUniquePoints
    • Constructor Detail

      • VBOBufferLoader

        public VBOBufferLoader()
    • Method Detail

      • loadColorBufferFromArray

        public FloatBuffer loadColorBufferFromArray​(float[] coloring)
      • loadNormalsFromArray

        public FloatBuffer loadNormalsFromArray​(float[] points)
      • computeSimpleNormals

        public FloatBuffer computeSimpleNormals​(int pointsPerGeometry,
                                                List<Coord3d> verticeList)
        Parameters:
        pointsPerGeometry - 3 for a triangle, N for a triangle fan, 4 for a pseudo quad (a 2 triangle fans)
        verticeList -
        Returns:
      • computeSharedNormals

        public FloatBuffer computeSharedNormals​(int[] geometries,
                                                int geometrySize,
                                                List<Coord3d> verticeList)
        When vertices are shared between multiple triangles, each vertex normal should be unique and computed out of all triangles that share the vertex. Indeed, the normal being computed out of the cross product of the three points of a face, a vertex belonging to N faces will have N normals. Getting a single normal for a shared vertex is made by computing the mean of all the normals that may computed for this vertex, which has the great advantage of smoothing the light reflection on the border (in other word this avoid the impression of a sharp border). In case a sharp border effect is desired for this object, then one should not share vertices between faces. To do so, do NOT provide any geometry array as DrawableVBO2 constructor.
        Parameters:
        geometries -
        geometrySize -
        verticeList -
        Returns:
      • computeSharedNormals

        public FloatBuffer computeSharedNormals​(int[][] elementIndices,
                                                List<Coord3d> verticeList)
        Parameters:
        elementIndices -
        verticeList -
        Returns:
      • computeAverageNormalsForEachVertex

        protected FloatBuffer computeAverageNormalsForEachVertex​(List<Coord3d> verticeList,
                                                                 com.google.common.collect.ArrayListMultimap<Coord3d,​Coord3d> vertexNormals)
        Process the average normal of a points, based on parameter vertexNormals point is mapped to a list of all normals of all polygons that have this point in common.
        Parameters:
        verticeList - provides all vertices in the order they are sent to the GPU via the VBO. List is easier to process than the original vertex FloatBuffer
        vertexNormals - associate coordinate -> .
        Returns:
        a buffer of average normals of the same size of the vertex buffer that was built at the same time than verticeList
      • verifyDoublons

        protected void verifyDoublons​(List<Coord3d> verticeList)
      • isVerifyUniquePoints

        public boolean isVerifyUniquePoints()
      • setVerifyUniquePoints

        public void setVerifyUniquePoints​(boolean verifyUniquePoints)