From 47c2333f24fd040f24db7c4436353b4e13cdc02a Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sat, 10 May 2014 14:07:51 +0200 Subject: [PATCH] Add getTexCoord method to triangle surface --- src/ofxTriangleSurface.cpp | 11 ++++++++++- src/ofxTriangleSurface.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ofxTriangleSurface.cpp b/src/ofxTriangleSurface.cpp index 62a8853..b5a7ef3 100644 --- a/src/ofxTriangleSurface.cpp +++ b/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); } \ No newline at end of file diff --git a/src/ofxTriangleSurface.h b/src/ofxTriangleSurface.h index e956a68..5c0198a 100644 --- a/src/ofxTriangleSurface.h +++ b/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 \ No newline at end of file