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:
@@ -360,34 +360,12 @@ bool Field::getFloat(float& f) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Field::isDouble() const
|
||||
{
|
||||
getFieldType();
|
||||
return _fieldType==REAL || _fieldType==INTEGER;
|
||||
}
|
||||
|
||||
|
||||
bool Field::matchDouble(double d) const
|
||||
bool Field::getFloat(double& f) const
|
||||
{
|
||||
getFieldType();
|
||||
if (_fieldType==REAL || _fieldType==INTEGER)
|
||||
{
|
||||
return atof(_fieldCache)==d;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Field::getDouble(double& d) const
|
||||
{
|
||||
getFieldType();
|
||||
if (_fieldType==REAL || _fieldType==INTEGER)
|
||||
{
|
||||
d = atof(_fieldCache);
|
||||
f = (float)atof(_fieldCache);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user