Added support for ReferenceFrame into osg::LightSource, modified the .osg
plugin and cull visitor to account for this change.
This commit is contained in:
@@ -27,6 +27,19 @@ bool LightSource_readLocalData(Object& obj, Input& fr)
|
||||
|
||||
LightSource& lightsource = static_cast<LightSource&>(obj);
|
||||
|
||||
if (fr[0].matchWord("referenceFrame")) {
|
||||
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE")) {
|
||||
lightsource.setReferenceFrame(LightSource::RELATIVE_TO_ABSOLUTE);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr[1].matchWord("RELATIVE_TO_PARENTS")) {
|
||||
lightsource.setReferenceFrame(LightSource::RELATIVE_TO_PARENTS);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
StateAttribute* light=fr.readStateAttribute();
|
||||
if (light)
|
||||
{
|
||||
@@ -42,6 +55,16 @@ bool LightSource_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const LightSource& lightsource = static_cast<const LightSource&>(obj);
|
||||
|
||||
fw.indent() << "referenceFrame ";
|
||||
switch (lightsource.getReferenceFrame()) {
|
||||
case LightSource::RELATIVE_TO_ABSOLUTE:
|
||||
fw << "RELATIVE_TO_ABSOLUTE\n";
|
||||
break;
|
||||
case LightSource::RELATIVE_TO_PARENTS:
|
||||
default:
|
||||
fw << "RELATIVE_TO_PARENTS\n";
|
||||
};
|
||||
|
||||
if (lightsource.getLight()) fw.writeObject(*lightsource.getLight());
|
||||
|
||||
return true;
|
||||
|
||||
@@ -17,25 +17,35 @@ RegisterDotOsgWrapperProxy g_ShapeDrawableFuncProxy
|
||||
new osg::ShapeDrawable,
|
||||
"ShapeDrawable",
|
||||
"Object Drawable ShapeDrawable",
|
||||
&ShapeDrawable_readLocalData,
|
||||
&ShapeDrawable_writeLocalData,
|
||||
0,
|
||||
0,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool ShapeDrawable_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
ShapeDrawable& geom = static_cast<ShapeDrawable&>(obj);
|
||||
|
||||
bool matchedFirst = false;
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool ShapeDrawable_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const ShapeDrawable& geom = static_cast<const ShapeDrawable&>(obj);
|
||||
|
||||
return true;
|
||||
}
|
||||
// RegisterDotOsgWrapperProxy g_ShapeDrawableFuncProxy
|
||||
// (
|
||||
// new osg::ShapeDrawable,
|
||||
// "ShapeDrawable",
|
||||
// "Object Drawable ShapeDrawable",
|
||||
// &ShapeDrawable_readLocalData,
|
||||
// &ShapeDrawable_writeLocalData,
|
||||
// DotOsgWrapper::READ_AND_WRITE
|
||||
// );
|
||||
//
|
||||
// bool ShapeDrawable_readLocalData(Object& obj, Input& fr)
|
||||
// {
|
||||
// bool iteratorAdvanced = false;
|
||||
//
|
||||
// ShapeDrawable& geom = static_cast<ShapeDrawable&>(obj);
|
||||
//
|
||||
// bool matchedFirst = false;
|
||||
//
|
||||
// return iteratorAdvanced;
|
||||
// }
|
||||
//
|
||||
// bool ShapeDrawable_writeLocalData(const Object& obj, Output& fw)
|
||||
// {
|
||||
// const ShapeDrawable& geom = static_cast<const ShapeDrawable&>(obj);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user