linestipple.cpp

来自「最新osg包」· C++ 代码 · 共 62 行

CPP
62
字号
#include <osg/LineStipple>#include <osgDB/Registry>#include <osgDB/Input>#include <osgDB/Output>using namespace osg;using namespace osgDB;using namespace std;// forward declare functions to use later.bool LineStipple_readLocalData(Object& obj, Input& fr);bool LineStipple_writeLocalData(const Object& obj, Output& fw);// register the read and write functions with the osgDB::Registry.RegisterDotOsgWrapperProxy g_LineStippleProxy(    new osg::LineStipple,    "LineStipple",    "Object StateAttribute LineStipple",    &LineStipple_readLocalData,    &LineStipple_writeLocalData);bool LineStipple_readLocalData(Object& obj, Input& fr){    bool iteratorAdvanced = false;    LineStipple& linestipple = static_cast<LineStipple&>(obj);        int ref = linestipple.getFactor();    if (fr[0].matchWord("factor") && fr[1].getInt(ref))    {        linestipple.setFactor(ref);        fr+=2;        iteratorAdvanced = true;    }    unsigned int mask = linestipple.getPattern();    if (fr[0].matchWord("pattern") && fr[1].getUInt(mask))    {        linestipple.setPattern(mask);        fr+=2;        iteratorAdvanced = true;    }    return iteratorAdvanced;}bool LineStipple_writeLocalData(const Object& obj,Output& fw){    const LineStipple& linestipple = static_cast<const LineStipple&>(obj);    fw.indent() << "factor " << linestipple.getFactor() << std::endl;    fw.indent() << "pattern 0x" << hex << linestipple.getPattern() << dec << std::endl;    return true;}

⌨️ 快捷键说明

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