Made osg::Quat support either float or double internal representation, defaulting to double.

Generalised the osgDB::Field so that its getFloat() method can be used with either doubles or
floats governed by the type passed in - this helps support either float/double
Quat and Matrix classes seemlessly.
This commit is contained in:
Robert Osfield
2003-09-29 13:35:02 +00:00
parent 7d69f8e193
commit e693f148cb
10 changed files with 173 additions and 165 deletions

View File

@@ -46,10 +46,10 @@ bool ClipPlane_readLocalData(Object& obj, Input& fr)
if (fr.matchSequence("plane %f %f %f %f"))
{
double plane[4];
fr[1].getDouble(plane[0]);
fr[2].getDouble(plane[1]);
fr[3].getDouble(plane[2]);
fr[4].getDouble(plane[3]);
fr[1].getFloat(plane[0]);
fr[2].getFloat(plane[1]);
fr[3].getFloat(plane[2]);
fr[4].getFloat(plane[3]);
clipplane.setClipPlane(plane);
fr+=5;

View File

@@ -48,7 +48,7 @@ bool DOFTransform_readLocalData(Object& obj, Input& fr)
{
for(int j=0;j<4;++j)
{
fr[k].getDouble(v);
fr[k].getFloat(v);
matrix(i,j)=v;
k++;
}

View File

@@ -57,7 +57,7 @@ bool Depth_readLocalData(Object& obj, Input& fr)
}
double znear,zfar;
if (fr[0].matchWord("range") && fr[1].getDouble(znear) && fr[2].getDouble(zfar))
if (fr[0].matchWord("range") && fr[1].getFloat(znear) && fr[2].getFloat(zfar))
{
depth.setRange(znear,zfar);
fr+=2;

View File

@@ -16,7 +16,7 @@ bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr)
double v;
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
if (fr[0].getDouble(v))
if (fr[0].getFloat(v))
{
matrix(row,col)=v;
++col;

View File

@@ -44,7 +44,7 @@ bool TexMat_readLocalData(Object& obj, Input& fr)
{
for(int j=0;j<4;++j)
{
fr[k].getDouble(v);
fr[k].getFloat(v);
matrix(i,j)=v;
k++;
}

View File

@@ -31,7 +31,7 @@ bool BlinkSequence_readLocalData(osg::Object &obj, osgDB::Input &fr)
if (fr.matchSequence("phaseShift %f"))
{
double ps;
fr[1].getDouble(ps);
fr[1].getFloat(ps);
fr += 2;
seq.setPhaseShift(ps);
iteratorAdvanced = true;
@@ -40,7 +40,7 @@ bool BlinkSequence_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
double length;
float r, g, b, a;
fr[1].getDouble(length);
fr[1].getFloat(length);
fr[2].getFloat(r);
fr[3].getFloat(g);
fr[4].getFloat(b);
@@ -103,7 +103,7 @@ bool BlinkSequence_SequenceGroup_readLocalData(osg::Object &obj, osgDB::Input &f
if (fr.matchSequence("baseTime %f"))
{
fr[1].getDouble(sg._baseTime);
fr[1].getFloat(sg._baseTime);
fr += 2;
iteratorAdvanced = true;
}