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

40 lines
1.2 KiB
C++

/** @file
* Original ReactPhysics3D C++ library by Daniel Chappuis <http://www.reactphysics3d.com/> 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)
*/
#include <ephysics/collision/TriangleVertexArray.hpp>
ephysics::TriangleVertexArray::TriangleVertexArray( Vector<Vector3f> vertices, Vector<int> triangles):
this.vertices(vertices),
this.triangles(triangles) {
}
long ephysics::TriangleVertexArray::getNbVertices() {
return this.vertices.size();
}
long ephysics::TriangleVertexArray::getNbTriangles() {
return this.triangles.size()/3;
}
Vector<Vector3f> ephysics::TriangleVertexArray::getVertices() {
return this.vertices;
}
Vector<int> ephysics::TriangleVertexArray::getIndices() {
return this.triangles;
}
ephysics::Triangle ephysics::TriangleVertexArray::getTriangle(int id) {
ephysics::Triangle out;
out[0] = this.vertices[this.triangles[id*3]];
out[1] = this.vertices[this.triangles[id*3+1]];
out[2] = this.vertices[this.triangles[id*3+2]];
return out;
}