Commit 677bcebe authored by Christopher Tenter's avatar Christopher Tenter
Browse files

update status node rendering

parent 07ba3d74
......@@ -41,9 +41,9 @@
/*===========================================================================*\
* *
* $Revision$ *
* $Author$ *
* $Date$ *
* $Revision: 21134 $ *
* $Author: moeller $ *
* $Date: 2015-08-21 13:22:18 +0200 (Fri, 21 Aug 2015) $ *
* *
\*===========================================================================*/
......@@ -593,23 +593,23 @@ void StatusNodeT<Mesh, Mod>::getRenderObjects(IRenderer* _renderer,
// Call updater function before doing anything
update_cache();
bool shaded = (_drawMode & ( DrawModes::SOLID_FLAT_SHADED |
DrawModes::SOLID_SMOOTH_SHADED |
DrawModes::SOLID_PHONG_SHADED |
DrawModes::SOLID_TEXTURED_SHADED |
DrawModes::POINTS_SHADED ));
bool points = ((this->drawMode() == DrawModes::DEFAULT) |
(_drawMode & DrawModes::POINTS));
bool edges = ((this->drawMode() == DrawModes::DEFAULT) |
(_drawMode & DrawModes::WIREFRAME));
bool halfedges = ((this->drawMode() == DrawModes::DEFAULT) |
(_drawMode & DrawModes::WIREFRAME));
bool faces = ((this->drawMode() == DrawModes::DEFAULT) |
(_drawMode & DrawModes::SOLID_FLAT_SHADED));
bool shaded = false,
smooth = false,
wires = ((this->drawMode() == DrawModes::DEFAULT) ||
this->drawMode().getLayerIndexByPrimitive(DrawModes::PRIMITIVE_WIREFRAME) >= 0 ||
_drawMode.getLayerIndexByPrimitive(DrawModes::PRIMITIVE_WIREFRAME) >= 0),
points = ((this->drawMode() == DrawModes::DEFAULT) ||
this->drawMode().getLayerIndexByPrimitive(DrawModes::PRIMITIVE_POINT) >= 0 ||
_drawMode.getLayerIndexByPrimitive(DrawModes::PRIMITIVE_POINT) >= 0),
edges = (this->drawMode() == DrawModes::DEFAULT ||
this->drawMode().getLayerIndexByPrimitive(DrawModes::PRIMITIVE_EDGE) >= 0 ||
_drawMode.getLayerIndexByPrimitive(DrawModes::PRIMITIVE_EDGE) >= 0),
halfedges = ((this->drawMode() == DrawModes::DEFAULT) ||
this->drawMode().getLayerIndexByPrimitive(DrawModes::PRIMITIVE_HALFEDGE) >= 0 ||
_drawMode.getLayerIndexByPrimitive(DrawModes::PRIMITIVE_HALFEDGE) >= 0),
faces = ((this->drawMode() == DrawModes::DEFAULT) ||
this->drawMode().getLayerIndexByPrimitive(DrawModes::PRIMITIVE_POLYGON) >= 0 ||
_drawMode.getLayerIndexByPrimitive(DrawModes::PRIMITIVE_POLYGON) >= 0);
RenderObject ro;
ro.debugName = "StatusNode";
......
......@@ -176,27 +176,64 @@ void StatusViewNodeT<MeshT>::draw( GLState& _state, const DrawModes::DrawMode& _
template <class MeshT>
void StatusViewNodeT<MeshT>::getRenderObjects(IRenderer* _renderer, GLState& _state , const DrawModes::DrawMode& _drawMode , const Material* _mat)
{
// rendering order only depends on priority in render objects
// call enter() and leave() to setup the correct material
if (statusNodeVis_)
{
statusNode_->getRenderObjects(_renderer, _state, _drawMode, _mat);
}
if (areaNodeVis_)
{
areaNode_->getRenderObjects(_renderer, _state, _drawMode, _mat);
}
// extract all layers from drawmode
if (handleNodeVis_)
DrawModes::DrawMode singleLayers[4]; // polygon, edge, halfedge, point
// remove default property layer
for (int i = 0; i < 4; ++i)
singleLayers[i].removeLayer(0u);
for (unsigned int i = 0; i < _drawMode.getNumLayers(); ++i)
{
handleNode_->getRenderObjects(_renderer, _state, _drawMode, _mat);
const DrawModes::DrawModeProperties* props = _drawMode.getLayer(i);
switch (props->primitive())
{
case DrawModes::PRIMITIVE_POLYGON: singleLayers[0].setDrawModeProperties(props); break;
case DrawModes::PRIMITIVE_EDGE: singleLayers[1].setDrawModeProperties(props); break;
case DrawModes::PRIMITIVE_HALFEDGE: singleLayers[2].setDrawModeProperties(props); break;
case DrawModes::PRIMITIVE_POINT: singleLayers[3].setDrawModeProperties(props); break;
default: break;
}
}
if (featureNodeVis_)
// rendering order: faces -> edges -> halfedges -> points
// area -> handle -> feature -> selections
// rendering order only depends on priority in render objects
for (int i = 0; i < 4; ++i)
{
featureNode_->getRenderObjects(_renderer, _state, _drawMode, _mat);
if (singleLayers[i].getNumLayers() == 0)
{
DrawModes::DrawModeProperties defaultProps;
switch (i)
{
case 0: defaultProps.primitive(DrawModes::PRIMITIVE_POLYGON); break;
case 1: defaultProps.primitive(DrawModes::PRIMITIVE_EDGE); break;
case 2: defaultProps.primitive(DrawModes::PRIMITIVE_HALFEDGE); break;
case 3: defaultProps.primitive(DrawModes::PRIMITIVE_POINT); break;
default: break;
}
singleLayers[i].addLayer(&defaultProps);
}
if (statusNodeVis_)
statusNode_->getRenderObjects(_renderer, _state, singleLayers[i], _mat);
if (areaNodeVis_)
areaNode_->getRenderObjects(_renderer, _state, singleLayers[i], _mat);
if (handleNodeVis_)
handleNode_->getRenderObjects(_renderer, _state, singleLayers[i], _mat);
if (featureNodeVis_)
featureNode_->getRenderObjects(_renderer, _state, singleLayers[i], _mat);
}
}
......
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