Browse Source

Refactor TextureMappingMode::draw()

master
Krisjanis Rijnieks 9 years ago
parent
commit
2504d5fdaa
  1. 22
      src/Application/Modes/TextureMappingMode.cpp

22
src/Application/Modes/TextureMappingMode.cpp

@ -24,10 +24,12 @@ void TextureMappingMode::update(Application * app){
} }
void TextureMappingMode::draw(Application * app){ void TextureMappingMode::draw(Application * app){
ofPushMatrix();
ofTranslate(_canvasTranslate.x, _canvasTranslate.y); // TODO: Make state classes out of the following anti-code.
if(_drawMode == 0){ // Semi-transparent surfaces on front if(_drawMode == 0){ // Semi-transparent surfaces on front
ofPushMatrix();
ofTranslate(_canvasTranslate.x, _canvasTranslate.y);
drawTexture(app); drawTexture(app);
ofPopMatrix(); ofPopMatrix();
@ -35,10 +37,9 @@ void TextureMappingMode::draw(Application * app){
ofSetColor(255, 255, 255, 150); ofSetColor(255, 255, 255, 150);
app->getSurfaceManager()->draw(); app->getSurfaceManager()->draw();
ofPopStyle(); ofPopStyle();
}else if(_drawMode == 1){ // Opaque surfaces on front
ofPushMatrix(); ofPushMatrix();
ofTranslate(_canvasTranslate.x, _canvasTranslate.y); ofTranslate(_canvasTranslate.x, _canvasTranslate.y);
}else if(_drawMode == 1){ // Opaque surfaces on front
drawTexture(app); drawTexture(app);
ofPopMatrix(); ofPopMatrix();
@ -46,30 +47,25 @@ void TextureMappingMode::draw(Application * app){
ofSetColor(255, 255, 255, 255); ofSetColor(255, 255, 255, 255);
app->getSurfaceManager()->draw(); app->getSurfaceManager()->draw();
ofPopStyle(); ofPopStyle();
ofPushMatrix();
ofTranslate(_canvasTranslate.x, _canvasTranslate.y);
}else if(_drawMode == 2){ // Draw texture only }else if(_drawMode == 2){ // Draw texture only
ofPushMatrix();
ofTranslate(_canvasTranslate.x, _canvasTranslate.y); ofTranslate(_canvasTranslate.x, _canvasTranslate.y);
drawTexture(app); drawTexture(app);
ofPopMatrix();
}else{ }else{
_drawMode = 0; _drawMode = 0;
} }
if(_drawMode != 2){ if(_drawMode != 2){
ofPopMatrix();
Gui::instance()->getSurfaceHighlightWidget().setSurfaceManager(app->getSurfaceManager()); Gui::instance()->getSurfaceHighlightWidget().setSurfaceManager(app->getSurfaceManager());
Gui::instance()->getSurfaceHighlightWidget().draw(); Gui::instance()->getSurfaceHighlightWidget().draw();
ofPushMatrix();
ofTranslate(_canvasTranslate.x, _canvasTranslate.y);
} }
ofPushMatrix();
ofTranslate(_canvasTranslate.x, _canvasTranslate.y);
Gui::instance()->getTextureHighlightWidget().setSurfaceManager(app->getSurfaceManager()); Gui::instance()->getTextureHighlightWidget().setSurfaceManager(app->getSurfaceManager());
Gui::instance()->getTextureHighlightWidget().draw(); Gui::instance()->getTextureHighlightWidget().draw();
Gui::instance()->getTextureEditorWidget().draw(); Gui::instance()->getTextureEditorWidget().draw();
ofPopMatrix(); ofPopMatrix();
} }

Loading…
Cancel
Save