Added ClipNode::set/getReferenceFrame();

This commit is contained in:
Robert Osfield
2008-12-19 15:29:59 +00:00
parent f4fe462b28
commit 0ea6cdeb96
7 changed files with 100 additions and 6 deletions

View File

@@ -27,6 +27,22 @@ bool ClipNode_readLocalData(Object& obj, Input& fr)
ClipNode& clipnode = static_cast<ClipNode&>(obj);
if (fr[0].matchWord("referenceFrame"))
{
if (fr[1].matchWord("ABSOLUTE"))
{
clipnode.setReferenceFrame(ClipNode::ABSOLUTE_RF);
fr += 2;
iteratorAdvanced = true;
}
if (fr[1].matchWord("RELATIVE"))
{
clipnode.setReferenceFrame(ClipNode::RELATIVE_RF);
fr += 2;
iteratorAdvanced = true;
}
}
osg::ref_ptr<StateAttribute> sa=0;
while((sa=fr.readStateAttribute())!=0)
{
@@ -43,6 +59,17 @@ bool ClipNode_writeLocalData(const Object& obj, Output& fw)
{
const ClipNode& clipnode = static_cast<const ClipNode&>(obj);
fw.indent() << "referenceFrame ";
switch (clipnode.getReferenceFrame())
{
case ClipNode::ABSOLUTE_RF:
fw << "ABSOLUTE\n";
break;
case ClipNode::RELATIVE_RF:
default:
fw << "RELATIVE\n";
};
for(unsigned int i=0;i<clipnode.getNumClipPlanes();++i)
{
fw.writeObject(*clipnode.getClipPlane(i));