Improved support for new double Vec* classes
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
#include <osg/Vec2f>
|
||||
#include <osg/Vec2f>
|
||||
#include <osg/Vec4f>
|
||||
#include <osg/Vec2d>
|
||||
#include <osg/Vec2d>
|
||||
#include <osg/Vec4d>
|
||||
|
||||
#include <osgDB/Field>
|
||||
#include <osgDB/FieldReader>
|
||||
@@ -69,6 +72,9 @@ class OSGDB_EXPORT FieldReaderIterator
|
||||
bool readSequence(const char* keyword,osg::Vec2f& value);
|
||||
bool readSequence(const char* keyword,osg::Vec3f& value);
|
||||
bool readSequence(const char* keyword,osg::Vec4f& value);
|
||||
bool readSequence(const char* keyword,osg::Vec2d& value);
|
||||
bool readSequence(const char* keyword,osg::Vec3d& value);
|
||||
bool readSequence(const char* keyword,osg::Vec4d& value);
|
||||
|
||||
bool readSequence(std::string& value);
|
||||
bool readSequence(unsigned int& value);
|
||||
@@ -77,6 +83,9 @@ class OSGDB_EXPORT FieldReaderIterator
|
||||
bool readSequence(osg::Vec2f& value);
|
||||
bool readSequence(osg::Vec3f& value);
|
||||
bool readSequence(osg::Vec4f& value);
|
||||
bool readSequence(osg::Vec2d& value);
|
||||
bool readSequence(osg::Vec3d& value);
|
||||
bool readSequence(osg::Vec4d& value);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -472,6 +472,45 @@ bool FieldReaderIterator::readSequence(const char* keyword,osg::Vec4f& value)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FieldReaderIterator::readSequence(const char* keyword,osg::Vec2d& value)
|
||||
{
|
||||
if ((*this)[0].matchWord(keyword) &&
|
||||
(*this)[1].getFloat(value[0]) &&
|
||||
(*this)[2].getFloat(value[1]))
|
||||
{
|
||||
(*this)+=3;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FieldReaderIterator::readSequence(const char* keyword,osg::Vec3d& value)
|
||||
{
|
||||
if ((*this)[0].matchWord(keyword) &&
|
||||
(*this)[1].getFloat(value[0]) &&
|
||||
(*this)[2].getFloat(value[1]) &&
|
||||
(*this)[3].getFloat(value[2]))
|
||||
{
|
||||
(*this)+=4;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FieldReaderIterator::readSequence(const char* keyword,osg::Vec4d& value)
|
||||
{
|
||||
if ((*this)[0].matchWord(keyword) &&
|
||||
(*this)[1].getFloat(value[0]) &&
|
||||
(*this)[2].getFloat(value[1]) &&
|
||||
(*this)[3].getFloat(value[2]) &&
|
||||
(*this)[4].getFloat(value[3]))
|
||||
{
|
||||
(*this)+=5;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FieldReaderIterator::readSequence(std::string& value)
|
||||
{
|
||||
if ((*this)[0].isString())
|
||||
@@ -550,3 +589,38 @@ bool FieldReaderIterator::readSequence(osg::Vec4f& value)
|
||||
}
|
||||
|
||||
|
||||
bool FieldReaderIterator::readSequence(osg::Vec2d& value)
|
||||
{
|
||||
if ((*this)[0].getFloat(value[0]) &&
|
||||
(*this)[1].getFloat(value[1]))
|
||||
{
|
||||
(*this)+=2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FieldReaderIterator::readSequence(osg::Vec3d& value)
|
||||
{
|
||||
if ((*this)[0].getFloat(value[0]) &&
|
||||
(*this)[1].getFloat(value[1]) &&
|
||||
(*this)[2].getFloat(value[2]))
|
||||
{
|
||||
(*this)+=3;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FieldReaderIterator::readSequence(osg::Vec4d& value)
|
||||
{
|
||||
if ((*this)[0].getFloat(value[0]) &&
|
||||
(*this)[1].getFloat(value[1]) &&
|
||||
(*this)[2].getFloat(value[2]) &&
|
||||
(*this)[3].getFloat(value[3]))
|
||||
{
|
||||
(*this)+=4;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ bool PositionAttitudeTransform_readLocalData(Object& obj, Input& fr)
|
||||
|
||||
if (fr.matchSequence("position %f %f %f"))
|
||||
{
|
||||
osg::Vec3 pos;
|
||||
osg::Vec3d pos;
|
||||
fr[1].getFloat(pos[0]);
|
||||
fr[2].getFloat(pos[1]);
|
||||
fr[3].getFloat(pos[2]);
|
||||
@@ -57,7 +57,7 @@ bool PositionAttitudeTransform_readLocalData(Object& obj, Input& fr)
|
||||
|
||||
if (fr.matchSequence("scale %f %f %f"))
|
||||
{
|
||||
osg::Vec3 scale;
|
||||
osg::Vec3d scale;
|
||||
fr[1].getFloat(scale[0]);
|
||||
fr[2].getFloat(scale[1]);
|
||||
fr[3].getFloat(scale[2]);
|
||||
@@ -70,7 +70,7 @@ bool PositionAttitudeTransform_readLocalData(Object& obj, Input& fr)
|
||||
|
||||
if (fr.matchSequence("pivotPoint %f %f %f"))
|
||||
{
|
||||
osg::Vec3 pivot;
|
||||
osg::Vec3d pivot;
|
||||
fr[1].getFloat(pivot[0]);
|
||||
fr[2].getFloat(pivot[1]);
|
||||
fr[3].getFloat(pivot[2]);
|
||||
|
||||
Reference in New Issue
Block a user