From Corbin Holtz, "I have completed my mods to the OpenFlight loader (modified files are

attached):
   * Light point strings using the REPLICATE opcode should now be supported
(>=15.6?)

   * Directional lights should now work as in Performer using a viewing
frustrum defined by a direction vector, horizontal angular width, vertical
angular width, and roll angle about the direction vector.  The current
directional light implementation had some bad assumptions which caused
problems with direction vectors not on the XY plane.

   * IVE and OSG reader/writers were updated as appropriate"
This commit is contained in:
Robert Osfield
2004-05-08 22:18:38 +00:00
parent b6c1c44bd0
commit 86d323752d
15 changed files with 817 additions and 135 deletions

View File

@@ -221,3 +221,69 @@ bool ConeSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
return true;
}
/******************************************************************/
bool DirectionalSector_readLocalData(osg::Object &obj, osgDB::Input &fr);
bool DirectionalSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
osgDB::RegisterDotOsgWrapperProxy DirectionalSector_Proxy
(
new osgSim::DirectionalSector,
"DirectionalSector",
"Object DirectionalSector",
&DirectionalSector_readLocalData,
&DirectionalSector_writeLocalData,
osgDB::DotOsgWrapper::READ_AND_WRITE
);
bool DirectionalSector_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
bool iteratorAdvanced = false;
osgSim::DirectionalSector &sector = static_cast<osgSim::DirectionalSector &>(obj);
if (fr.matchSequence("direction %f %f %f"))
{
float x, y, z;
fr[1].getFloat(x);
fr[2].getFloat(y);
fr[3].getFloat(z);
fr += 4;
sector.setDirection(osg::Vec3(x, y, z));
iteratorAdvanced = true;
}
if (fr.matchSequence("angles %f %f %f %f"))
{
float horizangle;
float vertangle;
float rollangle;
float fadeangle;
fr[1].getFloat(horizangle);
fr[2].getFloat(vertangle);
fr[3].getFloat(rollangle);
fr[4].getFloat(fadeangle);
fr += 5;
sector.setHorizLobeAngle(horizangle);
sector.setVertLobeAngle(vertangle);
sector.setLobeRollAngle(rollangle);
sector.setFadeAngle(fadeangle);
iteratorAdvanced = true;
}
return iteratorAdvanced;
}
bool DirectionalSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
const osgSim::DirectionalSector &sector = static_cast<const osgSim::DirectionalSector &>(obj);
const osg::Vec3& axis = sector.getDirection();
fw.indent()<<"direction "<<axis<<std::endl;
float horizangle = sector.getHorizLobeAngle();
float vertangle = sector.getVertLobeAngle();
float rollangle = sector.getLobeRollAngle();
float fadeangle = sector.getFadeAngle();
fw.indent()<<"angles "<<horizangle<<" "<<vertangle<<" "<<rollangle<<" "<<fadeangle<<std::endl;
return true;
}