Commit 870cdb35 authored by Jan Möbius's avatar Jan Möbius
Browse files

Lots of cppcheck fixes


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18765 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 09c7e5fd
...@@ -159,7 +159,6 @@ void IRenderer::traverseRenderableNodes( ACG::GLState* _glState, ACG::SceneGraph ...@@ -159,7 +159,6 @@ void IRenderer::traverseRenderableNodes( ACG::GLState* _glState, ACG::SceneGraph
if (_node) if (_node)
{ {
ACG::SceneGraph::BaseNode::StatusMode status(_node->status()); ACG::SceneGraph::BaseNode::StatusMode status(_node->status());
bool process_children(status != ACG::SceneGraph::BaseNode::HideChildren);
ACG::SceneGraph::DrawModes::DrawMode nodeDM = _node->drawMode(); ACG::SceneGraph::DrawModes::DrawMode nodeDM = _node->drawMode();
...@@ -184,7 +183,8 @@ void IRenderer::traverseRenderableNodes( ACG::GLState* _glState, ACG::SceneGraph ...@@ -184,7 +183,8 @@ void IRenderer::traverseRenderableNodes( ACG::GLState* _glState, ACG::SceneGraph
if (_node->status() != ACG::SceneGraph::BaseNode::HideNode) if (_node->status() != ACG::SceneGraph::BaseNode::HideNode)
_node->getRenderObjects(this, *_glState, nodeDM, _mat); _node->getRenderObjects(this, *_glState, nodeDM, _mat);
if (process_children) // Process children?
if (status != ACG::SceneGraph::BaseNode::HideChildren)
{ {
ACG::SceneGraph::BaseNode::ChildIter cIt, cEnd(_node->childrenEnd()); ACG::SceneGraph::BaseNode::ChildIter cIt, cEnd(_node->childrenEnd());
......
...@@ -778,7 +778,7 @@ const DrawMode& addDrawMode( const std::string & _name , bool _propertyBased) ...@@ -778,7 +778,7 @@ const DrawMode& addDrawMode( const std::string & _name , bool _propertyBased)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
ACGDLLEXPORT ACGDLLEXPORT
const DrawMode& addDrawMode( const std::string & _name, const DrawModeProperties _properties) const DrawMode& addDrawMode( const std::string & _name, const DrawModeProperties& _properties)
{ {
const DrawMode& drawmode = addDrawMode( _name , true ); const DrawMode& drawmode = addDrawMode( _name , true );
......
...@@ -637,7 +637,7 @@ namespace DrawModes { ...@@ -637,7 +637,7 @@ namespace DrawModes {
* @return Id of the new draw mode * @return Id of the new draw mode
*/ */
ACGDLLEXPORT ACGDLLEXPORT
const DrawMode& addDrawMode( const std::string & _name, const DrawModeProperties _properties); const DrawMode& addDrawMode( const std::string & _name, const DrawModeProperties& _properties);
/** \brief Get a custom DrawMode. /** \brief Get a custom DrawMode.
* *
......
...@@ -139,12 +139,14 @@ traverse( BaseNode* _node, Action& _action ) ...@@ -139,12 +139,14 @@ traverse( BaseNode* _node, Action& _action )
if (_node) if (_node)
{ {
BaseNode::StatusMode status(_node->status()); BaseNode::StatusMode status(_node->status());
bool process_children(status != BaseNode::HideChildren);
// If the subtree is hidden, ignore this node and its children while rendering // If the subtree is hidden, ignore this node and its children while rendering
if (status != BaseNode::HideSubtree) if (status != BaseNode::HideSubtree)
{ {
bool process_children(status != BaseNode::HideChildren);
// If the node itself is hidden, ignore it but continue with its children // If the node itself is hidden, ignore it but continue with its children
if (_node->status() != BaseNode::HideNode) if (_node->status() != BaseNode::HideNode)
{ {
...@@ -206,55 +208,57 @@ template <class Action> ...@@ -206,55 +208,57 @@ template <class Action>
void void
traverse_multipass ( BaseNode* _node, Action& _action, const unsigned int& _pass ) traverse_multipass ( BaseNode* _node, Action& _action, const unsigned int& _pass )
{ {
// Process node if it exists // Process node if it exists
if (_node) { if (_node) {
BaseNode::StatusMode status(_node->status()); BaseNode::StatusMode status(_node->status());
bool process_children(status != BaseNode::HideChildren);
// If the subtree is hidden, ignore this node and its children while rendering // If the subtree is hidden, ignore this node and its children while rendering
if (status != BaseNode::HideSubtree) { if (status != BaseNode::HideSubtree) {
// Executes this nodes enter function (if available and active in multipass) bool process_children(status != BaseNode::HideChildren);
if ( _node->multipassStatusActive(_pass) ) {
if_has_enter(_action, _node); // Executes this nodes enter function (if available and active in multipass)
} if ( _node->multipassStatusActive(_pass) ) {
if_has_enter(_action, _node);
// If the node itself is hidden, don't call the action on it. }
// Additionally check if rendering order is node first. otherwise, we will call it after the children.
// And check if it should be called in this rendering pass. // If the node itself is hidden, don't call the action on it.
if ( (_node->status() != BaseNode::HideNode ) && ( _node->traverseMode() & BaseNode::NodeFirst ) && _node->multipassNodeActive(_pass)) // Additionally check if rendering order is node first. otherwise, we will call it after the children.
process_children &= _action(_node); // And check if it should be called in this rendering pass.
if ( (_node->status() != BaseNode::HideNode ) && ( _node->traverseMode() & BaseNode::NodeFirst ) && _node->multipassNodeActive(_pass))
if (process_children) { process_children &= _action(_node);
BaseNode::ChildIter cIt, cEnd(_node->childrenEnd()); if (process_children) {
// Process all children BaseNode::ChildIter cIt, cEnd(_node->childrenEnd());
for (cIt = _node->childrenBegin(); cIt != cEnd; ++cIt)
if (~(*cIt)->traverseMode() & BaseNode::SecondPass) // Process all children
traverse_multipass(*cIt, _action, _pass); for (cIt = _node->childrenBegin(); cIt != cEnd; ++cIt)
if (~(*cIt)->traverseMode() & BaseNode::SecondPass)
// Process all children which are second pass traverse_multipass(*cIt, _action, _pass);
for (cIt = _node->childrenBegin(); cIt != cEnd; ++cIt)
if ((*cIt)->traverseMode() & BaseNode::SecondPass) // Process all children which are second pass
traverse_multipass(*cIt, _action, _pass); for (cIt = _node->childrenBegin(); cIt != cEnd; ++cIt)
if ((*cIt)->traverseMode() & BaseNode::SecondPass)
} traverse_multipass(*cIt, _action, _pass);
}
// If we are in childrenfirst node, the children have been painted andwe now check, if we can draw this node.
// If its hidden, ignore it.
// If it should not be rendered in this pass, ignore it too. // If we are in childrenfirst node, the children have been painted andwe now check, if we can draw this node.
if ( (_node->traverseMode() & BaseNode::ChildrenFirst ) && (_node->status() != BaseNode::HideNode) && _node->multipassNodeActive(_pass) ) // If its hidden, ignore it.
_action(_node); // If it should not be rendered in this pass, ignore it too.
if ( (_node->traverseMode() & BaseNode::ChildrenFirst ) && (_node->status() != BaseNode::HideNode) && _node->multipassNodeActive(_pass) )
// Call the leave function of the node (if available and active in multipass). _action(_node);
if ( _node->multipassStatusActive(_pass) )
if_has_leave(_action, _node); // Call the leave function of the node (if available and active in multipass).
if ( _node->multipassStatusActive(_pass) )
} // if (status != BaseNode::HideSubtree) if_has_leave(_action, _node);
} // if(node_)
} // if (status != BaseNode::HideSubtree)
} // if(node_)
} }
......
...@@ -1021,7 +1021,7 @@ updatePerFaceBuffers() { ...@@ -1021,7 +1021,7 @@ updatePerFaceBuffers() {
typename Mesh::VertexHandle cvh = mesh_.to_vertex_handle(fhe_it); typename Mesh::VertexHandle cvh = mesh_.to_vertex_handle(fhe_it);
const Vec2f texcoord = mesh_.property(perFaceTextureCoordinateProperty,fhe_it); const Vec2f texcoord = mesh_.property(perFaceTextureCoordinateProperty,fhe_it);
if ( mesh_.vertex_handle( strips_[ i ].indexArray[ stripIndex - 2 ] ) == cvh ) { if ( mesh_.vertex_handle( strips_[ i ].indexArray[ stripIndex - 2 ] ) == cvh ) {
perFaceTextureCoordArray_[ bufferIndex + 2 ] = texcoord; perFaceTextureCoordArray_[ bufferIndex + 2 ] = texcoord;
continue; continue;
} else if ( mesh_.vertex_handle( strips_[ i ].indexArray[ stripIndex - 1 ] ) == cvh ) { } else if ( mesh_.vertex_handle( strips_[ i ].indexArray[ stripIndex - 1 ] ) == cvh ) {
......
...@@ -426,7 +426,7 @@ QPoint mapToLocal( const QPoint _point ) { ...@@ -426,7 +426,7 @@ QPoint mapToLocal( const QPoint _point ) {
return examiner_widgets_[activeExaminer_]->glMapFromGlobal(_point); return examiner_widgets_[activeExaminer_]->glMapFromGlobal(_point);
} }
void setDrawMode( const ACG::SceneGraph::DrawModes::DrawMode _mode , int _viewer) { void setDrawMode( const ACG::SceneGraph::DrawModes::DrawMode _mode& , int _viewer) {
if ( _viewer == ACTIVE_VIEWER ) if ( _viewer == ACTIVE_VIEWER )
viewerProperties(activeExaminer()).drawMode(_mode); viewerProperties(activeExaminer()).drawMode(_mode);
......
...@@ -356,7 +356,7 @@ void perspectiveProjection( int _viewer = ALL_VIEWERS ); ...@@ -356,7 +356,7 @@ void perspectiveProjection( int _viewer = ALL_VIEWERS );
* @param _mode New drawmode of the given viewer * @param _mode New drawmode of the given viewer
*/ */
DLLEXPORT DLLEXPORT
void setDrawMode( const ACG::SceneGraph::DrawModes::DrawMode _mode , int _viewer = ALL_VIEWERS); void setDrawMode( const ACG::SceneGraph::DrawModes::DrawMode& _mode , int _viewer = ALL_VIEWERS);
/** \brief Get the current draw Mode of a Viewer /** \brief Get the current draw Mode of a Viewer
* *
......
...@@ -331,7 +331,6 @@ void DepthPeelingPlugin::traverseLightNodes( BaseNode* _node) ...@@ -331,7 +331,6 @@ void DepthPeelingPlugin::traverseLightNodes( BaseNode* _node)
if (_node) if (_node)
{ {
BaseNode::StatusMode status(_node->status()); BaseNode::StatusMode status(_node->status());
bool process_children(status != BaseNode::HideChildren);
// If the subtree is hidden, ignore this node and its children while rendering // If the subtree is hidden, ignore this node and its children while rendering
if (status != BaseNode::HideSubtree) if (status != BaseNode::HideSubtree)
...@@ -371,7 +370,8 @@ void DepthPeelingPlugin::traverseLightNodes( BaseNode* _node) ...@@ -371,7 +370,8 @@ void DepthPeelingPlugin::traverseLightNodes( BaseNode* _node)
} }
} }
if (process_children) // Process children?
if (status != BaseNode::HideChildren)
{ {
BaseNode::ChildIter cIt, cEnd(_node->childrenEnd()); BaseNode::ChildIter cIt, cEnd(_node->childrenEnd());
...@@ -914,11 +914,12 @@ DepthPeelingPlugin::traverseDraw( BaseNode* _node, Action& _action, ACG::SceneGr ...@@ -914,11 +914,12 @@ DepthPeelingPlugin::traverseDraw( BaseNode* _node, Action& _action, ACG::SceneGr
// Process node if it exists // Process node if it exists
if (_node) { if (_node) {
BaseNode::StatusMode status(_node->status()); BaseNode::StatusMode status(_node->status());
bool process_children(status != BaseNode::HideChildren);
// If the subtree is hidden, ignore this node and its children while rendering // If the subtree is hidden, ignore this node and its children while rendering
if (status != BaseNode::HideSubtree) { if (status != BaseNode::HideSubtree) {
bool process_children(status != BaseNode::HideChildren);
// Executes this nodes enter function (if available and active in multipass) // Executes this nodes enter function (if available and active in multipass)
if ( _node->multipassStatusActive(_pass) ) { if ( _node->multipassStatusActive(_pass) ) {
if_has_enter(_action, _node); if_has_enter(_action, _node);
......
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