本文整理汇总了C++中osg::Node::getStateSet方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::getStateSet方法的具体用法?C++ Node::getStateSet怎么用?C++ Node::getStateSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Node
的用法示例。
在下文中一共展示了Node::getStateSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
void apply(osg::Node& node)
{
if (node.getStateSet()) process(node.getStateSet());
if (node.getUpdateCallback())
{
_operatorList.insert(new CallbackOperator(&node, node.getUpdateCallback()));
}
LayerAttributes* la = dynamic_cast<LayerAttributes*>(node.getUserData());
if (la)
{
if ((_objectsHandled[la]++)==0)
{
OSG_NOTICE<<"LayerAttributeOperator for "<<la<<" required, assigning one."<<std::endl;
_operatorList.insert(new LayerAttributesOperator(&node, la));
}
else
{
OSG_NOTICE<<"LayerAttributeOperator for "<<la<<" not required, as one already assigned."<<std::endl;
}
}
traverse(node);
}
示例2: apply
void apply(osg::Node& node)
{
if (_visited.count(&node)!=0) return;
_visited.insert(&node);
if (node.getStateSet()) apply(*(node.getStateSet()));
traverse(node);
}
示例3: apply
void StatsVisitor::apply(osg::Node& node)
{
if (node.getStateSet())
{
++_numInstancedStateSet;
_statesetSet.insert(node.getStateSet());
}
traverse(node);
}
示例4: apply
void StatsVisitor::apply(osg::Node& node)
{
if (node.getStateSet())
{
apply(*node.getStateSet());
}
traverse(node);
}
示例5: apply
void ShaderVisitor::apply(osg::Node& node)
{
if (node.getStateSet())
{
pushRequirements();
applyStateSet(node.getStateSet(), node);
traverse(node);
popRequirements();
}
else
traverse(node);
}
示例6: isBasicRootNode
/// Returns true if the given node is a basic root group with no special information.
/// Used in conjunction with UseFbxRoot option.
/// Identity transforms are considered as basic root nodes.
bool isBasicRootNode(const osg::Node &node)
{
const osg::Group *osgGroup = node.asGroup();
if (!osgGroup || node.asGeode()) // WriterNodeVisitor handles Geodes the "old way" (= Derived from Node, not Group as for now). Geodes may be considered "basic root nodes" when WriterNodeVisitor will be adapted.
{
// Geodes & such are not basic root nodes
return false;
}
// Test if we've got an empty transform (= a group!)
const osg::Transform *transform = osgGroup->asTransform();
if (transform)
{
if (const osg::MatrixTransform *matrixTransform = transform->asMatrixTransform())
{
if (!matrixTransform->getMatrix().isIdentity())
{
// Non-identity matrix transform
return false;
}
}
else if (const osg::PositionAttitudeTransform *pat = transform->asPositionAttitudeTransform())
{
if (pat->getPosition() != osg::Vec3d() ||
pat->getAttitude() != osg::Quat() ||
pat->getScale() != osg::Vec3d(1.0f, 1.0f, 1.0f) ||
pat->getPivotPoint() != osg::Vec3d())
{
// Non-identity position attribute transform
return false;
}
}
else
{
// Other transform (not identity or not predefined type)
return false;
}
}
// Test the presence of a non-empty stateset
if (node.getStateSet())
{
osg::ref_ptr<osg::StateSet> emptyStateSet = new osg::StateSet;
if (node.getStateSet()->compare(*emptyStateSet, true) != 0)
{
return false;
}
}
return true;
}
示例7: traverse
void
ShaderGenerator::apply( osg::Node& node )
{
if ( !_active ) return;
if ( node.getStateSet() )
_state->pushStateSet( node.getStateSet() );
traverse(node);
if ( node.getStateSet() )
_state->popStateSet();
}
示例8: apply
void CVRCullVisitor::apply(osg::Node& node)
{
bool status = _cullingStatus;
bool firstStatus = _firstCullStatus;
if(isCulled(node))
{
_firstCullStatus = firstStatus;
_cullingStatus = status;
return;
}
// push the culling mode.
pushCurrentMask();
// push the node's state.
StateSet* node_state = node.getStateSet();
if(node_state)
pushStateSet(node_state);
handle_cull_callbacks_and_traverse(node);
// pop the node's state off the geostate stack.
if(node_state)
popStateSet();
// pop the culling mode.
popCurrentMask();
_firstCullStatus = firstStatus;
_cullingStatus = status;
}
示例9: duplicateSharedNode
void
ShaderGenerator::apply(osg::Node& node)
{
if ( !_active )
return;
if ( ignore(&node) )
return;
if ( _duplicateSharedSubgraphs )
duplicateSharedNode(node);
applyNonCoreNodeIfNecessary( node );
osg::ref_ptr<osg::StateSet> stateset = node.getStateSet();
if ( stateset.valid() )
{
_state->pushStateSet( stateset.get() );
}
traverse(node);
if ( stateset.valid() )
{
_state->popStateSet();
}
}
示例10: traverse
void
ShaderGenerator::apply( osg::Node& node )
{
if ( !_active ) return;
osg::ref_ptr<osg::StateSet> ss = node.getStateSet();
if ( ss.valid() )
{
_state->pushStateSet( ss.get() );
osg::ref_ptr<osg::StateSet> replacement;
if ( processGeometry(ss.get(), replacement) )
{
// optimize state set sharing
if ( _stateSetCache.valid() )
_stateSetCache->share(replacement, replacement);
_state->popStateSet();
node.setStateSet( replacement.get() );
_state->pushStateSet( replacement.get() );
}
}
traverse(node);
if ( ss.get() )
{
_state->popStateSet();
}
}
示例11: apply
void apply(osg::Node& node)
{
if (node.getStateSet()) process(node.getStateSet());
if (node.getUpdateCallback())
{
_operatorList.insert(new CallbackOperator(&node, node.getUpdateCallback()));
}
LayerAttributes* la = dynamic_cast<LayerAttributes*>(node.getUserData());
if (la)
{
_operatorList.insert(new LayerAttributesOperator(&node, la));
}
traverse(node);
}
示例12: pushStateSet
void
CountsVisitor::apply(osg::Node& node)
{
pushStateSet(node.getStateSet());
_nodes++;
osg::ref_ptr<osg::Object> rp = (osg::Object*)&node;
_uNodes.insert(rp);
apply(node.getStateSet());
if (++_depth > _maxDepth)
_maxDepth = _depth;
traverse(node);
_depth--;
popStateSet();
}
示例13: apply
// ----------------------------------------------------------------
// SharedStateManager::apply
// ----------------------------------------------------------------
void SharedStateManager::apply(osg::Node &node)
{
osg::StateSet *ss = node.getStateSet();
if (ss)
process(ss, &node);
traverse(node);
}
示例14: apply
virtual void apply(osg::Node& node)
{
if (node.getStateSet())
{
node.setStateSet(0);
++_numStateSetRemoved;
}
traverse(node);
}
示例15: traverse
void
CountStateSets::apply( osg::Node& node )
{
if( !processStateSet( node.getStateSet() ) && _removeEmptyStateSets )
{
node.setStateSet( NULL );
_removedStateSets++;
}
traverse( node );
}