2012-03-22 01:36:20 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2003-01-22 00:45:36 +08:00
|
|
|
*
|
2012-03-22 01:36:20 +08:00
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
2003-01-22 00:45:36 +08:00
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
2012-03-22 01:36:20 +08:00
|
|
|
*
|
2003-01-22 00:45:36 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2012-03-22 01:36:20 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2003-01-22 00:45:36 +08:00
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
2002-06-27 18:50:19 +08:00
|
|
|
|
|
|
|
#ifndef OSG_ARRAY
|
|
|
|
#define OSG_ARRAY 1
|
|
|
|
|
2008-06-20 04:38:38 +08:00
|
|
|
#include <osg/MixinVector>
|
2004-08-04 16:27:43 +08:00
|
|
|
|
2013-06-28 01:37:03 +08:00
|
|
|
#include <osg/Vec2b>
|
|
|
|
#include <osg/Vec3b>
|
|
|
|
#include <osg/Vec4b>
|
|
|
|
#include <osg/Vec2s>
|
|
|
|
#include <osg/Vec3s>
|
|
|
|
#include <osg/Vec4s>
|
|
|
|
#include <osg/Vec2i>
|
|
|
|
#include <osg/Vec3i>
|
|
|
|
#include <osg/Vec4i>
|
|
|
|
#include <osg/Vec2ub>
|
|
|
|
#include <osg/Vec3ub>
|
|
|
|
#include <osg/Vec4ub>
|
|
|
|
#include <osg/Vec2us>
|
|
|
|
#include <osg/Vec3us>
|
|
|
|
#include <osg/Vec4us>
|
|
|
|
#include <osg/Vec2ui>
|
|
|
|
#include <osg/Vec3ui>
|
|
|
|
#include <osg/Vec4ui>
|
2002-06-27 18:50:19 +08:00
|
|
|
#include <osg/Vec2>
|
|
|
|
#include <osg/Vec3>
|
|
|
|
#include <osg/Vec4>
|
2007-12-04 22:44:21 +08:00
|
|
|
#include <osg/Vec2d>
|
|
|
|
#include <osg/Vec3d>
|
|
|
|
#include <osg/Vec4d>
|
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.
2010-02-26 22:41:50 +08:00
|
|
|
#include <osg/Matrix>
|
2013-06-28 01:37:03 +08:00
|
|
|
#include <osg/Matrixd>
|
2016-07-01 23:04:09 +08:00
|
|
|
#include <osg/Quat>
|
2005-07-05 23:57:53 +08:00
|
|
|
|
2007-04-26 02:50:11 +08:00
|
|
|
#include <osg/BufferObject>
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2004-08-04 16:27:43 +08:00
|
|
|
#include <osg/Object>
|
|
|
|
#include <osg/GL>
|
2002-06-27 18:50:19 +08:00
|
|
|
|
|
|
|
namespace osg {
|
|
|
|
|
2002-07-16 06:18:47 +08:00
|
|
|
class ArrayVisitor;
|
2002-09-26 23:26:22 +08:00
|
|
|
class ConstArrayVisitor;
|
|
|
|
|
|
|
|
class ValueVisitor;
|
|
|
|
class ConstValueVisitor;
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2009-10-02 04:19:42 +08:00
|
|
|
class OSG_EXPORT Array : public BufferData
|
2002-06-27 18:50:19 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
enum Type
|
|
|
|
{
|
|
|
|
ArrayType = 0,
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
ByteArrayType = 1,
|
|
|
|
ShortArrayType = 2,
|
|
|
|
IntArrayType = 3,
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
UByteArrayType = 4,
|
|
|
|
UShortArrayType = 5,
|
|
|
|
UIntArrayType = 6,
|
2013-06-28 01:37:03 +08:00
|
|
|
|
|
|
|
FloatArrayType = 7,
|
|
|
|
DoubleArrayType = 8,
|
|
|
|
|
|
|
|
Vec2bArrayType = 9,
|
|
|
|
Vec3bArrayType = 10,
|
|
|
|
Vec4bArrayType = 11,
|
|
|
|
|
2005-07-15 22:41:19 +08:00
|
|
|
Vec2sArrayType = 12,
|
|
|
|
Vec3sArrayType = 13,
|
|
|
|
Vec4sArrayType = 14,
|
2013-06-28 01:37:03 +08:00
|
|
|
|
|
|
|
Vec2iArrayType = 15,
|
|
|
|
Vec3iArrayType = 16,
|
|
|
|
Vec4iArrayType = 17,
|
|
|
|
|
|
|
|
Vec2ubArrayType = 18,
|
|
|
|
Vec3ubArrayType = 19,
|
|
|
|
Vec4ubArrayType = 20,
|
|
|
|
|
|
|
|
Vec2usArrayType = 21,
|
|
|
|
Vec3usArrayType = 22,
|
|
|
|
Vec4usArrayType = 23,
|
|
|
|
|
|
|
|
Vec2uiArrayType = 24,
|
|
|
|
Vec3uiArrayType = 25,
|
|
|
|
Vec4uiArrayType = 26,
|
|
|
|
|
|
|
|
Vec2ArrayType = 27,
|
|
|
|
Vec3ArrayType = 28,
|
|
|
|
Vec4ArrayType = 29,
|
|
|
|
|
|
|
|
Vec2dArrayType = 30,
|
|
|
|
Vec3dArrayType = 31,
|
|
|
|
Vec4dArrayType = 32,
|
|
|
|
|
|
|
|
MatrixArrayType = 33,
|
2016-07-01 23:04:09 +08:00
|
|
|
MatrixdArrayType = 34,
|
|
|
|
|
|
|
|
QuatArrayType = 35
|
2002-06-27 21:15:34 +08:00
|
|
|
};
|
|
|
|
|
2013-06-05 03:04:26 +08:00
|
|
|
enum Binding
|
|
|
|
{
|
2013-06-05 15:27:35 +08:00
|
|
|
BIND_UNDEFINED=-1,
|
2013-06-05 03:04:26 +08:00
|
|
|
BIND_OFF=0,
|
|
|
|
BIND_OVERALL=1,
|
|
|
|
BIND_PER_PRIMITIVE_SET=2,
|
2013-07-01 18:22:34 +08:00
|
|
|
BIND_PER_VERTEX=4
|
2013-06-05 03:04:26 +08:00
|
|
|
};
|
2013-06-27 01:54:35 +08:00
|
|
|
|
2013-07-02 17:44:46 +08:00
|
|
|
Array(Type arrayType=ArrayType,GLint dataSize=0,GLenum dataType=0, Binding binding=BIND_UNDEFINED):
|
2002-06-27 18:50:19 +08:00
|
|
|
_arrayType(arrayType),
|
|
|
|
_dataSize(dataSize),
|
2013-06-27 01:54:35 +08:00
|
|
|
_dataType(dataType),
|
2013-07-02 17:44:46 +08:00
|
|
|
_binding(binding),
|
2013-06-05 03:04:26 +08:00
|
|
|
_normalize(false),
|
2013-06-05 15:55:05 +08:00
|
|
|
_preserveDataType(false) {}
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2013-06-18 19:18:28 +08:00
|
|
|
Array(const Array& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
2009-10-02 04:19:42 +08:00
|
|
|
BufferData(array,copyop),
|
2002-06-27 18:50:19 +08:00
|
|
|
_arrayType(array._arrayType),
|
|
|
|
_dataSize(array._dataSize),
|
2013-06-05 03:04:26 +08:00
|
|
|
_dataType(array._dataType),
|
2013-06-05 15:55:05 +08:00
|
|
|
_binding(array._binding),
|
2013-06-05 03:04:26 +08:00
|
|
|
_normalize(array._normalize),
|
2013-06-05 15:55:05 +08:00
|
|
|
_preserveDataType(array._preserveDataType) {}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Array*>(obj)!=NULL; }
|
2002-06-27 18:50:19 +08:00
|
|
|
virtual const char* libraryName() const { return "osg"; }
|
|
|
|
virtual const char* className() const;
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void accept(ArrayVisitor&) = 0;
|
|
|
|
virtual void accept(ConstArrayVisitor&) const = 0;
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void accept(unsigned int index,ValueVisitor&) = 0;
|
|
|
|
virtual void accept(unsigned int index,ConstValueVisitor&) const = 0;
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2004-09-01 16:15:36 +08:00
|
|
|
/** Return -1 if lhs element is less than rhs element, 0 if equal,
|
|
|
|
* 1 if lhs element is greater than rhs element. */
|
2003-12-04 05:45:32 +08:00
|
|
|
virtual int compare(unsigned int lhs,unsigned int rhs) const = 0;
|
|
|
|
|
2013-06-04 22:55:57 +08:00
|
|
|
Type getType() const { return _arrayType; }
|
|
|
|
GLint getDataSize() const { return _dataSize; }
|
|
|
|
GLenum getDataType() const { return _dataType; }
|
2013-06-27 01:54:35 +08:00
|
|
|
|
2012-01-24 22:34:02 +08:00
|
|
|
virtual osg::Array* asArray() { return this; }
|
|
|
|
virtual const osg::Array* asArray() const { return this; }
|
|
|
|
|
2013-06-18 19:18:28 +08:00
|
|
|
virtual unsigned int getElementSize() const = 0;
|
2013-06-04 22:55:57 +08:00
|
|
|
virtual const GLvoid* getDataPointer() const = 0;
|
|
|
|
virtual unsigned int getTotalDataSize() const = 0;
|
|
|
|
virtual unsigned int getNumElements() const = 0;
|
2013-06-18 19:18:28 +08:00
|
|
|
virtual void reserveArray(unsigned int num) = 0;
|
|
|
|
virtual void resizeArray(unsigned int num) = 0;
|
2013-06-04 22:55:57 +08:00
|
|
|
|
2013-06-05 15:55:05 +08:00
|
|
|
|
|
|
|
/** Specify how this array should be passed to OpenGL.*/
|
2013-06-27 22:46:16 +08:00
|
|
|
void setBinding(Binding binding) { _binding = binding; }
|
2013-06-05 15:55:05 +08:00
|
|
|
|
|
|
|
/** Get how this array should be passed to OpenGL.*/
|
2013-06-27 22:46:16 +08:00
|
|
|
Binding getBinding() const { return _binding; }
|
2013-06-05 15:55:05 +08:00
|
|
|
|
2013-06-27 01:54:35 +08:00
|
|
|
|
2013-06-04 22:55:57 +08:00
|
|
|
/** Specify whether the array data should be normalized by OpenGL.*/
|
|
|
|
void setNormalize(bool normalize) { _normalize = normalize; }
|
|
|
|
|
|
|
|
/** Get whether the array data should be normalized by OpenGL.*/
|
|
|
|
bool getNormalize() const { return _normalize; }
|
2013-06-27 01:54:35 +08:00
|
|
|
|
|
|
|
|
2013-06-04 22:55:57 +08:00
|
|
|
/** Set hint to ask that the array data is passed via integer or double, or normal setVertexAttribPointer function.*/
|
|
|
|
void setPreserveDataType(bool preserve) { _preserveDataType = preserve; }
|
|
|
|
|
|
|
|
/** Get hint to ask that the array data is passed via integer or double, or normal setVertexAttribPointer function.*/
|
|
|
|
bool getPreserveDataType() const { return _preserveDataType; }
|
2013-06-05 15:27:35 +08:00
|
|
|
|
2013-06-27 01:54:35 +08:00
|
|
|
|
2006-06-08 19:58:56 +08:00
|
|
|
/** Frees unused space on this vector - i.e. the difference between size() and max_size() of the underlying vector.*/
|
|
|
|
virtual void trim() {}
|
|
|
|
|
2007-04-26 02:50:11 +08:00
|
|
|
/** Set the VertexBufferObject.*/
|
2009-10-02 04:19:42 +08:00
|
|
|
inline void setVertexBufferObject(osg::VertexBufferObject* vbo) { setBufferObject(vbo); }
|
|
|
|
|
2007-04-26 02:50:11 +08:00
|
|
|
/** Get the VertexBufferObject. If no VBO is assigned returns NULL*/
|
2009-10-02 04:19:42 +08:00
|
|
|
inline osg::VertexBufferObject* getVertexBufferObject() { return dynamic_cast<osg::VertexBufferObject*>(_bufferObject.get()); }
|
2007-04-26 02:50:11 +08:00
|
|
|
|
|
|
|
/** Get the const VertexBufferObject. If no VBO is assigned returns NULL*/
|
2009-10-02 04:19:42 +08:00
|
|
|
inline const osg::VertexBufferObject* getVertexBufferObject() const { return dynamic_cast<const osg::VertexBufferObject*>(_bufferObject.get()); }
|
2007-04-26 02:50:11 +08:00
|
|
|
|
2002-06-27 18:50:19 +08:00
|
|
|
protected:
|
2009-10-02 04:19:42 +08:00
|
|
|
|
|
|
|
virtual ~Array() {}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2013-06-04 22:55:57 +08:00
|
|
|
Type _arrayType;
|
|
|
|
GLint _dataSize;
|
|
|
|
GLenum _dataType;
|
2013-06-27 22:46:16 +08:00
|
|
|
Binding _binding;
|
2013-06-04 22:55:57 +08:00
|
|
|
bool _normalize;
|
|
|
|
bool _preserveDataType;
|
2002-06-27 18:50:19 +08:00
|
|
|
};
|
|
|
|
|
2015-04-08 02:01:12 +08:00
|
|
|
/** convenience function for getting the binding of array via a ptr that may be null.*/
|
2013-06-27 22:46:16 +08:00
|
|
|
inline osg::Array::Binding getBinding(const osg::Array* array) { return array ? array->getBinding() : osg::Array::BIND_OFF; }
|
|
|
|
|
2015-04-08 02:01:12 +08:00
|
|
|
/** convenience function for getting the binding of array via a ptr that may be null.*/
|
2013-06-27 22:46:16 +08:00
|
|
|
inline bool getNormalize(const osg::Array* array) { return array ? array->getNormalize() : false; }
|
2013-06-27 01:54:35 +08:00
|
|
|
|
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
2008-06-20 04:38:38 +08:00
|
|
|
class TemplateArray : public Array, public MixinVector<T>
|
2002-06-27 18:50:19 +08:00
|
|
|
{
|
|
|
|
public:
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2013-06-18 19:18:28 +08:00
|
|
|
TemplateArray(Binding binding=BIND_UNDEFINED) : Array(ARRAYTYPE,DataSize,DataType, binding) {}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
|
|
|
TemplateArray(const TemplateArray& ta,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
2002-06-27 21:15:34 +08:00
|
|
|
Array(ta,copyop),
|
2008-06-20 04:38:38 +08:00
|
|
|
MixinVector<T>(ta) {}
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2012-03-22 01:36:20 +08:00
|
|
|
TemplateArray(unsigned int no) :
|
2002-06-27 21:15:34 +08:00
|
|
|
Array(ARRAYTYPE,DataSize,DataType),
|
2008-06-20 04:38:38 +08:00
|
|
|
MixinVector<T>(no) {}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2012-03-22 01:36:20 +08:00
|
|
|
TemplateArray(unsigned int no,const T* ptr) :
|
2002-06-27 21:15:34 +08:00
|
|
|
Array(ARRAYTYPE,DataSize,DataType),
|
2008-06-20 04:38:38 +08:00
|
|
|
MixinVector<T>(ptr,ptr+no) {}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2013-06-18 19:18:28 +08:00
|
|
|
TemplateArray(Binding binding, unsigned int no) :
|
|
|
|
Array(ARRAYTYPE,DataSize,DataType, binding),
|
|
|
|
MixinVector<T>(no) {}
|
|
|
|
|
|
|
|
TemplateArray(Binding binding, unsigned int no,const T* ptr) :
|
|
|
|
Array(ARRAYTYPE,DataSize,DataType, binding),
|
|
|
|
MixinVector<T>(ptr,ptr+no) {}
|
|
|
|
|
2002-06-27 18:50:19 +08:00
|
|
|
template <class InputIterator>
|
2012-03-22 01:36:20 +08:00
|
|
|
TemplateArray(InputIterator first,InputIterator last) :
|
2002-06-27 21:15:34 +08:00
|
|
|
Array(ARRAYTYPE,DataSize,DataType),
|
2012-03-22 01:36:20 +08:00
|
|
|
MixinVector<T>(first,last) {}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2004-01-27 22:46:29 +08:00
|
|
|
TemplateArray& operator = (const TemplateArray& array)
|
|
|
|
{
|
|
|
|
if (this==&array) return *this;
|
2011-06-23 17:26:27 +08:00
|
|
|
this->assign(array.begin(),array.end());
|
2004-01-27 22:46:29 +08:00
|
|
|
return *this;
|
2012-03-22 01:36:20 +08:00
|
|
|
}
|
2004-01-27 22:46:29 +08:00
|
|
|
|
2002-12-16 21:40:58 +08:00
|
|
|
virtual Object* cloneType() const { return new TemplateArray(); }
|
2012-03-22 01:36:20 +08:00
|
|
|
virtual Object* clone(const CopyOp& copyop) const { return new TemplateArray(*this,copyop); }
|
2002-09-26 23:26:22 +08:00
|
|
|
|
2004-05-17 18:21:30 +08:00
|
|
|
inline virtual void accept(ArrayVisitor& av);
|
|
|
|
inline virtual void accept(ConstArrayVisitor& av) const;
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2004-05-17 18:21:30 +08:00
|
|
|
inline virtual void accept(unsigned int index,ValueVisitor& vv);
|
|
|
|
inline virtual void accept(unsigned int index,ConstValueVisitor& vv) const;
|
2002-09-26 23:26:22 +08:00
|
|
|
|
2003-12-04 05:45:32 +08:00
|
|
|
virtual int compare(unsigned int lhs,unsigned int rhs) const
|
|
|
|
{
|
|
|
|
const T& elem_lhs = (*this)[lhs];
|
|
|
|
const T& elem_rhs = (*this)[rhs];
|
|
|
|
if (elem_lhs<elem_rhs) return -1;
|
|
|
|
if (elem_rhs<elem_lhs) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
2006-06-08 19:58:56 +08:00
|
|
|
|
|
|
|
/** Frees unused space on this vector - i.e. the difference between size() and max_size() of the underlying vector.*/
|
|
|
|
virtual void trim()
|
|
|
|
{
|
2008-06-20 04:38:38 +08:00
|
|
|
MixinVector<T>( *this ).swap( *this );
|
2006-06-08 19:58:56 +08:00
|
|
|
}
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2013-06-18 19:18:28 +08:00
|
|
|
virtual unsigned int getElementSize() const { return sizeof(ElementDataType); }
|
2004-08-01 16:26:44 +08:00
|
|
|
virtual const GLvoid* getDataPointer() const { if (!this->empty()) return &this->front(); else return 0; }
|
2013-06-18 19:18:28 +08:00
|
|
|
virtual unsigned int getTotalDataSize() const { return static_cast<unsigned int>(this->size()*sizeof(ElementDataType)); }
|
2009-01-30 18:55:28 +08:00
|
|
|
virtual unsigned int getNumElements() const { return static_cast<unsigned int>(this->size()); }
|
2013-06-18 19:18:28 +08:00
|
|
|
virtual void reserveArray(unsigned int num) { this->reserve(num); }
|
|
|
|
virtual void resizeArray(unsigned int num) { this->resize(num); }
|
2002-07-16 18:16:34 +08:00
|
|
|
|
2007-12-11 23:55:02 +08:00
|
|
|
typedef T ElementDataType; // expose T
|
|
|
|
|
2002-07-16 18:16:34 +08:00
|
|
|
protected:
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2002-07-16 18:20:26 +08:00
|
|
|
virtual ~TemplateArray() {}
|
2002-06-27 18:50:19 +08:00
|
|
|
};
|
|
|
|
|
2005-04-12 01:14:17 +08:00
|
|
|
class OSG_EXPORT IndexArray : public Array
|
2002-09-26 23:26:22 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
IndexArray(Type arrayType=ArrayType,GLint dataSize=0,GLenum dataType=0):
|
|
|
|
Array(arrayType,dataSize,dataType) {}
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
IndexArray(const Array& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
|
|
|
Array(array,copyop) {}
|
|
|
|
|
|
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const IndexArray*>(obj)!=NULL; }
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual unsigned int index(unsigned int pos) const = 0;
|
|
|
|
|
|
|
|
protected:
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual ~IndexArray() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
2008-06-20 04:38:38 +08:00
|
|
|
class TemplateIndexArray : public IndexArray, public MixinVector<T>
|
2002-09-26 23:26:22 +08:00
|
|
|
{
|
|
|
|
public:
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
TemplateIndexArray() : IndexArray(ARRAYTYPE,DataSize,DataType) {}
|
|
|
|
|
|
|
|
TemplateIndexArray(const TemplateIndexArray& ta,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
|
|
|
IndexArray(ta,copyop),
|
2008-06-20 04:38:38 +08:00
|
|
|
MixinVector<T>(ta) {}
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2012-03-22 01:36:20 +08:00
|
|
|
TemplateIndexArray(unsigned int no) :
|
2002-09-26 23:26:22 +08:00
|
|
|
IndexArray(ARRAYTYPE,DataSize,DataType),
|
2008-06-20 04:38:38 +08:00
|
|
|
MixinVector<T>(no) {}
|
2002-09-26 23:26:22 +08:00
|
|
|
|
2012-03-22 01:36:20 +08:00
|
|
|
TemplateIndexArray(unsigned int no,T* ptr) :
|
2002-09-26 23:26:22 +08:00
|
|
|
IndexArray(ARRAYTYPE,DataSize,DataType),
|
2008-06-20 04:38:38 +08:00
|
|
|
MixinVector<T>(ptr,ptr+no) {}
|
2002-09-26 23:26:22 +08:00
|
|
|
|
|
|
|
template <class InputIterator>
|
2012-03-22 01:36:20 +08:00
|
|
|
TemplateIndexArray(InputIterator first,InputIterator last) :
|
2002-09-26 23:26:22 +08:00
|
|
|
IndexArray(ARRAYTYPE,DataSize,DataType),
|
2012-03-22 01:36:20 +08:00
|
|
|
MixinVector<T>(first,last) {}
|
2002-09-26 23:26:22 +08:00
|
|
|
|
2004-01-27 22:46:29 +08:00
|
|
|
TemplateIndexArray& operator = (const TemplateIndexArray& array)
|
|
|
|
{
|
|
|
|
if (this==&array) return *this;
|
2011-06-23 17:26:27 +08:00
|
|
|
this->assign(array.begin(),array.end());
|
2004-01-27 22:46:29 +08:00
|
|
|
return *this;
|
2012-03-22 01:36:20 +08:00
|
|
|
}
|
2004-01-27 22:46:29 +08:00
|
|
|
|
2002-12-16 21:40:58 +08:00
|
|
|
virtual Object* cloneType() const { return new TemplateIndexArray(); }
|
2012-03-22 01:36:20 +08:00
|
|
|
virtual Object* clone(const CopyOp& copyop) const { return new TemplateIndexArray(*this,copyop); }
|
2002-09-26 23:26:22 +08:00
|
|
|
|
2004-05-17 18:21:30 +08:00
|
|
|
inline virtual void accept(ArrayVisitor& av);
|
|
|
|
inline virtual void accept(ConstArrayVisitor& av) const;
|
2002-09-26 23:26:22 +08:00
|
|
|
|
2004-05-17 18:21:30 +08:00
|
|
|
inline virtual void accept(unsigned int index,ValueVisitor& vv);
|
|
|
|
inline virtual void accept(unsigned int index,ConstValueVisitor& vv) const;
|
2002-09-26 23:26:22 +08:00
|
|
|
|
2003-12-04 05:45:32 +08:00
|
|
|
virtual int compare(unsigned int lhs,unsigned int rhs) const
|
|
|
|
{
|
|
|
|
const T& elem_lhs = (*this)[lhs];
|
|
|
|
const T& elem_rhs = (*this)[rhs];
|
|
|
|
if (elem_lhs<elem_rhs) return -1;
|
|
|
|
if (elem_rhs<elem_lhs) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-06-08 19:58:56 +08:00
|
|
|
/** Frees unused space on this vector - i.e. the difference between size() and max_size() of the underlying vector.*/
|
|
|
|
virtual void trim()
|
|
|
|
{
|
2008-06-20 04:38:38 +08:00
|
|
|
MixinVector<T>( *this ).swap( *this );
|
2006-06-08 19:58:56 +08:00
|
|
|
}
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2013-06-18 19:18:28 +08:00
|
|
|
virtual unsigned int getElementSize() const { return sizeof(ElementDataType); }
|
2004-08-01 16:26:44 +08:00
|
|
|
virtual const GLvoid* getDataPointer() const { if (!this->empty()) return &this->front(); else return 0; }
|
2009-01-30 18:55:28 +08:00
|
|
|
virtual unsigned int getTotalDataSize() const { return static_cast<unsigned int>(this->size()*sizeof(T)); }
|
|
|
|
virtual unsigned int getNumElements() const { return static_cast<unsigned int>(this->size()); }
|
2013-06-18 19:18:28 +08:00
|
|
|
virtual void reserveArray(unsigned int num) { this->reserve(num); }
|
|
|
|
virtual void resizeArray(unsigned int num) { this->resize(num); }
|
2002-09-26 23:26:22 +08:00
|
|
|
|
|
|
|
virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
|
|
|
|
|
2007-12-11 23:55:02 +08:00
|
|
|
typedef T ElementDataType; // expose T
|
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
protected:
|
2009-10-21 03:34:24 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual ~TemplateIndexArray() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef TemplateIndexArray<GLbyte,Array::ByteArrayType,1,GL_BYTE> ByteArray;
|
|
|
|
typedef TemplateIndexArray<GLshort,Array::ShortArrayType,1,GL_SHORT> ShortArray;
|
|
|
|
typedef TemplateIndexArray<GLint,Array::IntArrayType,1,GL_INT> IntArray;
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
typedef TemplateIndexArray<GLubyte,Array::UByteArrayType,1,GL_UNSIGNED_BYTE> UByteArray;
|
|
|
|
typedef TemplateIndexArray<GLushort,Array::UShortArrayType,1,GL_UNSIGNED_SHORT> UShortArray;
|
|
|
|
typedef TemplateIndexArray<GLuint,Array::UIntArrayType,1,GL_UNSIGNED_INT> UIntArray;
|
|
|
|
|
|
|
|
typedef TemplateArray<GLfloat,Array::FloatArrayType,1,GL_FLOAT> FloatArray;
|
2013-06-28 01:37:03 +08:00
|
|
|
typedef TemplateArray<GLdouble,Array::DoubleArrayType,1,GL_DOUBLE> DoubleArray;
|
2005-07-15 22:41:19 +08:00
|
|
|
|
2002-07-16 06:18:47 +08:00
|
|
|
|
2013-06-28 01:37:03 +08:00
|
|
|
typedef TemplateArray<Vec2b,Array::Vec2bArrayType,2,GL_BYTE> Vec2bArray;
|
|
|
|
typedef TemplateArray<Vec3b,Array::Vec3bArrayType,3,GL_BYTE> Vec3bArray;
|
|
|
|
typedef TemplateArray<Vec4b,Array::Vec4bArrayType,4,GL_BYTE> Vec4bArray;
|
2005-07-15 22:41:19 +08:00
|
|
|
|
|
|
|
typedef TemplateArray<Vec2s,Array::Vec2sArrayType,2,GL_SHORT> Vec2sArray;
|
|
|
|
typedef TemplateArray<Vec3s,Array::Vec3sArrayType,3,GL_SHORT> Vec3sArray;
|
|
|
|
typedef TemplateArray<Vec4s,Array::Vec4sArrayType,4,GL_SHORT> Vec4sArray;
|
|
|
|
|
2013-06-28 01:37:03 +08:00
|
|
|
typedef TemplateArray<Vec2i,Array::Vec2iArrayType,2,GL_INT> Vec2iArray;
|
|
|
|
typedef TemplateArray<Vec3i,Array::Vec3iArrayType,3,GL_INT> Vec3iArray;
|
|
|
|
typedef TemplateArray<Vec4i,Array::Vec4iArrayType,4,GL_INT> Vec4iArray;
|
|
|
|
|
|
|
|
typedef TemplateArray<Vec2ub,Array::Vec2ubArrayType,2,GL_UNSIGNED_BYTE> Vec2ubArray;
|
|
|
|
typedef TemplateArray<Vec3ub,Array::Vec3ubArrayType,3,GL_UNSIGNED_BYTE> Vec3ubArray;
|
|
|
|
typedef TemplateArray<Vec4ub,Array::Vec4ubArrayType,4,GL_UNSIGNED_BYTE> Vec4ubArray;
|
|
|
|
|
|
|
|
typedef TemplateArray<Vec2us,Array::Vec2usArrayType,2,GL_UNSIGNED_SHORT> Vec2usArray;
|
|
|
|
typedef TemplateArray<Vec3us,Array::Vec3usArrayType,3,GL_UNSIGNED_SHORT> Vec3usArray;
|
|
|
|
typedef TemplateArray<Vec4us,Array::Vec4usArrayType,4,GL_UNSIGNED_SHORT> Vec4usArray;
|
|
|
|
|
|
|
|
typedef TemplateArray<Vec2ui,Array::Vec2uiArrayType,2,GL_UNSIGNED_INT> Vec2uiArray;
|
|
|
|
typedef TemplateArray<Vec3ui,Array::Vec3uiArrayType,3,GL_UNSIGNED_INT> Vec3uiArray;
|
|
|
|
typedef TemplateArray<Vec4ui,Array::Vec4uiArrayType,4,GL_UNSIGNED_INT> Vec4uiArray;
|
|
|
|
|
|
|
|
typedef TemplateArray<Vec2,Array::Vec2ArrayType,2,GL_FLOAT> Vec2Array;
|
|
|
|
typedef TemplateArray<Vec3,Array::Vec3ArrayType,3,GL_FLOAT> Vec3Array;
|
|
|
|
typedef TemplateArray<Vec4,Array::Vec4ArrayType,4,GL_FLOAT> Vec4Array;
|
2005-07-05 23:57:53 +08:00
|
|
|
|
2013-06-28 01:37:03 +08:00
|
|
|
typedef TemplateArray<Vec2d,Array::Vec2dArrayType,2,GL_DOUBLE> Vec2dArray;
|
|
|
|
typedef TemplateArray<Vec3d,Array::Vec3dArrayType,3,GL_DOUBLE> Vec3dArray;
|
|
|
|
typedef TemplateArray<Vec4d,Array::Vec4dArrayType,4,GL_DOUBLE> Vec4dArray;
|
2007-12-04 22:44:21 +08:00
|
|
|
|
2013-06-28 01:37:03 +08:00
|
|
|
typedef TemplateArray<Matrixf,Array::MatrixArrayType,16,GL_FLOAT> MatrixfArray;
|
|
|
|
typedef TemplateArray<Matrixd,Array::MatrixdArrayType,16,GL_DOUBLE> MatrixdArray;
|
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.
2010-02-26 22:41:50 +08:00
|
|
|
|
2016-07-01 23:04:09 +08:00
|
|
|
typedef TemplateArray<Quat,Array::QuatArrayType,4,GL_DOUBLE> QuatArray;
|
|
|
|
|
2005-07-05 23:57:53 +08:00
|
|
|
|
2002-07-16 06:18:47 +08:00
|
|
|
class ArrayVisitor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ArrayVisitor() {}
|
2005-08-26 01:53:01 +08:00
|
|
|
virtual ~ArrayVisitor() {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2002-07-16 06:18:47 +08:00
|
|
|
virtual void apply(Array&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-07-16 06:18:47 +08:00
|
|
|
virtual void apply(ByteArray&) {}
|
|
|
|
virtual void apply(ShortArray&) {}
|
|
|
|
virtual void apply(IntArray&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-07-16 06:18:47 +08:00
|
|
|
virtual void apply(UByteArray&) {}
|
|
|
|
virtual void apply(UShortArray&) {}
|
|
|
|
virtual void apply(UIntArray&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-07-16 06:18:47 +08:00
|
|
|
virtual void apply(FloatArray&) {}
|
2007-12-04 22:44:21 +08:00
|
|
|
virtual void apply(DoubleArray&) {}
|
2005-07-15 22:41:19 +08:00
|
|
|
|
|
|
|
|
2012-03-22 01:36:20 +08:00
|
|
|
virtual void apply(Vec2bArray&) {}
|
|
|
|
virtual void apply(Vec3bArray&) {}
|
|
|
|
virtual void apply(Vec4bArray&) {}
|
2005-07-15 22:41:19 +08:00
|
|
|
|
2005-07-16 05:47:11 +08:00
|
|
|
virtual void apply(Vec2sArray&) {}
|
|
|
|
virtual void apply(Vec3sArray&) {}
|
|
|
|
virtual void apply(Vec4sArray&) {}
|
2007-12-04 22:44:21 +08:00
|
|
|
|
2013-06-28 01:37:03 +08:00
|
|
|
virtual void apply(Vec2iArray&) {}
|
|
|
|
virtual void apply(Vec3iArray&) {}
|
|
|
|
virtual void apply(Vec4iArray&) {}
|
|
|
|
|
|
|
|
virtual void apply(Vec2ubArray&) {}
|
|
|
|
virtual void apply(Vec3ubArray&) {}
|
|
|
|
virtual void apply(Vec4ubArray&) {}
|
|
|
|
|
|
|
|
virtual void apply(Vec2usArray&) {}
|
|
|
|
virtual void apply(Vec3usArray&) {}
|
|
|
|
virtual void apply(Vec4usArray&) {}
|
|
|
|
|
|
|
|
virtual void apply(Vec2uiArray&) {}
|
|
|
|
virtual void apply(Vec3uiArray&) {}
|
|
|
|
virtual void apply(Vec4uiArray&) {}
|
|
|
|
|
|
|
|
virtual void apply(Vec2Array&) {}
|
|
|
|
virtual void apply(Vec3Array&) {}
|
|
|
|
virtual void apply(Vec4Array&) {}
|
|
|
|
|
2007-12-04 22:44:21 +08:00
|
|
|
virtual void apply(Vec2dArray&) {}
|
|
|
|
virtual void apply(Vec3dArray&) {}
|
|
|
|
virtual void apply(Vec4dArray&) {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
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.
2010-02-26 22:41:50 +08:00
|
|
|
virtual void apply(MatrixfArray&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
virtual void apply(MatrixdArray&) {}
|
2002-07-16 06:18:47 +08:00
|
|
|
};
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
class ConstArrayVisitor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ConstArrayVisitor() {}
|
2005-08-26 01:53:01 +08:00
|
|
|
virtual ~ConstArrayVisitor() {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void apply(const Array&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void apply(const ByteArray&) {}
|
|
|
|
virtual void apply(const ShortArray&) {}
|
|
|
|
virtual void apply(const IntArray&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void apply(const UByteArray&) {}
|
|
|
|
virtual void apply(const UShortArray&) {}
|
|
|
|
virtual void apply(const UIntArray&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void apply(const FloatArray&) {}
|
2007-12-04 22:44:21 +08:00
|
|
|
virtual void apply(const DoubleArray&) {}
|
2005-07-15 22:41:19 +08:00
|
|
|
|
|
|
|
|
2012-03-22 01:36:20 +08:00
|
|
|
virtual void apply(const Vec2bArray&) {}
|
|
|
|
virtual void apply(const Vec3bArray&) {}
|
|
|
|
virtual void apply(const Vec4bArray&) {}
|
2005-07-15 22:41:19 +08:00
|
|
|
|
|
|
|
virtual void apply(const Vec2sArray&) {}
|
|
|
|
virtual void apply(const Vec3sArray&) {}
|
|
|
|
virtual void apply(const Vec4sArray&) {}
|
2007-12-04 22:44:21 +08:00
|
|
|
|
2013-06-28 01:37:03 +08:00
|
|
|
virtual void apply(const Vec2iArray&) {}
|
|
|
|
virtual void apply(const Vec3iArray&) {}
|
|
|
|
virtual void apply(const Vec4iArray&) {}
|
|
|
|
|
|
|
|
virtual void apply(const Vec2ubArray&) {}
|
|
|
|
virtual void apply(const Vec3ubArray&) {}
|
|
|
|
virtual void apply(const Vec4ubArray&) {}
|
|
|
|
|
|
|
|
virtual void apply(const Vec2usArray&) {}
|
|
|
|
virtual void apply(const Vec3usArray&) {}
|
|
|
|
virtual void apply(const Vec4usArray&) {}
|
|
|
|
|
|
|
|
virtual void apply(const Vec2uiArray&) {}
|
|
|
|
virtual void apply(const Vec3uiArray&) {}
|
|
|
|
virtual void apply(const Vec4uiArray&) {}
|
|
|
|
|
|
|
|
virtual void apply(const Vec2Array&) {}
|
|
|
|
virtual void apply(const Vec3Array&) {}
|
|
|
|
virtual void apply(const Vec4Array&) {}
|
|
|
|
|
2007-12-04 22:44:21 +08:00
|
|
|
virtual void apply(const Vec2dArray&) {}
|
|
|
|
virtual void apply(const Vec3dArray&) {}
|
|
|
|
virtual void apply(const Vec4dArray&) {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
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.
2010-02-26 22:41:50 +08:00
|
|
|
virtual void apply(const MatrixfArray&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
virtual void apply(const MatrixdArray&) {}
|
2002-09-26 23:26:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ValueVisitor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ValueVisitor() {}
|
2005-08-26 01:53:01 +08:00
|
|
|
virtual ~ValueVisitor() {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void apply(GLbyte&) {}
|
|
|
|
virtual void apply(GLshort&) {}
|
|
|
|
virtual void apply(GLint&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void apply(GLushort&) {}
|
|
|
|
virtual void apply(GLubyte&) {}
|
|
|
|
virtual void apply(GLuint&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void apply(GLfloat&) {}
|
2007-12-04 22:44:21 +08:00
|
|
|
virtual void apply(GLdouble&) {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
virtual void apply(Vec2b&) {}
|
|
|
|
virtual void apply(Vec3b&) {}
|
|
|
|
virtual void apply(Vec4b&) {}
|
2005-07-16 05:47:11 +08:00
|
|
|
|
|
|
|
virtual void apply(Vec2s&) {}
|
|
|
|
virtual void apply(Vec3s&) {}
|
|
|
|
virtual void apply(Vec4s&) {}
|
2007-12-04 22:44:21 +08:00
|
|
|
|
2013-06-28 01:37:03 +08:00
|
|
|
virtual void apply(Vec2i&) {}
|
|
|
|
virtual void apply(Vec3i&) {}
|
|
|
|
virtual void apply(Vec4i&) {}
|
|
|
|
|
|
|
|
virtual void apply(Vec2ub&) {}
|
|
|
|
virtual void apply(Vec3ub&) {}
|
|
|
|
virtual void apply(Vec4ub&) {}
|
|
|
|
|
|
|
|
virtual void apply(Vec2us&) {}
|
|
|
|
virtual void apply(Vec3us&) {}
|
|
|
|
virtual void apply(Vec4us&) {}
|
|
|
|
|
|
|
|
virtual void apply(Vec2ui&) {}
|
|
|
|
virtual void apply(Vec3ui&) {}
|
|
|
|
virtual void apply(Vec4ui&) {}
|
|
|
|
|
|
|
|
virtual void apply(Vec2&) {}
|
|
|
|
virtual void apply(Vec3&) {}
|
|
|
|
virtual void apply(Vec4&) {}
|
|
|
|
|
2007-12-04 22:44:21 +08:00
|
|
|
virtual void apply(Vec2d&) {}
|
|
|
|
virtual void apply(Vec3d&) {}
|
|
|
|
virtual void apply(Vec4d&) {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
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.
2010-02-26 22:41:50 +08:00
|
|
|
virtual void apply(Matrixf&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
virtual void apply(Matrixd&) {}
|
2016-07-01 23:04:09 +08:00
|
|
|
|
|
|
|
virtual void apply(Quat&) {}
|
2002-09-26 23:26:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class ConstValueVisitor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ConstValueVisitor() {}
|
2005-08-26 01:53:01 +08:00
|
|
|
virtual ~ConstValueVisitor() {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void apply(const GLbyte&) {}
|
|
|
|
virtual void apply(const GLshort&) {}
|
|
|
|
virtual void apply(const GLint&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void apply(const GLushort&) {}
|
|
|
|
virtual void apply(const GLubyte&) {}
|
|
|
|
virtual void apply(const GLuint&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
|
2002-09-26 23:26:22 +08:00
|
|
|
virtual void apply(const GLfloat&) {}
|
2007-12-04 22:44:21 +08:00
|
|
|
virtual void apply(const GLdouble&) {}
|
2005-07-15 22:41:19 +08:00
|
|
|
|
2005-07-16 05:47:11 +08:00
|
|
|
|
|
|
|
virtual void apply(const Vec2b&) {}
|
|
|
|
virtual void apply(const Vec3b&) {}
|
2012-03-22 01:36:20 +08:00
|
|
|
virtual void apply(const Vec4b&) {}
|
|
|
|
|
2005-07-15 22:41:19 +08:00
|
|
|
virtual void apply(const Vec2s&) {}
|
|
|
|
virtual void apply(const Vec3s&) {}
|
|
|
|
virtual void apply(const Vec4s&) {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2013-06-28 01:37:03 +08:00
|
|
|
virtual void apply(const Vec2i&) {}
|
|
|
|
virtual void apply(const Vec3i&) {}
|
|
|
|
virtual void apply(const Vec4i&) {}
|
|
|
|
|
|
|
|
virtual void apply(const Vec2ub&) {}
|
|
|
|
virtual void apply(const Vec3ub&) {}
|
|
|
|
virtual void apply(const Vec4ub&) {}
|
|
|
|
|
|
|
|
virtual void apply(const Vec2us&) {}
|
|
|
|
virtual void apply(const Vec3us&) {}
|
|
|
|
virtual void apply(const Vec4us&) {}
|
|
|
|
|
|
|
|
virtual void apply(const Vec2ui&) {}
|
|
|
|
virtual void apply(const Vec3ui&) {}
|
|
|
|
virtual void apply(const Vec4ui&) {}
|
|
|
|
|
|
|
|
virtual void apply(const Vec2&) {}
|
|
|
|
virtual void apply(const Vec3&) {}
|
|
|
|
virtual void apply(const Vec4&) {}
|
|
|
|
|
2007-12-04 22:44:21 +08:00
|
|
|
virtual void apply(const Vec2d&) {}
|
|
|
|
virtual void apply(const Vec3d&) {}
|
|
|
|
virtual void apply(const Vec4d&) {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
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.
2010-02-26 22:41:50 +08:00
|
|
|
virtual void apply(const Matrixf&) {}
|
2013-06-28 01:37:03 +08:00
|
|
|
virtual void apply(const Matrixd&) {}
|
2016-07-01 23:04:09 +08:00
|
|
|
|
|
|
|
virtual void apply(const Quat&) {}
|
2002-09-26 23:26:22 +08:00
|
|
|
};
|
|
|
|
|
2004-05-17 18:21:30 +08:00
|
|
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
|
|
|
inline void TemplateArray<T,ARRAYTYPE,DataSize,DataType>::accept(ArrayVisitor& av) { av.apply(*this); }
|
|
|
|
|
|
|
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
|
|
|
inline void TemplateArray<T,ARRAYTYPE,DataSize,DataType>::accept(ConstArrayVisitor& av) const { av.apply(*this); }
|
|
|
|
|
|
|
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
|
|
|
inline void TemplateArray<T,ARRAYTYPE,DataSize,DataType>::accept(unsigned int index,ValueVisitor& vv) { vv.apply( (*this)[index] ); }
|
|
|
|
|
|
|
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
|
|
|
inline void TemplateArray<T,ARRAYTYPE,DataSize,DataType>::accept(unsigned int index,ConstValueVisitor& vv) const { vv.apply( (*this)[index] );}
|
|
|
|
|
|
|
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
|
|
|
inline void TemplateIndexArray<T,ARRAYTYPE,DataSize,DataType>::accept(ArrayVisitor& av) { av.apply(*this); }
|
|
|
|
|
|
|
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
|
|
|
inline void TemplateIndexArray<T,ARRAYTYPE,DataSize,DataType>::accept(ConstArrayVisitor& av) const { av.apply(*this); }
|
|
|
|
|
|
|
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
|
|
|
inline void TemplateIndexArray<T,ARRAYTYPE,DataSize,DataType>::accept(unsigned int index,ValueVisitor& vv) { vv.apply( (*this)[index] ); }
|
|
|
|
|
|
|
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
|
|
|
inline void TemplateIndexArray<T,ARRAYTYPE,DataSize,DataType>::accept(unsigned int index,ConstValueVisitor& vv) const { vv.apply( (*this)[index] );}
|
2002-09-26 23:26:22 +08:00
|
|
|
|
2002-06-27 18:50:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|