⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 group.cpp

📁 最新osg包
💻 CPP
字号:
#include "osg/Group"#include "osgDB/Registry"#include "osgDB/Input"#include "osgDB/Output"using namespace osg;using namespace osgDB;// forward declare functions to use later.bool Group_readLocalData(Object& obj, Input& fr);bool Group_writeLocalData(const Object& obj, Output& fw);// register the read and write functions with the osgDB::Registry.RegisterDotOsgWrapperProxy g_GroupProxy(    new osg::Group,    "Group",    "Object Node Group",    &Group_readLocalData,    &Group_writeLocalData);bool Group_readLocalData(Object& obj, Input& fr){    bool iteratorAdvanced = false;    Group& group = static_cast<Group&>(obj);    int num_children;    if (fr[0].matchWord("num_children") &&        fr[1].getInt(num_children))    {        // could allocate space for children here...        fr+=2;        iteratorAdvanced = true;    }    Node* node = NULL;    while((node=fr.readNode())!=NULL)    {        group.addChild(node);        iteratorAdvanced = true;    }    return iteratorAdvanced;}bool Group_writeLocalData(const Object& obj, Output& fw){    const Group& group = static_cast<const Group&>(obj);    if (group.getNumChildren()!=0) fw.indent() << "num_children " << group.getNumChildren() << std::endl;    for(unsigned int i=0;i<group.getNumChildren();++i)    {        fw.writeObject(*group.getChild(i));    }    return true;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -