jege_proto/src/org/atriaSoft/ephysics/collision/TriangleVertexArray.java

62 lines
1.7 KiB
Java

package org.atriaSoft.ephysics.collision;
class Triangle {
public:
Vector3f value[3];
Vector3f operator[] (long id) {
return value[id];
}
};
/**
* This class is used to describe the vertices and faces of a triangular mesh.
* A TriangleVertexArray represents a continuous array of vertices and indexes
* of a triangular mesh. When you create a TriangleVertexArray, no data is copied
* into the array. It only stores pointer to the data. The purpose is to allow
* the user to share vertices data between the physics engine and the rendering
* part. Therefore, make sure that the data pointed by a TriangleVertexArray
* remains valid during the TriangleVertexArray life.
*/
class TriangleVertexArray {
protected:
Vector<Vector3f> vertices; //!< Vertice list
Vector<int> triangles; //!< List of triangle (3 pos for each triangle)
public:
/**
* @brief Constructor
* @param[in] vertices List Of all vertices
* @param[in] triangles List of all linked points
*/
TriangleVertexArray( Vector<Vector3f> vertices,
Vector<int> triangles);
/**
* @brief Get the number of vertices
* @return Number of vertices
*/
long getNbVertices() ;
/**
* @brief Get the number of triangle
* @return Number of triangles
*/
long getNbTriangles() ;
/**
* @brief Get The table of the vertices
* @return reference on the vertices
*/
Vector<Vector3f> getVertices() ;
/**
* @brief Get The table of the triangle indice
* @return reference on the triangle indice
*/
Vector<int> getIndices() ;
/**
* @brief Get a triangle at the specific ID
* @return Buffer of 3 points
*/
ephysics::Triangle getTriangle(int id) ;
};
}