Commit 3ceba554 authored by Jan Möbius's avatar Jan Möbius
Browse files

Tobias new draw mode: points_colored / points/ colored shaded

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13459 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 419a8063
......@@ -82,24 +82,25 @@ DrawMode SOLID_SMOOTH_SHADED = ModeFlagSet(1) << 10;
DrawMode SOLID_PHONG_SHADED = ModeFlagSet(1) << 11;
DrawMode SOLID_FACES_COLORED = ModeFlagSet(1) << 12;
DrawMode SOLID_POINTS_COLORED = ModeFlagSet(1) << 13;
DrawMode SOLID_ENV_MAPPED = ModeFlagSet(1) << 14;
DrawMode SOLID_TEXTURED = ModeFlagSet(1) << 15;
DrawMode SOLID_TEXTURED_SHADED = ModeFlagSet(1) << 16;
DrawMode SOLID_1DTEXTURED = ModeFlagSet(1) << 17;
DrawMode SOLID_1DTEXTURED_SHADED = ModeFlagSet(1) << 18;
DrawMode SOLID_3DTEXTURED = ModeFlagSet(1) << 19;
DrawMode SOLID_3DTEXTURED_SHADED = ModeFlagSet(1) << 20;
DrawMode SOLID_FACES_COLORED_FLAT_SHADED = ModeFlagSet(1) << 21;
DrawMode SOLID_FACES_COLORED_SMOOTH_SHADED = ModeFlagSet(1) << 22;
DrawMode SOLID_2DTEXTURED_FACE = ModeFlagSet(1) << 23;
DrawMode SOLID_2DTEXTURED_FACE_SHADED = ModeFlagSet(1) << 24;
DrawMode SOLID_SHADER = ModeFlagSet(1) << 25;
DrawMode SOLID_SMOOTH_SHADED_FEATURES = ModeFlagSet(1) << 26;
DrawMode CELLS = ModeFlagSet(1) << 27;
DrawMode CELLS_COLORED = ModeFlagSet(1) << 28;
DrawMode HALFEDGES = ModeFlagSet(1) << 29;
DrawMode HALFEDGES_COLORED = ModeFlagSet(1) << 30;
DrawMode UNUSED = ModeFlagSet(1) << 31;
DrawMode SOLID_POINTS_COLORED_SHADED = ModeFlagSet(1) << 14;
DrawMode SOLID_ENV_MAPPED = ModeFlagSet(1) << 15;
DrawMode SOLID_TEXTURED = ModeFlagSet(1) << 16;
DrawMode SOLID_TEXTURED_SHADED = ModeFlagSet(1) << 17;
DrawMode SOLID_1DTEXTURED = ModeFlagSet(1) << 18;
DrawMode SOLID_1DTEXTURED_SHADED = ModeFlagSet(1) << 19;
DrawMode SOLID_3DTEXTURED = ModeFlagSet(1) << 20;
DrawMode SOLID_3DTEXTURED_SHADED = ModeFlagSet(1) << 21;
DrawMode SOLID_FACES_COLORED_FLAT_SHADED = ModeFlagSet(1) << 22;
DrawMode SOLID_FACES_COLORED_SMOOTH_SHADED = ModeFlagSet(1) << 23;
DrawMode SOLID_2DTEXTURED_FACE = ModeFlagSet(1) << 24;
DrawMode SOLID_2DTEXTURED_FACE_SHADED = ModeFlagSet(1) << 25;
DrawMode SOLID_SHADER = ModeFlagSet(1) << 26;
DrawMode SOLID_SMOOTH_SHADED_FEATURES = ModeFlagSet(1) << 27;
DrawMode CELLS = ModeFlagSet(1) << 28;
DrawMode CELLS_COLORED = ModeFlagSet(1) << 29;
DrawMode HALFEDGES = ModeFlagSet(1) << 30;
DrawMode HALFEDGES_COLORED = ModeFlagSet(1) << 31;
DrawMode UNUSED = ModeFlagSet(1) << 32;
//== IMPLEMENTATION ==========================================================
......@@ -319,6 +320,7 @@ void initializeDefaultDrawModes( void )
currentDrawModes_.push_back( DrawModeInternal( "Solid (colored per-face)", SOLID_FACES_COLORED ) );
currentDrawModes_.push_back( DrawModeInternal( "Solid (colored per-vertex)", SOLID_POINTS_COLORED ) );
currentDrawModes_.push_back( DrawModeInternal( "Solid (colored per-vertex, shaded)", SOLID_POINTS_COLORED_SHADED ) );
currentDrawModes_.push_back( DrawModeInternal( "Solid (environment mapped)", SOLID_ENV_MAPPED ) );
......
......@@ -218,8 +218,10 @@ namespace DrawModes {
extern ACGDLLEXPORT DrawMode SOLID_PHONG_SHADED;
/// draw colored, but not lighted faces using face colors
extern ACGDLLEXPORT DrawMode SOLID_FACES_COLORED;
/// draw faces, but use Gouraud shading to interpolate vertex colors
/// draw colored, but not lighted faces using interpolated vertex colors
extern ACGDLLEXPORT DrawMode SOLID_POINTS_COLORED;
/// draw faces, but use Gouraud shading to interpolate vertex colors
extern ACGDLLEXPORT DrawMode SOLID_POINTS_COLORED_SHADED;
/// draw environment mapped
extern ACGDLLEXPORT DrawMode SOLID_ENV_MAPPED;
/// draw textured faces
......
......@@ -133,6 +133,9 @@ availableDrawModes() const {
{
drawModes |= DrawModes::POINTS_COLORED;
drawModes |= DrawModes::SOLID_POINTS_COLORED;
if (mesh_.has_vertex_normals())
drawModes |= DrawModes::SOLID_POINTS_COLORED_SHADED;
}
if(mesh_.has_edge_colors())
......@@ -317,8 +320,20 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
ACG::GLState::shadeModel(GL_FLAT);
draw_halfedges();
}
if ( ( _drawMode & DrawModes::SOLID_POINTS_COLORED ) && mesh_.has_vertex_colors() )
{
ACG::GLState::disable(GL_LIGHTING);
ACG::GLState::shadeModel(GL_SMOOTH);
ACG::GLState::depthRange(0.01, 1.0);
drawMesh_->usePerVertexColors();
draw_faces();
ACG::GLState::depthRange(0.0, 1.0);
}
if ( ( _drawMode & DrawModes::SOLID_POINTS_COLORED_SHADED ) && mesh_.has_vertex_colors() && mesh_.has_vertex_normals() )
{
ACG::GLState::enable(GL_LIGHTING);
ACG::GLState::shadeModel(GL_SMOOTH);
......@@ -334,7 +349,7 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
draw_faces();
ACG::GLState::depthRange(0.0, 1.0);
}
if ( ( _drawMode & DrawModes::SOLID_FLAT_SHADED ) && mesh_.has_face_normals() && mesh_.n_faces() > 0)
{
ACG::GLState::enable(GL_LIGHTING);
......
......@@ -78,12 +78,12 @@ std::vector< QString > drawModeToList(ACG::SceneGraph::DrawModes::DrawMode _draw
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_POINTS_COLORED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED)
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_POINTS_COLORED_SHADED)
draw_modes.push_back("SOLID_POINTS_COLORED_SHADED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED)
draw_modes.push_back("SOLID_ENV_MAPPED");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_TEXTURED)
......@@ -138,10 +138,12 @@ ACG::SceneGraph::DrawModes::DrawMode listToDrawMode( std::vector< QString > _dra
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_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_POINTS_COLORED" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED;
} else if( _draw_modes[i] == "SOLID_POINTS_COLORED_SHADED" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED_SHADED;
} else if( _draw_modes[i] == "SOLID_ENV_MAPPED" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED;
} else if( _draw_modes[i] == "SOLID_TEXTURED" ) {
......@@ -203,6 +205,8 @@ ACG::SceneGraph::DrawModes::DrawMode descriptionsToDrawMode ( std::vector< QStri
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 (colored per-vertex, shaded)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED_SHADED;
} else if( _draw_modes[i] == "Solid (environment mapped)" ) {
drawMode = drawMode | ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED;
} else if( _draw_modes[i] == "Solid (textured)" ) {
......@@ -257,12 +261,12 @@ std::vector< QString > drawModeToDescriptions(ACG::SceneGraph::DrawModes::DrawMo
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_POINTS_COLORED_SHADED)
draw_modes.push_back("Solid (colored per-vertex, shaded)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED)
draw_modes.push_back("Solid (environment mapped)");
if ( _drawMode & ACG::SceneGraph::DrawModes::SOLID_TEXTURED)
......
Supports Markdown
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