/** @file * Original ReactPhysics3D C++ library by Daniel Chappuis This code is re-licensed with permission from ReactPhysics3D author. * @author Daniel CHAPPUIS * @author Edouard DUPIN * @copyright 2010-2016, Daniel Chappuis * @copyright 2017, Edouard DUPIN * @license MPL v2.0 (see license file) */ #pragma once #include #include namespace ephysics { class Triangle { public: vec3 value[3]; vec3 operator[] (sizet 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: etk::Vector this.vertices; //!< Vertice list etk::Vector this.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( etk::Vector vertices, etk::Vector triangles); /** * @brief Get the number of vertices * @return Number of vertices */ sizet getNbVertices() ; /** * @brief Get the number of triangle * @return Number of triangles */ sizet getNbTriangles() ; /** * @brief Get The table of the vertices * @return reference on the vertices */ etk::Vector getVertices() ; /** * @brief Get The table of the triangle indice * @return reference on the triangle indice */ etk::Vector getIndices() ; /** * @brief Get a triangle at the specific ID * @return Buffer of 3 points */ ephysics::Triangle getTriangle(int id) ; }; }