2 changed files with 74 additions and 0 deletions
@ -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
|
@ -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
|
Loading…
Reference in new issue