Commit 713e6b48 authored by Jan Möbius's avatar Jan Möbius

moved face orientation setting to viewer properties

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4514 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 6ee0066b
......@@ -48,7 +48,8 @@ namespace Viewer {
actionMode_(Viewer::PickingMode),
lastActionMode_(Viewer::PickingMode),
snapshotName_("snap.png"),
snapshotCounter_(0)
snapshotCounter_(0),
CCWFront_(true)
{
}
......
......@@ -135,6 +135,24 @@ namespace Viewer {
/** @} */
//===========================================================================
/** @name Rendering Settings
* @{ */
//===========================================================================
public slots:
/** true if counter clockwise orientation should be used to define front facing orientation.
*/
bool isCCWFront(){ return CCWFront_; };
/// Set counter clockwise orientation as front
void ccwFront() { CCWFront_ = true; emit updated(); };
/// Set clockwise orientation as front
void cwFront() { CCWFront_ = false; emit updated(); };
private:
bool CCWFront_;
/** @} */
signals:
/** \brief This signal is emitted when the configuration has been changed
......
......@@ -158,7 +158,6 @@ glViewer::glViewer( QWidget* _parent,
availDrawModes_ = ACG::SceneGraph::DrawModes::NONE;
normalsMode_ = DONT_TOUCH_NORMALS;
faceOrientation_ = CCW_ORIENTATION;
projectionMode_ = PERSPECTIVE_PROJECTION;
backFaceCulling_ = false;
twoSidedLighting_ = true;
......@@ -480,27 +479,6 @@ void glViewer::updateActionMode(Viewer::ActionMode _am)
//-----------------------------------------------------------------------------
void glViewer::faceOrientation(FaceOrientation _ori)
{
makeCurrent();
switch ( faceOrientation_ = _ori ) {
case CCW_ORIENTATION:
glFrontFace( GL_CCW );
break;
case CW_ORIENTATION:
glFrontFace( GL_CW );
break;
}
updateGL();
}
//-----------------------------------------------------------------------------
void glViewer::backFaceCulling(bool _b)
{
emit functionMenuUpdate();
......@@ -930,10 +908,11 @@ void glViewer::initializeGL()
projectionMode( projectionMode_ );
normalsMode( normalsMode_ );
faceOrientation( faceOrientation_ );
backFaceCulling( backFaceCulling_ );
twoSidedLighting( twoSidedLighting_ );
// Update all settings which would require a redraw
slotPropertiesUpdated();
// light sources
light_matrix_.identity();
......@@ -1082,9 +1061,10 @@ void glViewer::paintGL()
normalsMode( normalsMode_ );
faceOrientation( faceOrientation_ );
backFaceCulling( backFaceCulling_ );
slotPropertiesUpdated();
// light sources
update_lights();
......@@ -2160,6 +2140,15 @@ void glViewer::slotAnimation()
void glViewer::slotPropertiesUpdated() {
std::cerr << "glViewer : Properties updated" << std::endl;
makeCurrent();
if (properties_.isCCWFront() )
glFrontFace( GL_CCW );
else
glFrontFace( GL_CW );
updateGL();
}
......
......@@ -249,18 +249,6 @@ public:
public:
/// orientation of the faces
enum FaceOrientation {
CCW_ORIENTATION, //!< counter clockwise (default)
CW_ORIENTATION //!< clockwise
};
/// set face orientation (used for back face culling, backFaceCulling())
void faceOrientation(FaceOrientation);
/// get face orientation
FaceOrientation faceOrientation() const { return faceOrientation_; }
public slots:
/// set backface culling on/off
void backFaceCulling( bool _b );
......@@ -626,7 +614,6 @@ private:
// modi
NormalsMode normalsMode_;
FaceOrientation faceOrientation_;
ProjectionMode projectionMode_;
bool backFaceCulling_;
bool twoSidedLighting_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment