osg.ValueObject 是一个公共基类,用于存储任意类型的值。它允许用户在场景图中存储和传递值。
osg::ValueObject();
osg::ValueObject(const osg::ValueObject& vo, const osg::CopyOp& copyop);
默认构造函数
复制构造函数,复制其他ValueObject。
template<typename T>
void setValue(const T& value);
T getValue() const;
给ValueObject设置值
获取ValueObject中的值
void read(osg::Object& obj, osgDB::InputStream& is);
void write(osg::Object& obj, osgDB::OutputStream& os) const;
void read(osgDB::InputStream& is);
void write(osgDB::OutputStream& os) const;
osg::CopyOp::ObjectRenamer* getObjectNameMap() const;
void setObjectNameMap(osg::CopyOp::ObjectRenamer* objectNameMap);
CopyOp::ObjectRenamer
,它将用于复制时对名称进行映射。virtual osg::Object* cloneType() const;
virtual osg::Object* clone(const osg::CopyOp& copyop) const;
osg::ref_ptr<osg::ValueObject> myValueObject = new osg::ValueObject();
myValueObject->setValue("Hello World");
std::cout << myValueObject->getValue() << std::endl;