Browse Source

Add SurfaceHighlightWidget

master
Krisjanis Rijnieks 9 years ago
parent
commit
33eaa43f34
  1. 44
      src/Application/SurfaceHighlightWidget.cpp
  2. 30
      src/Application/SurfaceHighlightWidget.h

44
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

30
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
Loading…
Cancel
Save