Commit 20dd7883 authored by Martin Heistermann's avatar Martin Heistermann

Merge branch 'master' into avoid_dynamic_cast

parents a338b3b8 1df747d5
...@@ -338,7 +338,7 @@ void VolumeMeshBufferManager<VolumeMesh>::setOptionsFromDrawMode(ACG::SceneGraph ...@@ -338,7 +338,7 @@ void VolumeMeshBufferManager<VolumeMesh>::setOptionsFromDrawMode(ACG::SceneGraph
// colors // colors
if (_drawMode & (mDrawModes.cellsColoredPerCell)) if (_drawMode & (mDrawModes.cellsColoredPerCell))
enablePerCellColors(); enablePerCellColors();
else if (_drawMode & (mDrawModes.cellsColoredPerFace | mDrawModes.facesColoredPerFace)) else if (_drawMode & (mDrawModes.cellsColoredPerFace | mDrawModes.facesColoredPerFace | mDrawModes.facesColoredPerFaceFlatShaded))
enablePerFaceColors(); enablePerFaceColors();
else if (_drawMode & (mDrawModes.cellsColoredPerHalfface | mDrawModes.halffacesColoredPerHalfface)) else if (_drawMode & (mDrawModes.cellsColoredPerHalfface | mDrawModes.halffacesColoredPerHalfface))
enablePerHalffaceColors(); enablePerHalffaceColors();
...@@ -356,7 +356,7 @@ void VolumeMeshBufferManager<VolumeMesh>::setOptionsFromDrawMode(ACG::SceneGraph ...@@ -356,7 +356,7 @@ void VolumeMeshBufferManager<VolumeMesh>::setOptionsFromDrawMode(ACG::SceneGraph
//normals //normals
if (_drawMode & (mDrawModes.cellsFlatShaded | mDrawModes.halffacesFlatShaded)) if (_drawMode & (mDrawModes.cellsFlatShaded | mDrawModes.halffacesFlatShaded))
enablePerHalffaceNormals(); enablePerHalffaceNormals();
else if (_drawMode & (mDrawModes.facesFlatShaded | mDrawModes.facesTexturedShaded)) else if (_drawMode & (mDrawModes.facesFlatShaded | mDrawModes.facesTexturedShaded | mDrawModes.facesColoredPerFaceFlatShaded))
enablePerFaceNormals(); enablePerFaceNormals();
else if (_drawMode & (mDrawModes.cellsSmoothShaded | mDrawModes.facesSmoothShaded | mDrawModes.halffacesSmoothShaded | else if (_drawMode & (mDrawModes.cellsSmoothShaded | mDrawModes.facesSmoothShaded | mDrawModes.halffacesSmoothShaded |
mDrawModes.cellsPhongShaded | mDrawModes.facesPhongShaded | mDrawModes.halffacesPhongShaded)) mDrawModes.cellsPhongShaded | mDrawModes.facesPhongShaded | mDrawModes.halffacesPhongShaded))
......
...@@ -74,6 +74,7 @@ public: ...@@ -74,6 +74,7 @@ public:
facesSmoothShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (smooth shaded)")), facesSmoothShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (smooth shaded)")),
facesPhongShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (phong shaded)")), facesPhongShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (phong shaded)")),
facesColoredPerFace(ACG::SceneGraph::DrawModes::addDrawMode("Faces (colored per face)")), facesColoredPerFace(ACG::SceneGraph::DrawModes::addDrawMode("Faces (colored per face)")),
facesColoredPerFaceFlatShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (colored per face, flat shaded)")),
facesColoredPerVertex(ACG::SceneGraph::DrawModes::addDrawMode("Faces (colored per vertex)")), facesColoredPerVertex(ACG::SceneGraph::DrawModes::addDrawMode("Faces (colored per vertex)")),
facesTextured(ACG::SceneGraph::DrawModes::addDrawMode("Faces (textured)")), facesTextured(ACG::SceneGraph::DrawModes::addDrawMode("Faces (textured)")),
facesTexturedShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (textured and shaded)")), facesTexturedShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (textured and shaded)")),
...@@ -104,7 +105,7 @@ public: ...@@ -104,7 +105,7 @@ public:
cellBasedDrawModes(cellsFlatShaded | cellsSmoothShaded | cellsPhongShaded | cellsColoredPerCell | cellsColoredPerFace cellBasedDrawModes(cellsFlatShaded | cellsSmoothShaded | cellsPhongShaded | cellsColoredPerCell | cellsColoredPerFace
| cellsColoredPerHalfface | cellsColoredPerVertex | cellsTransparent), | cellsColoredPerHalfface | cellsColoredPerVertex | cellsTransparent),
faceBasedDrawModes(facesFlatShaded | facesSmoothShaded | facesPhongShaded | facesColoredPerFace | faceBasedDrawModes(facesFlatShaded | facesSmoothShaded | facesPhongShaded | facesColoredPerFace | facesColoredPerFaceFlatShaded |
facesColoredPerVertex | facesTextured | facesTexturedShaded | hiddenLineBackgroundFaces), facesColoredPerVertex | facesTextured | facesTexturedShaded | hiddenLineBackgroundFaces),
halffaceBasedDrawModes(halffacesFlatShaded | halffacesSmoothShaded | halffacesPhongShaded | halffacesColoredPerHalfface halffaceBasedDrawModes(halffacesFlatShaded | halffacesSmoothShaded | halffacesPhongShaded | halffacesColoredPerHalfface
| halffacesColoredPerVertex), | halffacesColoredPerVertex),
...@@ -128,6 +129,7 @@ public: ...@@ -128,6 +129,7 @@ public:
ACG::SceneGraph::DrawModes::DrawMode facesSmoothShaded; ACG::SceneGraph::DrawModes::DrawMode facesSmoothShaded;
ACG::SceneGraph::DrawModes::DrawMode facesPhongShaded; ACG::SceneGraph::DrawModes::DrawMode facesPhongShaded;
ACG::SceneGraph::DrawModes::DrawMode facesColoredPerFace; ACG::SceneGraph::DrawModes::DrawMode facesColoredPerFace;
ACG::SceneGraph::DrawModes::DrawMode facesColoredPerFaceFlatShaded;
ACG::SceneGraph::DrawModes::DrawMode facesColoredPerVertex; ACG::SceneGraph::DrawModes::DrawMode facesColoredPerVertex;
ACG::SceneGraph::DrawModes::DrawMode facesTextured; ACG::SceneGraph::DrawModes::DrawMode facesTextured;
ACG::SceneGraph::DrawModes::DrawMode facesTexturedShaded; ACG::SceneGraph::DrawModes::DrawMode facesTexturedShaded;
...@@ -189,14 +191,15 @@ public: ...@@ -189,14 +191,15 @@ public:
*/ */
ACG::SceneGraph::DrawModes::DrawMode getFirstFaceDrawMode(ACG::SceneGraph::DrawModes::DrawMode _drawMode) ACG::SceneGraph::DrawModes::DrawMode getFirstFaceDrawMode(ACG::SceneGraph::DrawModes::DrawMode _drawMode)
{ {
if (facesFlatShaded & _drawMode) return facesFlatShaded; if (facesFlatShaded & _drawMode) return facesFlatShaded;
if (facesSmoothShaded & _drawMode) return facesSmoothShaded; if (facesSmoothShaded & _drawMode) return facesSmoothShaded;
if (facesPhongShaded & _drawMode) return facesPhongShaded; if (facesPhongShaded & _drawMode) return facesPhongShaded;
if (facesColoredPerFace & _drawMode) return facesColoredPerFace; if (facesColoredPerFace & _drawMode) return facesColoredPerFace;
if (facesColoredPerFace & _drawMode) return facesColoredPerFace; if (facesColoredPerFaceFlatShaded & _drawMode) return facesColoredPerFaceFlatShaded;
if (facesColoredPerVertex & _drawMode) return facesColoredPerVertex; if (facesColoredPerFace & _drawMode) return facesColoredPerFace;
if (facesTextured & _drawMode) return facesTextured; if (facesColoredPerVertex & _drawMode) return facesColoredPerVertex;
if (facesTexturedShaded & _drawMode) return facesTexturedShaded; if (facesTextured & _drawMode) return facesTextured;
if (facesTexturedShaded & _drawMode) return facesTexturedShaded;
if (halffacesFlatShaded & _drawMode) return halffacesFlatShaded; if (halffacesFlatShaded & _drawMode) return halffacesFlatShaded;
if (halffacesSmoothShaded & _drawMode) return halffacesSmoothShaded; if (halffacesSmoothShaded & _drawMode) return halffacesSmoothShaded;
......
...@@ -179,6 +179,8 @@ DrawModes::DrawMode VolumeMeshNodeT<VolumeMeshT>::availableDrawModes() const { ...@@ -179,6 +179,8 @@ DrawModes::DrawMode VolumeMeshNodeT<VolumeMeshT>::availableDrawModes() const {
result |= drawModes_.facesColoredPerVertex; result |= drawModes_.facesColoredPerVertex;
if (colorAttrib_.face_colors_available()) if (colorAttrib_.face_colors_available())
result |= drawModes_.facesColoredPerFace; result |= drawModes_.facesColoredPerFace;
if (colorAttrib_.face_colors_available())
result |= drawModes_.facesColoredPerFaceFlatShaded;
if (texcoordAttrib_.vertex_texcoords_available()) if (texcoordAttrib_.vertex_texcoords_available())
result |= drawModes_.facesTextured; result |= drawModes_.facesTextured;
if (texcoordAttrib_.vertex_texcoords_available()) if (texcoordAttrib_.vertex_texcoords_available())
...@@ -346,6 +348,19 @@ void VolumeMeshNodeT<VolumeMeshT>::drawFaces(GLState& _state, const DrawModes::D ...@@ -346,6 +348,19 @@ void VolumeMeshNodeT<VolumeMeshT>::drawFaces(GLState& _state, const DrawModes::D
GLState::disable(GL_LIGHTING); GLState::disable(GL_LIGHTING);
GLState::shadeModel(GL_SMOOTH); GLState::shadeModel(GL_SMOOTH);
} }
else if (_drawMode & (drawModes_.facesColoredPerFaceFlatShaded))
{
GLState::enable(GL_COLOR_MATERIAL);
GLState::enableClientState(GL_COLOR_ARRAY);
GLState::colorPointer(4, GL_UNSIGNED_BYTE, facesBufferManager_.getStride(), reinterpret_cast<GLvoid*>(facesBufferManager_.getColorOffset()));
GLState::enable(GL_LIGHTING);
GLState::shadeModel(GL_FLAT);
GLState::enableClientState(GL_NORMAL_ARRAY);
GLState::normalPointer(GL_FLOAT, facesBufferManager_.getStride(), reinterpret_cast<GLvoid*>(facesBufferManager_.getNormalOffset()));
}
else if (_drawMode & (drawModes_.facesTexturedShaded) ) else if (_drawMode & (drawModes_.facesTexturedShaded) )
{ {
glClientActiveTexture(GL_TEXTURE0); glClientActiveTexture(GL_TEXTURE0);
...@@ -642,6 +657,9 @@ void VolumeMeshNodeT<VolumeMeshT>::draw(GLState& _state, const DrawModes::DrawMo ...@@ -642,6 +657,9 @@ void VolumeMeshNodeT<VolumeMeshT>::draw(GLState& _state, const DrawModes::DrawMo
// edge based draw mode (except edges on cells) and irregular edges // edge based draw mode (except edges on cells) and irregular edges
edgeDrawMode |= _drawMode & (drawModes_.irregularInnerEdges | drawModes_.irregularOuterEdges); edgeDrawMode |= _drawMode & (drawModes_.irregularInnerEdges | drawModes_.irregularOuterEdges);
// enable twosided lighting for per_face_flat_shaded
if(faceDrawMode & (drawModes_.facesColoredPerFaceFlatShaded))
_state.set_twosided_lighting(true);
if (cellDrawMode) if (cellDrawMode)
drawCells(_state, cellDrawMode); drawCells(_state, cellDrawMode);
......
...@@ -122,6 +122,7 @@ public: ...@@ -122,6 +122,7 @@ public:
public: public:
/// return a pointer to the mesh /// return a pointer to the mesh
MeshT* mesh(); MeshT* mesh();
const MeshT* mesh() const;
/** return a full copy of this object ( All scenegraph nodes will be created ) /** return a full copy of this object ( All scenegraph nodes will be created )
* but the object will not be a part of the object tree. * but the object will not be a part of the object tree.
......
...@@ -216,6 +216,11 @@ MeshT* VolumeMeshObject<MeshT>::mesh() { ...@@ -216,6 +216,11 @@ MeshT* VolumeMeshObject<MeshT>::mesh() {
return mesh_.get(); return mesh_.get();
} }
template<class MeshT>
const MeshT* VolumeMeshObject<MeshT>::mesh() const {
return mesh_.get();
}
/** Updates the visualization of the object. Calls VolumeMeshObject::updateGeometry, /** Updates the visualization of the object. Calls VolumeMeshObject::updateGeometry,
* VolumeMeshObject::updateTopology, VolumeMeshObject::updateSelection and * VolumeMeshObject::updateTopology, VolumeMeshObject::updateSelection and
* VolumeMeshObject::updateModelingRegions. * VolumeMeshObject::updateModelingRegions.
......
Subproject commit d13ed9c350751c5ac377e606f5bd193cb7c38148 Subproject commit 3ae26e6a65064341d57cdcc32a6ca568ec6a363c
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