本文整理汇总了C++中osg::Node类的典型用法代码示例。如果您正苦于以下问题:C++ Node类的具体用法?C++ Node怎么用?C++ Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Node类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: apply
virtual void apply(osg::Node& node)
{
if (node.getStateSet())
{
node.setStateSet(0);
++_numStateSetRemoved;
}
traverse(node);
}
开发者ID:AdriCS,项目名称:osg,代码行数:9,代码来源:osgconv.cpp
示例2: apply
virtual void apply(osg::Node& node)
{
for(int i=0;i<_indent;++i)
std::cout<<" ";
std::cout<<"["<<_indent+1<<"]"<<node.libraryName()
<<"::"<<node.className()<<std::endl;
_indent++;
traverse(node);
_indent--;
}
开发者ID:mapleyustat,项目名称:EAView,代码行数:10,代码来源:EAView.cpp
示例3: traverse
void
CountStateSets::apply( osg::Node& node )
{
if( !processStateSet( node.getStateSet() ) && _removeEmptyStateSets )
{
node.setStateSet( NULL );
_removedStateSets++;
}
traverse( node );
}
开发者ID:NaohiroHayashi,项目名称:bulletsim,代码行数:10,代码来源:CountStateSets.cpp
示例4: apply
void RemoveQueries::apply( osg::Node& node )
{
QueryCullCallback* qcc = dynamic_cast< QueryCullCallback* >(
node.getCullCallback() );
if( qcc != NULL )
node.setCullCallback( NULL );
traverse( node );
}
开发者ID:AdriCS,项目名称:osgWorks-mirror,代码行数:10,代码来源:QueryUtils.cpp
示例5: setMaterialColor
void osgManipulator::setMaterialColor(const osg::Vec4& color, osg::Node& node)
{
osg::Material* mat = dynamic_cast<osg::Material*>(node.getOrCreateStateSet()->getAttribute(osg::StateAttribute::MATERIAL));
if (! mat)
{
mat = new osg::Material;
node.getOrCreateStateSet()->setAttribute(mat);
}
mat->setDiffuse(osg::Material::FRONT_AND_BACK, color);
}
开发者ID:joevandyk,项目名称:osg,代码行数:10,代码来源:Dragger.cpp
示例6: apply
void apply( osg::Node& node )
{
if ( !node.getName().empty() )
{
output() << node.getName() << std::endl;
enter();
traverse( node );
leave();
}
else osgUtil::PrintVisitor::apply(node);
}
开发者ID:512400330,项目名称:osgRecipes,代码行数:11,代码来源:main.cpp
示例7: getNodeName
// ### provide a name to node
std::string daeWriter::getNodeName(const osg::Node &node, const std::string &defaultName)
{
std::string nodeName;
if (node.getName().empty())
nodeName = uniquify(defaultName);
else
nodeName = uniquify(node.getName());
return nodeName;
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:12,代码来源:daeWriter.cpp
示例8: apply
void ShaderVisitor::apply(osg::Node& node)
{
if (node.getStateSet())
{
pushRequirements();
applyStateSet(node.getStateSet(), node);
traverse(node);
popRequirements();
}
else
traverse(node);
}
开发者ID:HedgehogGrandpa,项目名称:openmw,代码行数:12,代码来源:shadervisitor.cpp
示例9: ext
osgDB::ReaderWriter::WriteResult
ReaderWriterDAE::writeNode( const osg::Node& node,
const std::string& fname, const osgDB::ReaderWriter::Options* options ) const
{
SERIALIZER();
bool bOwnDAE = false;
DAE* pDAE = NULL;
std::string ext( osgDB::getLowerCaseFileExtension(fname) );
if( ! acceptsExtension(ext) ) return WriteResult::FILE_NOT_HANDLED;
// Process options
osgDAE::daeWriter::Options pluginOptions;
std::string srcDirectory( osgDB::getFilePath(node.getName().empty() ? fname : node.getName()) ); // Base dir when relativising images paths
if( options )
{
pDAE = (DAE*)options->getPluginData("DAE");
const std::string & baseDir = options->getPluginStringData("baseImageDir"); // Rename "srcModelPath" (and call getFilePath() on it)?
if (!baseDir.empty()) srcDirectory = baseDir;
const std::string & relativiseImagesPathNbUpDirs = options->getPluginStringData("DAE-relativiseImagesPathNbUpDirs");
if (!relativiseImagesPathNbUpDirs.empty()) {
std::istringstream iss(relativiseImagesPathNbUpDirs);
iss >> pluginOptions.relativiseImagesPathNbUpDirs;
}
// Sukender's note: I don't know why DAE seems to accept comma-sparated options instead of space-separated options as other ReaderWriters. However, to avoid breaking compatibility, here's a workaround:
std::string optString( options->getOptionString() );
for(std::string::iterator it=optString.begin(); it!=optString.end(); ++it) {
if (*it == ' ') *it = ',';
}
std::istringstream iss( optString );
std::string opt;
//while (iss >> opt)
while( std::getline( iss, opt, ',' ) )
{
if( opt == "polygon") pluginOptions.usePolygons = true;
else if (opt == "GoogleMode") pluginOptions.googleMode = true;
else if (opt == "NoExtras") pluginOptions.writeExtras = false;
else if (opt == "daeEarthTex") pluginOptions.earthTex = true;
else if (opt == "daeZUpAxis") {} // Nothing (old option)
else if (opt == "daeLinkOriginalTexturesNoForce") { pluginOptions.linkOrignialTextures = true; pluginOptions.forceTexture = false; }
else if (opt == "daeLinkOriginalTexturesForce") { pluginOptions.linkOrignialTextures = true; pluginOptions.forceTexture = true; }
else if (opt == "daeNamesUseCodepage") pluginOptions.namesUseCodepage = true;
else if (!opt.empty())
{
OSG_NOTICE << std::endl << "COLLADA dae plugin: unrecognized option \"" << opt << std::endl;
}
}
}
开发者ID:Kurdakov,项目名称:emscripten_OSG,代码行数:53,代码来源:ReaderWriterDAE.cpp
示例10: handle
void SimpleDotVisitor::handle(osg::Node &node, int id)
{
std::stringstream label;
label << "<top> Node";
if (!node.getName().empty())
{
label << "| " << node.getName();
}
drawNode(id, "record", "solid", label.str(), "black", "white");
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:12,代码来源:SimpleDotVisitor.cpp
示例11: enter
bool PrimitiveIntersector::enter(const osg::Node& node)
{
if (reachedLimit()) return false;
osg::BoundingSphere bs = node.getBound();
if (bs.valid())
{
bs.radius() += (_thickness - _start).length();
}
return !node.isCullingActive() || intersects(bs);
}
开发者ID:emminizer,项目名称:osgearth,代码行数:12,代码来源:PrimitiveIntersector.cpp
示例12: 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;
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:55,代码来源:ReaderWriterFBX.cpp
示例13: OSG_VERSION_GREATER_THAN
void
ProxyCullVisitor::handle_cull_callbacks_and_traverse(osg::Node& node)
{
#if OSG_VERSION_GREATER_THAN(3,3,1)
osg::Callback* callback = node.getCullCallback();
if (callback) callback->run(&node, this);
else traverse(node);
#else
osg::NodeCallback* callback = node.getCullCallback();
if (callback) (*callback)(&node,this);
else traverse(node);
#endif
}
开发者ID:2php,项目名称:osgearth,代码行数:13,代码来源:CullingUtils.cpp
示例14: apply
virtual void apply(osg::Node& node)
{
std::cout
<< spaces()
<< node.libraryName()
<< "::"
<< node.className()
<< std::endl;
level_++;
traverse(node);
level_--;
}
开发者ID:ghub,项目名称:osg3bg,代码行数:13,代码来源:ch5_7.cpp
示例15: traverse
void
ShaderGenerator::apply( osg::Node& node )
{
if ( !_active ) return;
if ( node.getStateSet() )
_state->pushStateSet( node.getStateSet() );
traverse(node);
if ( node.getStateSet() )
_state->popStateSet();
}
开发者ID:dsallen,项目名称:osgearth,代码行数:13,代码来源:ShaderGenerator.cpp
示例16:
void
ShaderGenerator::duplicateSharedNode(osg::Node& node)
{
if ( node.getNumParents() > 1 )
{
for(int i=1; i<(int)node.getNumParents(); ++i)
{
osg::Group* parent = node.getParent(i);
osg::Node* replicant = osg::clone(
&node,
osg::CopyOp::DEEP_COPY_NODES | osg::CopyOp::DEEP_COPY_DRAWABLES | osg::CopyOp::DEEP_COPY_ARRAYS);
parent->replaceChild(&node, replicant);
}
}
}
开发者ID:rhabacker,项目名称:osgearth,代码行数:15,代码来源:ShaderGenerator.cpp
示例17: enter
bool PosterIntersector::enter( const osg::Node& node )
{
if ( !node.isCullingActive() ) return true;
if ( _polytope.contains(node.getBound()) )
{
if ( node.getCullCallback() )
{
const osg::ClusterCullingCallback* cccb =
dynamic_cast<const osg::ClusterCullingCallback*>( node.getCullCallback() );
if ( cccb && cccb->cull(_intersectionVisitor, 0, NULL) ) return false;
}
return true;
}
return false;
}
开发者ID:AndreyIstomin,项目名称:osg,代码行数:15,代码来源:PosterPrinter.cpp
示例18: 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();
}
}
开发者ID:rhabacker,项目名称:osgearth,代码行数:27,代码来源:ShaderGenerator.cpp
示例19: shouldContinueTraversal
/** Return true if the node should be traversed, and false if the bounding sphere
of the node is small enough to be rendered by one Camera. If the latter
is true, then store the node's near & far plane distances. */
bool CURRENT_CLASS::shouldContinueTraversal(osg::Node &node)
{
// Allow traversal to continue if we haven't reached maximum depth.
bool keepTraversing = (_currentDepth < _maxDepth);
const osg::BoundingSphere &bs = node.getBound();
double zNear = 0.0, zFar = 0.0;
// Make sure bounding sphere is valid and within viewing volume
if(bs.valid())
{
if(!_localFrusta.back().contains(bs)) keepTraversing = false;
else
{
// Compute near and far planes for this node
zNear = distance(bs._center, _viewMatrices.back());
zFar = zNear + bs._radius;
zNear -= bs._radius;
// If near/far ratio is big enough, then we don't need to keep
// traversing children of this node.
if(zNear >= zFar*_nearFarRatio) keepTraversing = false;
}
}
// If traversal should stop, then store this node's (near,far) pair
if(!keepTraversing) pushDistancePair(zNear, zFar);
return keepTraversing;
}
开发者ID:joevandyk,项目名称:osg,代码行数:33,代码来源:DistanceAccumulator.cpp
示例20:
void CVRCullVisitor::PreCullVisitor::apply(osg::Node& node)
{
if(node.getNodeMask() & FIRST_CULL_STATUS)
{
_setMask = true;
}
}
开发者ID:megasha,项目名称:calvr,代码行数:7,代码来源:CVRCullVisitor.cpp
注:本文中的osg::Node类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论