|
@ -7,59 +7,22 @@ SurfaceManagerGui::SurfaceManagerGui(){ |
|
|
surfaceManager = 0; |
|
|
surfaceManager = 0; |
|
|
guiMode = GuiMode::NONE; |
|
|
guiMode = GuiMode::NONE; |
|
|
bDrag = false; |
|
|
bDrag = false; |
|
|
registerMouseEvents(); |
|
|
|
|
|
ofHideCursor(); |
|
|
ofHideCursor(); |
|
|
_cmdManager = 0; |
|
|
_cmdManager = 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
SurfaceManagerGui::~SurfaceManagerGui(){ |
|
|
SurfaceManagerGui::~SurfaceManagerGui(){ |
|
|
unregisterMouseEvents(); |
|
|
|
|
|
surfaceManager = 0; |
|
|
surfaceManager = 0; |
|
|
_cmdManager = 0; |
|
|
_cmdManager = 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void SurfaceManagerGui::registerMouseEvents(){ |
|
|
|
|
|
//ofAddListener(ofEvents().mousePressed, this,
|
|
|
|
|
|
// &SurfaceManagerGui::mousePressed);
|
|
|
|
|
|
//ofAddListener(ofEvents().mouseReleased, this,
|
|
|
|
|
|
// &SurfaceManagerGui::mouseReleased);
|
|
|
|
|
|
//ofAddListener(ofEvents().mouseDragged, this,
|
|
|
|
|
|
// &SurfaceManagerGui::mouseDragged);
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SurfaceManagerGui::unregisterMouseEvents(){ |
|
|
|
|
|
//ofRemoveListener(ofEvents().mousePressed, this,
|
|
|
|
|
|
// &SurfaceManagerGui::mousePressed);
|
|
|
|
|
|
//ofRemoveListener(ofEvents().mouseReleased, this,
|
|
|
|
|
|
// &SurfaceManagerGui::mouseReleased);
|
|
|
|
|
|
//ofRemoveListener(ofEvents().mouseDragged, this,
|
|
|
|
|
|
// &SurfaceManagerGui::mouseDragged);
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SurfaceManagerGui::draw(){ |
|
|
void SurfaceManagerGui::draw(){ |
|
|
if(surfaceManager == 0){ |
|
|
if(surfaceManager == 0){ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(guiMode == GuiMode::TEXTURE_MAPPING){ |
|
|
if(guiMode == GuiMode::TEXTURE_MAPPING){ |
|
|
// draw the texture of the selected surface
|
|
|
// TODO: Remove this if else together with the SurfaceManagerGui
|
|
|
/*
|
|
|
|
|
|
if(surfaceManager->getSelectedSurface() != 0){ |
|
|
|
|
|
bool normalizedTexCoords = ofGetUsingNormalizedTexCoords(); |
|
|
|
|
|
ofEnableNormalizedTexCoords(); |
|
|
|
|
|
|
|
|
|
|
|
// Reset default color to white first
|
|
|
|
|
|
ofSetColor(255, 255, 255, 255); |
|
|
|
|
|
surfaceManager->getSelectedSurface()->drawTexture(ofVec2f(0, 0)); |
|
|
|
|
|
|
|
|
|
|
|
if(!normalizedTexCoords){ |
|
|
|
|
|
ofDisableNormalizedTexCoords(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
// draw texture editing GUI on top
|
|
|
|
|
|
//textureEditor.draw();
|
|
|
|
|
|
}else if(guiMode == GuiMode::PROJECTION_MAPPING){ |
|
|
}else if(guiMode == GuiMode::PROJECTION_MAPPING){ |
|
|
projectionEditor.draw(); |
|
|
projectionEditor.draw(); |
|
|
}else if(guiMode == GuiMode::SOURCE_SELECTION){ |
|
|
}else if(guiMode == GuiMode::SOURCE_SELECTION){ |
|
@ -285,7 +248,6 @@ SourcesEditor * SurfaceManagerGui::getSourcesEditor(){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void SurfaceManagerGui::onVertexChanged(int & i){ |
|
|
void SurfaceManagerGui::onVertexChanged(int & i){ |
|
|
//cout << "VERTEX CHANGED: " << vertex.x << ", " << vertex.y << endl;
|
|
|
|
|
|
bool isDragged = projectionEditor.getJoints()->at(i)->isDragged(); |
|
|
bool isDragged = projectionEditor.getJoints()->at(i)->isDragged(); |
|
|
projectionEditor.createJoints(); |
|
|
projectionEditor.createJoints(); |
|
|
projectionEditor.getJoints()->at(i)->select(); |
|
|
projectionEditor.getJoints()->at(i)->select(); |
|
@ -297,7 +259,6 @@ void SurfaceManagerGui::onVertexChanged(int & i){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void SurfaceManagerGui::onVerticesChanged(vector<ofVec3f> & vertices){ |
|
|
void SurfaceManagerGui::onVerticesChanged(vector<ofVec3f> & vertices){ |
|
|
//cout << "VERTICES CHANGED: " << vertices.size() << endl;
|
|
|
|
|
|
projectionEditor.createJoints(); |
|
|
projectionEditor.createJoints(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|