Browse Source

Add getTexCoord method to triangle surface

master
Krisjanis Rijnieks 11 years ago
parent
commit
47c2333f24
  1. 11
      src/ofxTriangleSurface.cpp
  2. 1
      src/ofxTriangleSurface.h

11
src/ofxTriangleSurface.cpp

@ -76,9 +76,18 @@ ofVec2f ofxTriangleSurface::getVertex(int index)
{
if ( index > 2 ) {
ofLog() << "Vertex with this index does not exist: " << index << endl;
throw std::runtime_error("Index out of bounds.");
throw std::runtime_error("Vertex index out of bounds.");
}
ofVec3f vert = mesh.getVertex(index);
return ofVec2f(vert.x, vert.y);
}
ofVec2f ofxTriangleSurface::getTexCoord(int index)
{
if (index > 2) {
throw std::runtime_error("Texture coordinate index out of bounds.");
}
return mesh.getTexCoord(index);
}

1
src/ofxTriangleSurface.h

@ -16,6 +16,7 @@ public:
void setVertex( int index, ofVec2f p );
void setTexCoord( int index, ofVec2f t );
ofVec2f getVertex(int index);
ofVec2f getTexCoord(int index);
};
#endif
Loading…
Cancel
Save