Browse Source

Avoid using ofMesh::haveVertsChanged() since it is protected in the current oF master

master
Krisjanis Rijnieks 7 years ago
parent
commit
8b09ec24cc
  1. 17
      src/Surfaces/QuadSurface.cpp
  2. 1
      src/Surfaces/QuadSurface.h

17
src/Surfaces/QuadSurface.cpp

@ -52,6 +52,9 @@ void QuadSurface::setup(Vec3 p1, Vec3 p2, Vec3 p3, Vec3 p4,
mesh.addTexCoord(t2.toOf());
mesh.addTexCoord(t3.toOf());
mesh.addTexCoord(t4.toOf());
_meshCache = mesh;
calculateHomography();
}
void QuadSurface::draw(){
@ -64,8 +67,20 @@ void QuadSurface::draw(){
}
if(_perspectiveWarping){
if(mesh.haveVertsChanged() || mesh.haveTexCoordsChanged()){
bool meshChanged = false;
if(
mesh.getVertices()[0] != _meshCache.getVertices()[0] ||
mesh.getVertices()[1] != _meshCache.getVertices()[1] ||
mesh.getVertices()[2] != _meshCache.getVertices()[2] ||
mesh.getVertices()[3] != _meshCache.getVertices()[3])
{
meshChanged = true;
}
if(meshChanged){
calculateHomography();
_meshCache = mesh;
}
ofRectangle box = getMeshBoundingBox();

1
src/Surfaces/QuadSurface.h

@ -46,6 +46,7 @@ class QuadSurface : public BaseSurface {
void calculateHomography();
float _matrix[16];
bool _perspectiveWarping;
ofMesh _meshCache;
};
} // namespace piMapper

Loading…
Cancel
Save