Further work on osg::CameraNode support.
This commit is contained in:
parent
fb2d3ae108
commit
40ef0bbdff
@ -1,5 +1,6 @@
|
|||||||
#include <osg/CameraNode>
|
#include <osg/CameraNode>
|
||||||
#include <osg/io_utils>
|
#include <osg/io_utils>
|
||||||
|
#include <osg/Notify>
|
||||||
|
|
||||||
#include <osgDB/Registry>
|
#include <osgDB/Registry>
|
||||||
#include <osgDB/Input>
|
#include <osgDB/Input>
|
||||||
@ -64,6 +65,15 @@ bool CameraNode_readLocalData(Object& obj, Input& fr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fr.matchSequence("transformOrder %w"))
|
||||||
|
{
|
||||||
|
if (fr[1].matchWord("PRE_MULTIPLE")) camera.setTransformOrder(osg::CameraNode::PRE_MULTIPLE);
|
||||||
|
else if (fr[1].matchWord("POST_MULTIPLE")) camera.setTransformOrder(osg::CameraNode::POST_MULTIPLE);
|
||||||
|
|
||||||
|
fr += 2;
|
||||||
|
iteratorAdvanced = true;
|
||||||
|
}
|
||||||
|
|
||||||
Matrix matrix;
|
Matrix matrix;
|
||||||
if (readMatrix(matrix,fr,"ProjectionMatrix"))
|
if (readMatrix(matrix,fr,"ProjectionMatrix"))
|
||||||
{
|
{
|
||||||
@ -77,6 +87,16 @@ bool CameraNode_readLocalData(Object& obj, Input& fr)
|
|||||||
iteratorAdvanced = true;
|
iteratorAdvanced = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fr.matchSequence("renderOrder %w"))
|
||||||
|
{
|
||||||
|
if (fr[1].matchWord("PRE_RENDER")) camera.setRenderOrder(osg::CameraNode::PRE_RENDER);
|
||||||
|
else if (fr[1].matchWord("NESTED_RENDER")) camera.setRenderOrder(osg::CameraNode::NESTED_RENDER);
|
||||||
|
else if (fr[1].matchWord("POST_RENDER")) camera.setRenderOrder(osg::CameraNode::POST_RENDER);
|
||||||
|
|
||||||
|
fr += 2;
|
||||||
|
iteratorAdvanced = true;
|
||||||
|
}
|
||||||
|
|
||||||
return iteratorAdvanced;
|
return iteratorAdvanced;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,8 +118,23 @@ bool CameraNode_writeLocalData(const Object& obj, Output& fw)
|
|||||||
fw.writeObject(*camera.getViewport());
|
fw.writeObject(*camera.getViewport());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fw.indent()<<"transformOrder ";
|
||||||
|
switch(camera.getTransformOrder())
|
||||||
|
{
|
||||||
|
case(osg::CameraNode::PRE_MULTIPLE): fw <<"PRE_MULTIPLE"<<std::endl; break;
|
||||||
|
case(osg::CameraNode::POST_MULTIPLE): fw <<"POST_MULTIPLE"<<std::endl; break;
|
||||||
|
}
|
||||||
|
|
||||||
writeMatrix(camera.getProjectionMatrix(),fw,"ProjectionMatrix");
|
writeMatrix(camera.getProjectionMatrix(),fw,"ProjectionMatrix");
|
||||||
writeMatrix(camera.getViewMatrix(),fw,"ViewMatrix");
|
writeMatrix(camera.getViewMatrix(),fw,"ViewMatrix");
|
||||||
|
|
||||||
|
fw.indent()<<"renderOrder ";
|
||||||
|
switch(camera.getRenderOrder())
|
||||||
|
{
|
||||||
|
case(osg::CameraNode::PRE_RENDER): fw <<"PRE_RENDER"<<std::endl; break;
|
||||||
|
case(osg::CameraNode::NESTED_RENDER): fw <<"NESTED_RENDER"<<std::endl; break;
|
||||||
|
case(osg::CameraNode::POST_RENDER): fw <<"POST_RENDER"<<std::endl; break;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
#include "Matrix.h"
|
#include "Matrix.h"
|
||||||
|
#include <osg/Notify>
|
||||||
|
|
||||||
|
|
||||||
bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr, const char* keyword)
|
bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr, const char* keyword)
|
||||||
{
|
{
|
||||||
bool iteratorAdvanced = false;
|
bool iteratorAdvanced = false;
|
||||||
|
|
||||||
if (fr[0].matchWord(keyword) && fr[1].matchWord("{"))
|
if (fr[0].matchWord(keyword) && fr[1].isOpenBracket())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
osg::notify(osg::NOTICE)<<"found keyword "<<fr[0].getStr()<<" looking for "<<keyword<<std::endl;
|
||||||
|
|
||||||
int entry = fr[0].getNoNestedBrackets();
|
int entry = fr[0].getNoNestedBrackets();
|
||||||
|
|
||||||
fr += 2;
|
fr += 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user