diff --git a/src/Application/SurfaceHighlightWidget.cpp b/src/Application/SurfaceHighlightWidget.cpp new file mode 100644 index 0000000..be8f781 --- /dev/null +++ b/src/Application/SurfaceHighlightWidget.cpp @@ -0,0 +1,44 @@ +#include "SurfaceHighlightWidget.h" + +namespace ofx { +namespace piMapper { + +SurfaceHighlightWidget::SurfaceHighlightWidget(){ + _sm = 0; +} + +void SurfaceHighlightWidget::draw(){ + if(_sm == 0){ + return; + } + + if(_sm->getSelectedSurface() == 0){ + return; + } + + if(_sm->getSelectedSurface()->getType() == SurfaceType::QUAD_SURFACE && + ((QuadSurface *)_sm->getSelectedSurface())->getPerspectiveWarping()){ + ofPolyline line = _sm->getSelectedSurface()->getHitArea(); + ofPushStyle(); + ofSetLineWidth(1); + ofSetColor(255, 255, 255, 255); + line.draw(); + ofPopStyle(); + }else if(_sm->getSelectedSurface()->getType() == SurfaceType::GRID_WARP_SURFACE){ + _sm->getSelectedSurface()->getMesh().drawWireframe(); + }else{ + ofPolyline p; + for(unsigned int i = 0; + i < _sm->getSelectedSurface()->getMesh().getVertices().size(); + ++i){ + + p.addVertex(ofPoint( + _sm->getSelectedSurface()->getMesh().getVertices()[i])); + } + p.close(); + p.draw(); + } +} + +} // namespace piMapper +} // namespace ofx diff --git a/src/Application/SurfaceHighlightWidget.h b/src/Application/SurfaceHighlightWidget.h new file mode 100644 index 0000000..ef48062 --- /dev/null +++ b/src/Application/SurfaceHighlightWidget.h @@ -0,0 +1,30 @@ +#pragma once + +#include "GuiBaseWidget.h" +#include "SurfaceManager.h" + +namespace ofx { +namespace piMapper { + +class SurfaceHighlightWidget : public GuiBaseWidget { + public: + SurfaceHighlightWidget(); + + void setup(){} + void update(){} + void draw(); + + void onMousePressed(ofMouseEventArgs & args){} + void onMouseReleased(ofMouseEventArgs & args){} + void onMouseDragged(ofMouseEventArgs & args){} + + bool inside(float x, float y){ return false; } + + void setSurfaceManager(SurfaceManager * sm){ _sm = sm; } + + private: + SurfaceManager * _sm; +}; + +} // namespace piMapper +} // namespace ofx \ No newline at end of file