Commit b3f25c75 authored by Dirk Wilden's avatar Dirk Wilden

updated drawMode in optionsWidget

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3069 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 59d684bf
...@@ -54,8 +54,6 @@ std::vector< QString > drawModeToList(unsigned int _drawMode) { ...@@ -54,8 +54,6 @@ std::vector< QString > drawModeToList(unsigned int _drawMode) {
draw_modes.push_back("DEFAULT"); draw_modes.push_back("DEFAULT");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_SMOOTH_SHADED) if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_SMOOTH_SHADED)
draw_modes.push_back("SOLID_SMOOTH_SHADED"); draw_modes.push_back("SOLID_SMOOTH_SHADED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED)
draw_modes.push_back("SOLID_FACES_COLORED");
if ( _drawMode & ACG::SceneGraph::DrawModes::HIDDENLINE) if ( _drawMode & ACG::SceneGraph::DrawModes::HIDDENLINE)
draw_modes.push_back("HIDDENLINE"); draw_modes.push_back("HIDDENLINE");
if ( _drawMode & ACG::SceneGraph::DrawModes::WIREFRAME) if ( _drawMode & ACG::SceneGraph::DrawModes::WIREFRAME)
...@@ -72,8 +70,10 @@ std::vector< QString > drawModeToList(unsigned int _drawMode) { ...@@ -72,8 +70,10 @@ std::vector< QString > drawModeToList(unsigned int _drawMode) {
draw_modes.push_back("SOLID_PHONG_SHADED"); draw_modes.push_back("SOLID_PHONG_SHADED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED) if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED)
draw_modes.push_back("SOLID_POINTS_COLORED"); draw_modes.push_back("SOLID_POINTS_COLORED");
if ( _drawMode & ACG::SceneGraph::DrawModes::POINTS_COLORED) if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED)
draw_modes.push_back("SOLID_ENV_MAPPED"); draw_modes.push_back("SOLID_FACES_COLORED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED)
draw_modes.push_back("SOLID_POINTS_COLORED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED) if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED)
draw_modes.push_back("SOLID_ENV_MAPPED"); draw_modes.push_back("SOLID_ENV_MAPPED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_TEXTURED) if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_TEXTURED)
...@@ -88,7 +88,15 @@ std::vector< QString > drawModeToList(unsigned int _drawMode) { ...@@ -88,7 +88,15 @@ std::vector< QString > drawModeToList(unsigned int _drawMode) {
draw_modes.push_back("SOLID_3DTEXTURED"); draw_modes.push_back("SOLID_3DTEXTURED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_3DTEXTURED_SHADED) if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_3DTEXTURED_SHADED)
draw_modes.push_back("SOLID_3DTEXTURED_SHADED"); draw_modes.push_back("SOLID_3DTEXTURED_SHADED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED_FLAT_SHADED)
draw_modes.push_back("SOLID_FACES_COLORED_FLAT_SHADED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE)
draw_modes.push_back("SOLID_2DTEXTURED_FACE");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE_SHADED)
draw_modes.push_back("SOLID_2DTEXTURED_FACE_SHADED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_SHADER)
draw_modes.push_back("SOLID_SHADER");
return draw_modes; return draw_modes;
} }
...@@ -102,8 +110,6 @@ unsigned int ListToDrawMode ( std::vector< QString > _draw_modes ) { ...@@ -102,8 +110,6 @@ unsigned int ListToDrawMode ( std::vector< QString > _draw_modes ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::DEFAULT; drawMode = drawMode | ACG::SceneGraph::DrawModes::DEFAULT;
} else if( _draw_modes[i] == "SOLID_SMOOTH_SHADED" ) { } else if( _draw_modes[i] == "SOLID_SMOOTH_SHADED" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_SMOOTH_SHADED; drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_SMOOTH_SHADED;
} else if( _draw_modes[i] == "SOLID_FACES_COLORED" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED;
} else if( _draw_modes[i] == "HIDDENLINE" ) { } else if( _draw_modes[i] == "HIDDENLINE" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::HIDDENLINE; drawMode = drawMode | ACG::SceneGraph::DrawModes::HIDDENLINE;
} else if( _draw_modes[i] == "WIREFRAME" ) { } else if( _draw_modes[i] == "WIREFRAME" ) {
...@@ -120,6 +126,8 @@ unsigned int ListToDrawMode ( std::vector< QString > _draw_modes ) { ...@@ -120,6 +126,8 @@ unsigned int ListToDrawMode ( std::vector< QString > _draw_modes ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_PHONG_SHADED; drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_PHONG_SHADED;
} else if( _draw_modes[i] == "SOLID_POINTS_COLORED" ) { } else if( _draw_modes[i] == "SOLID_POINTS_COLORED" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED; drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED;
} else if( _draw_modes[i] == "SOLID_FACES_COLORED" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED;
} else if( _draw_modes[i] == "SOLID_ENV_MAPPED" ) { } else if( _draw_modes[i] == "SOLID_ENV_MAPPED" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED; drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED;
} else if( _draw_modes[i] == "SOLID_TEXTURED" ) { } else if( _draw_modes[i] == "SOLID_TEXTURED" ) {
...@@ -134,6 +142,14 @@ unsigned int ListToDrawMode ( std::vector< QString > _draw_modes ) { ...@@ -134,6 +142,14 @@ unsigned int ListToDrawMode ( std::vector< QString > _draw_modes ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_3DTEXTURED; drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_3DTEXTURED;
} else if( _draw_modes[i] == "SOLID_3DTEXTURED_SHADED" ) { } else if( _draw_modes[i] == "SOLID_3DTEXTURED_SHADED" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_3DTEXTURED_SHADED; drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_3DTEXTURED_SHADED;
} else if( _draw_modes[i] == "SOLID_FACES_COLORED_FLAT_SHADED" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED_FLAT_SHADED;
} else if( _draw_modes[i] == "SOLID_2DTEXTURED_FACE" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE;
} else if( _draw_modes[i] == "SOLID_2DTEXTURED_FACE_SHADED" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE_SHADED;
} else if( _draw_modes[i] == "SOLID_SHADER" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_SHADER;
} }
} }
...@@ -141,5 +157,115 @@ unsigned int ListToDrawMode ( std::vector< QString > _draw_modes ) { ...@@ -141,5 +157,115 @@ unsigned int ListToDrawMode ( std::vector< QString > _draw_modes ) {
} }
/// Convert a vector of DrawMode-Descriptions to a draw mode
unsigned int descriptionsToDrawMode ( std::vector< QString > _draw_modes ) {
unsigned int drawMode = 0 ;
for ( uint i = 0 ; i < _draw_modes.size() ; ++i ) {
if( _draw_modes[i] == "Default" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::DEFAULT;
} else if( _draw_modes[i] == "Solid (smooth shaded)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_SMOOTH_SHADED;
} else if( _draw_modes[i] == "Hiddenline" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::HIDDENLINE;
} else if( _draw_modes[i] == "Wireframe" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::WIREFRAME;
} else if( _draw_modes[i] == "Points" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::POINTS;
} else if( _draw_modes[i] == "Points (colored)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::POINTS_COLORED;
} else if( _draw_modes[i] == "Points (shaded)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::POINTS_SHADED;
} else if( _draw_modes[i] == "Solid (flat shaded)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_FLAT_SHADED;
} else if( _draw_modes[i] == "Solid (Phong shaded)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_PHONG_SHADED;
} else if( _draw_modes[i] == "Solid (colored per-face)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED;
} else if( _draw_modes[i] == "Solid (colored per-vertex)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED;
} else if( _draw_modes[i] == "Solid (environment mapped)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED;
} else if( _draw_modes[i] == "Solid (textured)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_TEXTURED;
} else if( _draw_modes[i] == "Solid (textured, shaded)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_TEXTURED_SHADED;
} else if( _draw_modes[i] == "Solid (scalar field)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_1DTEXTURED;
} else if( _draw_modes[i] == "Solid (scalar field, shaded)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_1DTEXTURED_SHADED;
} else if( _draw_modes[i] == "Solid (3D textured)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_3DTEXTURED;
} else if( _draw_modes[i] == "Solid (3D textured, shaded)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_3DTEXTURED_SHADED;
} else if( _draw_modes[i] == "Solid (colored per-face, flat shaded)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED_FLAT_SHADED;
} else if( _draw_modes[i] == "Solid (face textured)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE;
} else if( _draw_modes[i] == "Solid (face textured, shaded)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE_SHADED;
} else if( _draw_modes[i] == "Shader controlled" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_SHADER;
}
}
return drawMode;
}
/// Convert a drawmode to a vector of QStrings
std::vector< QString > drawModeToDescriptions(unsigned int _drawMode) {
std::vector< QString > draw_modes;
if ( _drawMode & ACG::SceneGraph::DrawModes::DEFAULT )
draw_modes.push_back("Default");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_SMOOTH_SHADED)
draw_modes.push_back("Solid (smooth shaded)");
if ( _drawMode & ACG::SceneGraph::DrawModes::HIDDENLINE)
draw_modes.push_back("Hiddenline");
if ( _drawMode & ACG::SceneGraph::DrawModes::WIREFRAME)
draw_modes.push_back("Wireframe");
if ( _drawMode & ACG::SceneGraph::DrawModes::POINTS)
draw_modes.push_back("Points");
if ( _drawMode & ACG::SceneGraph::DrawModes::POINTS_COLORED)
draw_modes.push_back("Points (colored)");
if ( _drawMode & ACG::SceneGraph::DrawModes::POINTS_SHADED)
draw_modes.push_back("Points (shaded)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_FLAT_SHADED)
draw_modes.push_back("Solid (flat shaded)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_PHONG_SHADED)
draw_modes.push_back("Solid (Phong shaded)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED)
draw_modes.push_back("Solid (colored per-vertex)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED)
draw_modes.push_back("Solid (colored per-face)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED)
draw_modes.push_back("Solid (colored per-vertex)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED)
draw_modes.push_back("Solid (environment mapped)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_TEXTURED)
draw_modes.push_back("Solid (textured)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_TEXTURED_SHADED)
draw_modes.push_back("Solid (textured, shaded)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_1DTEXTURED)
draw_modes.push_back("Solid (scalar field)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_1DTEXTURED_SHADED)
draw_modes.push_back("Solid (scalar field, shaded)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_3DTEXTURED)
draw_modes.push_back("Solid (3D textured)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_3DTEXTURED_SHADED)
draw_modes.push_back("Solid (3D textured, shaded)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED_FLAT_SHADED)
draw_modes.push_back("Solid (colored per-face, flat shaded)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE)
draw_modes.push_back("Solid (face textured)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE_SHADED)
draw_modes.push_back("Solid (face textured, shaded)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_SHADER)
draw_modes.push_back("Shader controlled");
return draw_modes;
}
//============================================================================= //=============================================================================
...@@ -64,6 +64,11 @@ std::vector< QString > drawModeToList(unsigned int _drawMode); ...@@ -64,6 +64,11 @@ std::vector< QString > drawModeToList(unsigned int _drawMode);
DLLEXPORT DLLEXPORT
unsigned int ListToDrawMode ( std::vector< QString > _draw_modes ); unsigned int ListToDrawMode ( std::vector< QString > _draw_modes );
DLLEXPORT
std::vector< QString > drawModeToDescriptions(unsigned int _drawMode);
DLLEXPORT
unsigned int descriptionsToDrawMode ( std::vector< QString > _draw_modes );
//============================================================================= //=============================================================================
#endif // DRAWMODECONVERTER_HH defined #endif // DRAWMODECONVERTER_HH defined
......
...@@ -113,20 +113,20 @@ enum {OPT_HELP , OPT_STEREO, OPT_BATCH ,OPT_CONSOLE_LOG , OPT_DEBUGGING, OPT_FUL ...@@ -113,20 +113,20 @@ enum {OPT_HELP , OPT_STEREO, OPT_BATCH ,OPT_CONSOLE_LOG , OPT_DEBUGGING, OPT_FUL
OPT_REMOTE}; OPT_REMOTE};
CSimpleOpt::SOption g_rgOptions[] = { CSimpleOpt::SOption g_rgOptions[] = {
{ OPT_DEBUGGING , "--debug" , SO_NONE }, { OPT_DEBUGGING , (char*) "--debug" , SO_NONE },
{ OPT_HELP , "-?" , SO_NONE }, { OPT_HELP , (char*) "-?" , SO_NONE },
{ OPT_HELP , "--help" , SO_NONE }, { OPT_HELP , (char*) "--help" , SO_NONE },
{ OPT_HELP , "-h" , SO_NONE }, { OPT_HELP , (char*) "-h" , SO_NONE },
{ OPT_STEREO , "--enable-stereo" , SO_NONE }, { OPT_STEREO , (char*) "--enable-stereo" , SO_NONE },
{ OPT_BATCH , "-b" , SO_NONE }, { OPT_BATCH , (char*) "-b" , SO_NONE },
{ OPT_CONSOLE_LOG , "-c" , SO_NONE }, { OPT_CONSOLE_LOG , (char*) "-c" , SO_NONE },
{ OPT_CONSOLE_LOG , "--log-to-console" , SO_NONE }, { OPT_CONSOLE_LOG , (char*) "--log-to-console" , SO_NONE },
{ OPT_FULLSCREEN , "-f" , SO_NONE }, { OPT_FULLSCREEN , (char*) "-f" , SO_NONE },
{ OPT_HIDDDEN_LOGGER , "-l" , SO_NONE }, { OPT_HIDDDEN_LOGGER , (char*) "-l" , SO_NONE },
{ OPT_NOSPLASH , "--no-splash" , SO_NONE }, { OPT_NOSPLASH , (char*) "--no-splash" , SO_NONE },
{ OPT_HIDDDEN_TOOLBOX , "-t" , SO_NONE }, { OPT_HIDDDEN_TOOLBOX , (char*) "-t" , SO_NONE },
{ OPT_LOAD_POLYMESHES , "-p" , SO_NONE }, { OPT_LOAD_POLYMESHES , (char*) "-p" , SO_NONE },
{ OPT_REMOTE , "--remote-control" , SO_NONE }, { OPT_REMOTE , (char*) "--remote-control" , SO_NONE },
SO_END_OF_OPTIONS // END SO_END_OF_OPTIONS // END
}; };
......
...@@ -53,13 +53,17 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB ...@@ -53,13 +53,17 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
uint mode = 2; uint mode = 2;
for (uint i=1; i < 22; i++) { for (uint i=1; i < 22; i++) {
std::vector< QString > dm = drawModeToList( mode ); std::vector< QString > dm = drawModeToDescriptions( mode );
if ( !dm.empty() && dm[0].trimmed() != ""){ if ( !dm.empty() && dm[0].trimmed() != ""){
QListWidgetItem* item = new QListWidgetItem(dm[0]); QListWidgetItem* item = new QListWidgetItem(dm[0]);
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
item->setCheckState(Qt::Unchecked);
// if (OpenFlipper::Options::standardDrawMode() )
// item->setCheckState(Qt::Checked);
// else
item->setCheckState(Qt::Unchecked);
availDrawModes->addItem( item ); availDrawModes->addItem( item );
} }
...@@ -330,7 +334,7 @@ void OptionsWidget::slotApply() { ...@@ -330,7 +334,7 @@ void OptionsWidget::slotApply() {
if (availDrawModes->item(i)->checkState() == Qt::Checked) if (availDrawModes->item(i)->checkState() == Qt::Checked)
mode.push_back( availDrawModes->item(i)->text() ); mode.push_back( availDrawModes->item(i)->text() );
OpenFlipper::Options::standardDrawMode( ListToDrawMode(mode) ); OpenFlipper::Options::standardDrawMode( descriptionsToDrawMode(mode) );
emit applyOptions(); emit applyOptions();
emit saveOptions(); emit saveOptions();
......
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