osgDB.ObjectMark是OpenSceneGraph (OSG)中的一个类,它用于标记存储在场景图中的对象的状态。这些状态可能是对象的位置、颜色、纹理等等。这个类能够方便地读取和写入对象标记,并将它们应用于场景图中的对象。
ObjectMark () - 构造函数。virtual ~ObjectMark () - 析构函数。void discardAllMarks () - 丢弃所有标记。void discardMark (const std::string &mark) - 丢弃指定的标记。bool getMark (const std::string &mark) const - 获取指定标记是否标记。void setMark (const std::string &mark, bool value = true) - 标记指定的标记。#include <osgDB/ObjectMark>
osg::ref_ptr<osgDB::ObjectMark> objectMark = new osgDB::ObjectMark();
// 标记对象的位置
objectMark->setMark("position");
// 判断位置是否标记
if (objectMark->getMark("position")) {
std::cout << "The position mark is set." << std::endl;
}
// 丢弃位置标记
objectMark->discardMark("position");
// 判断位置是否标记
if (!objectMark->getMark("position")) {
std::cout << "The position mark is not set." << std::endl;
}