本文整理汇总了C++中osg::Node::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::getName方法的具体用法?C++ Node::getName怎么用?C++ Node::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Node
的用法示例。
在下文中一共展示了Node::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nap
void
FindNamedNode::apply( osg::Node& node )
{
bool match = (
( ( _method == EXACT_MATCH ) &&
( node.getName() == _name ) ) ||
( ( _method == CONTAINS ) &&
( node.getName().find( _name ) != std::string::npos ) ) );
if( match )
{
// Copy the NodePath, so we can alter it if necessary.
osg::NodePath np = getNodePath();
if( !_includeTargetNode )
// Calling code has requested that the target node
// be removed from the node paths.
np.pop_back();
NodeAndPath nap( &node, np );
_napl.push_back( nap );
}
traverse( node );
}
示例2: getUniqueName
void WriterNodeVisitor::apply3DSMatrixNode(osg::Node &node, const osg::Matrix * m, const char * const prefix)
{
// Note: Creating a mesh instance with no transform and then copying the matrix doesn't work (matrix seems to be a temporary/computed value)
Lib3dsMeshInstanceNode * parent = _cur3dsNode;
Lib3dsMeshInstanceNode * node3ds = NULL;
if (m)
{
osg::Vec3 osgScl, osgPos;
osg::Quat osgRot, osgSo;
m->decompose(osgPos, osgRot, osgScl, osgSo);
float pos[3];
float scl[3];
float rot[4];
copyOsgVectorToLib3dsVector(pos, osgPos);
copyOsgVectorToLib3dsVector(scl, osgScl);
copyOsgQuatToLib3dsQuat(rot, osgRot);
node3ds = lib3ds_node_new_mesh_instance(NULL, getUniqueName(node.getName().empty() ? node.className() : node.getName(), true, prefix).c_str(), pos, scl, rot);
}
else
{
node3ds = lib3ds_node_new_mesh_instance(NULL, getUniqueName(node.getName().empty() ? node.className() : node.getName(), true, prefix).c_str(), NULL, NULL, NULL);
}
lib3ds_file_append_node(_file3ds, reinterpret_cast<Lib3dsNode*>(node3ds), reinterpret_cast<Lib3dsNode*>(parent));
_cur3dsNode = node3ds;
}
示例3: apply
void apply( osg::Node& node )
{
if ( !node.getName().empty() )
{
output() << node.getName() << std::endl;
enter();
traverse( node );
leave();
}
else osgUtil::PrintVisitor::apply(node);
}
示例4: 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;
}
示例5: 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");
}
示例6: 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;
}
}
}
示例7: writePop
bool
FltExportVisitor::complete( const osg::Node& node )
{
// Always write final pop level
writePop();
// Done writing records, close the record data temp file.
_recordsStr.close();
// Write OpenFlight file front matter: header, vertex palette, etc.
writeHeader( node.getName() );
writeColorPalette();
_materialPalette->write( _dos );
_texturePalette->write( _dos );
_lightSourcePalette->write( _dos );
_vertexPalette->write( _dos );
// Write Comment ancillary record and specify the _dos DataOutputStream.
writeComment( node, &_dos );
// Copy record data temp file into final OpenFlight file.
// Yee-uck. TBD need better stream copy routine.
char buf;
std::ifstream recIn;
recIn.open( _recordsTempName.c_str(), std::ios::in | std::ios::binary );
while (!recIn.eof() )
{
recIn.read( &buf, 1 );
if (recIn.good())
_dos << buf;
}
recIn.close();
return true;
}
示例8: apply
virtual void apply (osg::Node& node) {
if (node.getName() == m_NameToFind) {
m_FoundNode = &node;
} else {
traverse(node);
}
}
示例9: apply
void FindNode::apply(osg::Node &node)
{
if(node.getName() == name)
this->node = &node;
else
traverse(node);
}
示例10: apply
virtual void apply(osg::Node& node)
{
if (m_name == node.getName()) {
m_found = & node;
return;
}
traverse (node);
}
示例11: apply
virtual void apply(osg::Node& node)
{
if (node.getName()==_name)
{
_foundNodes.push_back(&node);
}
traverse(node);
}
示例12: apply
// This method gets called for every node in the scene
// graph. Check each node to see if its name matches
// out target. If so, save the node's address.
virtual void apply( osg::Node& node )
{
if (node.getName() == _name)
_node = &node;
// Keep traversing the rest of the scene graph.
traverse( node );
}
示例13: apply
// This method gets called for every node in the scene
// graph. Check each node to see if its name matches
// out target. If so, save the node's address.
virtual void apply( osg::Node& node )
{
if (node.getName() == _name)
foundNodeList.push_back(&node);
// Keep traversing the rest of the scene graph.
traverse( node );
}
示例14: apply
void FindNode::apply( osg::Node& node )
{
if (m_strName.compare(node.getName()) == 0)
{
m_pNode = &node;
return;
}
traverse(node);
}
示例15: setRootNode
void daeWriter::setRootNode(const osg::Node &node)
{
std::string fname = osgDB::findDataFile(node.getName());
// create Asset with root node providing meta data
createAssetTag(node);
const_cast<osg::Node*>(&node)->accept(_animatedNodeCollector);
}