diff --git a/src/Surfaces/GridWarpSurface.cpp b/src/Surfaces/GridWarpSurface.cpp index c08f6ea..6fc089f 100644 --- a/src/Surfaces/GridWarpSurface.cpp +++ b/src/Surfaces/GridWarpSurface.cpp @@ -125,6 +125,24 @@ void GridWarpSurface::setVertices(vector v){ } } +void GridWarpSurface::setTexCoord(int index, ofVec2f t){ + if(index >= mesh.getVertices().size()){ + ofLog() << "Texture coordinate with this index does not exist: " << index << endl; + return; + } + mesh.setTexCoord(index, t); +} + +void GridWarpSurface::setTexCoords(vector t){ + if(t.size() != mesh.getVertices().size()){ + throw runtime_error("Wrong number of texture coordinates"); + } + for(int i = 0; i < 3; ++i){ + mesh.setTexCoord(i, t[i]); + } +} + + vector & GridWarpSurface::getVertices(){ return mesh.getVertices(); } diff --git a/src/Surfaces/GridWarpSurface.h b/src/Surfaces/GridWarpSurface.h index f0ac613..2b58012 100644 --- a/src/Surfaces/GridWarpSurface.h +++ b/src/Surfaces/GridWarpSurface.h @@ -24,6 +24,8 @@ class GridWarpSurface : public BaseSurface { void setVertex(int index, ofVec2f p); void setVertices(vector v); + void setTexCoord(int index, ofVec2f t); + void setTexCoords(vector t); vector & getVertices(); vector & getTexCoords();