From Michael Platings, "Here's the all-new, all-dancing DAE plugin, with support for reading
osgAnimation. It's been tested with the majority of the samples in the COLLADA test repository and works with all of them either as well as, or better than, the version of the plugin currently in SVN. Known issue: vertex animation (AKA morphing) doesn't work at present, but that's a relatively unpopular method of animating so it's not high on my priority list." Follow up email: "I've been informed that the previous DAE submission didn't build on unix, so here's the submission again with the fixes. Thanks to Gregory Potdevin and Benjamin Bozou. Also, my apologies to Roland for not crediting his part in making DAE animation happen, my work was indeed built on top of his work. Thanks also to Marius Heise and of course Cedric Pinson." Changes by Robert Osfield, fixed compile issues when compile without C* automatic conversion enabled in ref_ptr<> and constructor initialization fixes to address some warnings under gcc.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <osg/Vec2b>
|
||||
#include <osg/Vec3b>
|
||||
#include <osg/Vec4b>
|
||||
#include <osg/Matrix>
|
||||
|
||||
#include <osg/BufferObject>
|
||||
|
||||
@@ -71,7 +72,8 @@ class OSG_EXPORT Array : public BufferData
|
||||
DoubleArrayType = 18,
|
||||
Vec2dArrayType = 19,
|
||||
Vec3dArrayType = 20,
|
||||
Vec4dArrayType = 21
|
||||
Vec4dArrayType = 21,
|
||||
MatrixArrayType = 22
|
||||
};
|
||||
|
||||
Array(Type arrayType=ArrayType,GLint dataSize=0,GLenum dataType=0):
|
||||
@@ -309,6 +311,8 @@ typedef TemplateArray<Vec2d,Array::Vec2dArrayType,2,GL_DOUBLE>
|
||||
typedef TemplateArray<Vec3d,Array::Vec3dArrayType,3,GL_DOUBLE> Vec3dArray;
|
||||
typedef TemplateArray<Vec4d,Array::Vec4dArrayType,4,GL_DOUBLE> Vec4dArray;
|
||||
|
||||
typedef TemplateArray<Matrixf,Array::MatrixArrayType,16,GL_FLOAT> MatrixfArray;
|
||||
|
||||
|
||||
class ArrayVisitor
|
||||
{
|
||||
@@ -343,6 +347,8 @@ class ArrayVisitor
|
||||
virtual void apply(Vec2dArray&) {}
|
||||
virtual void apply(Vec3dArray&) {}
|
||||
virtual void apply(Vec4dArray&) {}
|
||||
|
||||
virtual void apply(MatrixfArray&) {}
|
||||
};
|
||||
|
||||
class ConstArrayVisitor
|
||||
@@ -378,6 +384,8 @@ class ConstArrayVisitor
|
||||
virtual void apply(const Vec2dArray&) {}
|
||||
virtual void apply(const Vec3dArray&) {}
|
||||
virtual void apply(const Vec4dArray&) {}
|
||||
|
||||
virtual void apply(const MatrixfArray&) {}
|
||||
};
|
||||
|
||||
|
||||
@@ -414,6 +422,8 @@ class ValueVisitor
|
||||
virtual void apply(Vec2d&) {}
|
||||
virtual void apply(Vec3d&) {}
|
||||
virtual void apply(Vec4d&) {}
|
||||
|
||||
virtual void apply(Matrixf&) {}
|
||||
};
|
||||
|
||||
class ConstValueVisitor
|
||||
@@ -448,6 +458,8 @@ class ConstValueVisitor
|
||||
virtual void apply(const Vec2d&) {}
|
||||
virtual void apply(const Vec3d&) {}
|
||||
virtual void apply(const Vec4d&) {}
|
||||
|
||||
virtual void apply(const Matrixf&) {}
|
||||
};
|
||||
|
||||
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
||||
|
||||
@@ -383,6 +383,116 @@ class OSG_EXPORT Matrixf
|
||||
return r;
|
||||
}
|
||||
|
||||
/** Multiply by scalar. */
|
||||
inline Matrixf operator * (value_type rhs) const
|
||||
{
|
||||
return Matrixf(
|
||||
_mat[0][0]*rhs, _mat[0][1]*rhs, _mat[0][2]*rhs, _mat[0][3]*rhs,
|
||||
_mat[1][0]*rhs, _mat[1][1]*rhs, _mat[1][2]*rhs, _mat[1][3]*rhs,
|
||||
_mat[2][0]*rhs, _mat[2][1]*rhs, _mat[2][2]*rhs, _mat[2][3]*rhs,
|
||||
_mat[3][0]*rhs, _mat[3][1]*rhs, _mat[3][2]*rhs, _mat[3][3]*rhs);
|
||||
}
|
||||
|
||||
/** Unary multiply by scalar. */
|
||||
inline Matrixf& operator *= (value_type rhs)
|
||||
{
|
||||
_mat[0][0]*=rhs;
|
||||
_mat[0][1]*=rhs;
|
||||
_mat[0][2]*=rhs;
|
||||
_mat[0][3]*=rhs;
|
||||
_mat[1][0]*=rhs;
|
||||
_mat[1][1]*=rhs;
|
||||
_mat[1][2]*=rhs;
|
||||
_mat[1][3]*=rhs;
|
||||
_mat[2][0]*=rhs;
|
||||
_mat[2][1]*=rhs;
|
||||
_mat[2][2]*=rhs;
|
||||
_mat[2][3]*=rhs;
|
||||
_mat[3][0]*=rhs;
|
||||
_mat[3][1]*=rhs;
|
||||
_mat[3][2]*=rhs;
|
||||
_mat[3][3]*=rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Divide by scalar. */
|
||||
inline Matrixf operator / (value_type rhs) const
|
||||
{
|
||||
return Matrixf(
|
||||
_mat[0][0]/rhs, _mat[0][1]/rhs, _mat[0][2]/rhs, _mat[0][3]/rhs,
|
||||
_mat[1][0]/rhs, _mat[1][1]/rhs, _mat[1][2]/rhs, _mat[1][3]/rhs,
|
||||
_mat[2][0]/rhs, _mat[2][1]/rhs, _mat[2][2]/rhs, _mat[2][3]/rhs,
|
||||
_mat[3][0]/rhs, _mat[3][1]/rhs, _mat[3][2]/rhs, _mat[3][3]/rhs);
|
||||
}
|
||||
|
||||
/** Unary divide by scalar. */
|
||||
inline Matrixf& operator /= (value_type rhs)
|
||||
{
|
||||
_mat[0][0]/=rhs;
|
||||
_mat[0][1]/=rhs;
|
||||
_mat[0][2]/=rhs;
|
||||
_mat[0][3]/=rhs;
|
||||
_mat[1][0]/=rhs;
|
||||
_mat[1][1]/=rhs;
|
||||
_mat[1][2]/=rhs;
|
||||
_mat[1][3]/=rhs;
|
||||
_mat[2][0]/=rhs;
|
||||
_mat[2][1]/=rhs;
|
||||
_mat[2][2]/=rhs;
|
||||
_mat[2][3]/=rhs;
|
||||
_mat[3][0]/=rhs;
|
||||
_mat[3][1]/=rhs;
|
||||
_mat[3][2]/=rhs;
|
||||
_mat[3][3]/=rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Binary vector add. */
|
||||
inline Matrixf operator + (const Matrixf& rhs) const
|
||||
{
|
||||
return Matrixf(
|
||||
_mat[0][0] + rhs._mat[0][0],
|
||||
_mat[0][1] + rhs._mat[0][1],
|
||||
_mat[0][2] + rhs._mat[0][2],
|
||||
_mat[0][3] + rhs._mat[0][3],
|
||||
_mat[1][0] + rhs._mat[1][0],
|
||||
_mat[1][1] + rhs._mat[1][1],
|
||||
_mat[1][2] + rhs._mat[1][2],
|
||||
_mat[1][3] + rhs._mat[1][3],
|
||||
_mat[2][0] + rhs._mat[2][0],
|
||||
_mat[2][1] + rhs._mat[2][1],
|
||||
_mat[2][2] + rhs._mat[2][2],
|
||||
_mat[2][3] + rhs._mat[2][3],
|
||||
_mat[3][0] + rhs._mat[3][0],
|
||||
_mat[3][1] + rhs._mat[3][1],
|
||||
_mat[3][2] + rhs._mat[3][2],
|
||||
_mat[3][3] + rhs._mat[3][3]);
|
||||
}
|
||||
|
||||
/** Unary vector add. Slightly more efficient because no temporary
|
||||
* intermediate object.
|
||||
*/
|
||||
inline Matrixf& operator += (const Matrixf& rhs)
|
||||
{
|
||||
_mat[0][0] += rhs._mat[0][0];
|
||||
_mat[0][1] += rhs._mat[0][1];
|
||||
_mat[0][2] += rhs._mat[0][2];
|
||||
_mat[0][3] += rhs._mat[0][3];
|
||||
_mat[1][0] += rhs._mat[1][0];
|
||||
_mat[1][1] += rhs._mat[1][1];
|
||||
_mat[1][2] += rhs._mat[1][2];
|
||||
_mat[1][3] += rhs._mat[1][3];
|
||||
_mat[2][0] += rhs._mat[2][0];
|
||||
_mat[2][1] += rhs._mat[2][1];
|
||||
_mat[2][2] += rhs._mat[2][2];
|
||||
_mat[2][3] += rhs._mat[2][3];
|
||||
_mat[3][0] += rhs._mat[3][0];
|
||||
_mat[3][1] += rhs._mat[3][1];
|
||||
_mat[3][2] += rhs._mat[3][2];
|
||||
_mat[3][3] += rhs._mat[3][3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
protected:
|
||||
value_type _mat[4][4];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user