Maven module :un.engine : engine-opengl :
Class : un.engine.opengl.mesh.MeshUtilities
Extends/Implements : -
Subclasses : -

Mesh utilities.
author  Johann Sorel


Variables : OPACITY_SORTER
Functions : normalize, sumToOne, triangulate, triangulate, convertToTriangleAdjency, createAdjencyIndex



Sort meshes based on there material opacity.
This sorter accept normal nodes to be included.
public Sorter OPACITY_SORTER



Normalize all tuples in given vbo.
param  vbo
public void normalize (VBO vbo)


Ensure the sum of each tuple is 1.
param  vbo
public void sumToOne (VBO vbo)


NOTE : this is not a perfect algorithm,
it search the smallest dimension and and triangulate in 2D.
NOTE : we could improve it by projection on the most efficient plane.
param  vertices
return  triangles indices int[n][3]
public int[][] triangulate (Tuple[] vertices)

public int[][] triangulate (Tuple[] vertices, Tuple projectionPlanNormal)


Convert index buffer to triangle adjency.
param  shell
public void convertToTriangleAdjency (Shell shell)


Build adjency triangle index from triangle indexes.
param  ib
return
public Buffer createAdjencyIndex (Buffer ib)