Added support for Bindless texture extension,
64 bit uniforms, 64 bit buffers Added new bindless texture example
This commit is contained in:
parent
18369bed2d
commit
3d2f4ea404
@ -166,10 +166,9 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osgwidgettable)
|
ADD_SUBDIRECTORY(osgwidgettable)
|
||||||
ADD_SUBDIRECTORY(osgwidgetwindow)
|
ADD_SUBDIRECTORY(osgwidgetwindow)
|
||||||
ADD_SUBDIRECTORY(osguserdata)
|
ADD_SUBDIRECTORY(osguserdata)
|
||||||
|
|
||||||
# GL3/GL4 example
|
# GL3/GL4 example
|
||||||
ADD_SUBDIRECTORY(osgsimplegl3)
|
ADD_SUBDIRECTORY(osgsimplegl3)
|
||||||
|
ADD_SUBDIRECTORY(osgbindlesstext)
|
||||||
IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
|
IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
|
||||||
ADD_SUBDIRECTORY(osgunittests)
|
ADD_SUBDIRECTORY(osgunittests)
|
||||||
ADD_SUBDIRECTORY(osgmemorytest)
|
ADD_SUBDIRECTORY(osgmemorytest)
|
||||||
|
@ -112,7 +112,10 @@ class OSG_EXPORT Array : public BufferData
|
|||||||
MatrixArrayType = 33,
|
MatrixArrayType = 33,
|
||||||
MatrixdArrayType = 34,
|
MatrixdArrayType = 34,
|
||||||
|
|
||||||
QuatArrayType = 35
|
QuatArrayType = 35,
|
||||||
|
|
||||||
|
UInt64ArrayType = 36,
|
||||||
|
Int64ArrayType = 37
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Binding
|
enum Binding
|
||||||
@ -442,7 +445,8 @@ typedef TemplateArray<Matrixd,Array::MatrixdArrayType,16,GL_DOUBLE>
|
|||||||
|
|
||||||
typedef TemplateArray<Quat,Array::QuatArrayType,4,GL_DOUBLE> QuatArray;
|
typedef TemplateArray<Quat,Array::QuatArrayType,4,GL_DOUBLE> QuatArray;
|
||||||
|
|
||||||
|
typedef TemplateIndexArray<GLuint64,Array::UInt64ArrayType,1,GL_UNSIGNED_INT64_ARB> UInt64Array;
|
||||||
|
typedef TemplateIndexArray<GLint64,Array::Int64ArrayType,1,GL_INT64_ARB> Int64Array;
|
||||||
class ArrayVisitor
|
class ArrayVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -497,6 +501,9 @@ class ArrayVisitor
|
|||||||
|
|
||||||
virtual void apply(MatrixfArray&) {}
|
virtual void apply(MatrixfArray&) {}
|
||||||
virtual void apply(MatrixdArray&) {}
|
virtual void apply(MatrixdArray&) {}
|
||||||
|
|
||||||
|
virtual void apply(UInt64Array&) {}
|
||||||
|
virtual void apply(Int64Array&) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConstArrayVisitor
|
class ConstArrayVisitor
|
||||||
@ -553,6 +560,9 @@ class ConstArrayVisitor
|
|||||||
|
|
||||||
virtual void apply(const MatrixfArray&) {}
|
virtual void apply(const MatrixfArray&) {}
|
||||||
virtual void apply(const MatrixdArray&) {}
|
virtual void apply(const MatrixdArray&) {}
|
||||||
|
|
||||||
|
virtual void apply(const UInt64Array&) {}
|
||||||
|
virtual void apply(const Int64Array&) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -610,6 +620,9 @@ class ValueVisitor
|
|||||||
virtual void apply(Matrixd&) {}
|
virtual void apply(Matrixd&) {}
|
||||||
|
|
||||||
virtual void apply(Quat&) {}
|
virtual void apply(Quat&) {}
|
||||||
|
|
||||||
|
virtual void apply(GLuint64&){}
|
||||||
|
virtual void apply(GLint64&){}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConstValueVisitor
|
class ConstValueVisitor
|
||||||
@ -666,6 +679,9 @@ class ConstValueVisitor
|
|||||||
virtual void apply(const Matrixd&) {}
|
virtual void apply(const Matrixd&) {}
|
||||||
|
|
||||||
virtual void apply(const Quat&) {}
|
virtual void apply(const Quat&) {}
|
||||||
|
|
||||||
|
virtual void apply(const GLuint64&){}
|
||||||
|
virtual void apply(const GLint64&){}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
||||||
|
@ -556,6 +556,14 @@ typedef char GLchar;
|
|||||||
#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
|
#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define GL_INT64_ARB 0x140E
|
||||||
|
#define GL_UNSIGNED_INT64_ARB 0x140F
|
||||||
|
#define GL_INT64_VEC2_ARB 0x8FE9
|
||||||
|
#define GL_INT64_VEC3_ARB 0x8FEA
|
||||||
|
#define GL_INT64_VEC4_ARB 0x8FEB
|
||||||
|
#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5
|
||||||
|
#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6
|
||||||
|
#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7
|
||||||
/* ------------------------------ GL_KHR_debug ----------------------------- */
|
/* ------------------------------ GL_KHR_debug ----------------------------- */
|
||||||
#ifndef GL_KHR_debug
|
#ifndef GL_KHR_debug
|
||||||
#define GL_KHR_debug 1
|
#define GL_KHR_debug 1
|
||||||
@ -602,7 +610,6 @@ typedef char GLchar;
|
|||||||
#define GL_DEBUG_OUTPUT 0x92E0
|
#define GL_DEBUG_OUTPUT 0x92E0
|
||||||
|
|
||||||
#endif /* GL_KHR_debug */
|
#endif /* GL_KHR_debug */
|
||||||
|
|
||||||
#ifndef GL_ARB_sync
|
#ifndef GL_ARB_sync
|
||||||
#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
|
#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
|
||||||
#define GL_OBJECT_TYPE 0x9112
|
#define GL_OBJECT_TYPE 0x9112
|
||||||
@ -653,6 +660,10 @@ typedef char GLchar;
|
|||||||
#define GL_ALPHA_TEST 0x0BC0
|
#define GL_ALPHA_TEST 0x0BC0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GLuint64EXT
|
||||||
|
typedef uint64_t GLuint64EXT;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace osg
|
namespace osg
|
||||||
{
|
{
|
||||||
#ifndef GL_VERSION_3_2
|
#ifndef GL_VERSION_3_2
|
||||||
|
@ -319,6 +319,22 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
|||||||
void (GL_APIENTRY * glUniform2uiv)( GLint location, GLsizei count, const GLuint *value );
|
void (GL_APIENTRY * glUniform2uiv)( GLint location, GLsizei count, const GLuint *value );
|
||||||
void (GL_APIENTRY * glUniform3uiv)( GLint location, GLsizei count, const GLuint *value );
|
void (GL_APIENTRY * glUniform3uiv)( GLint location, GLsizei count, const GLuint *value );
|
||||||
void (GL_APIENTRY * glUniform4uiv)( GLint location, GLsizei count, const GLuint *value );
|
void (GL_APIENTRY * glUniform4uiv)( GLint location, GLsizei count, const GLuint *value );
|
||||||
|
void (GL_APIENTRY * glUniform1i64 )(GLint location, GLint64 x) ;
|
||||||
|
void (GL_APIENTRY * glUniform1i64v )(GLint location, GLsizei count, const GLint64* value) ;
|
||||||
|
void (GL_APIENTRY * glUniform1ui64 )(GLint location, GLuint64 x) ;
|
||||||
|
void (GL_APIENTRY * glUniform1ui64v)(GLint location, GLsizei count, const GLuint64* value) ;
|
||||||
|
void (GL_APIENTRY * glUniform2i64 )(GLint location, GLint64 x, GLint64 y) ;
|
||||||
|
void (GL_APIENTRY * glUniform2i64v )(GLint location, GLsizei count, const GLint64* value) ;
|
||||||
|
void (GL_APIENTRY * glUniform2ui64 )(GLint location, GLuint64 x, GLuint64 y) ;
|
||||||
|
void (GL_APIENTRY * glUniform2ui64v)(GLint location, GLsizei count, const GLuint64* value) ;
|
||||||
|
void (GL_APIENTRY * glUniform3i64 )(GLint location, GLint64 x, GLint64 y, GLint64 z) ;
|
||||||
|
void (GL_APIENTRY * glUniform3i64v )(GLint location, GLsizei count, const GLint64* value) ;
|
||||||
|
void (GL_APIENTRY * glUniform3ui64 )(GLint location, GLuint64 x, GLuint64 y, GLuint64 z) ;
|
||||||
|
void (GL_APIENTRY * glUniform3ui64v)(GLint location, GLsizei count, const GLuint64* value) ;
|
||||||
|
void (GL_APIENTRY * glUniform4i64 )(GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w) ;
|
||||||
|
void (GL_APIENTRY * glUniform4i64v )(GLint location, GLsizei count, const GLint64* value) ;
|
||||||
|
void (GL_APIENTRY * glUniform4ui64 )(GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w) ;
|
||||||
|
void (GL_APIENTRY * glUniform4ui64v)(GLint location, GLsizei count, const GLuint64* value) ;
|
||||||
GLuint (GL_APIENTRY * glGetHandleARB) (GLenum pname);
|
GLuint (GL_APIENTRY * glGetHandleARB) (GLenum pname);
|
||||||
void (GL_APIENTRY * glGetUniformIndices)(GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices);
|
void (GL_APIENTRY * glGetUniformIndices)(GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices);
|
||||||
void (GL_APIENTRY * glGetActiveUniformsiv)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
|
void (GL_APIENTRY * glGetActiveUniformsiv)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
|
||||||
@ -348,7 +364,11 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
|||||||
void (GL_APIENTRY * glUniformMatrix4x3dv)( GLint location, GLsizei count, GLboolean transpose, const GLdouble* value );
|
void (GL_APIENTRY * glUniformMatrix4x3dv)( GLint location, GLsizei count, GLboolean transpose, const GLdouble* value );
|
||||||
void (GL_APIENTRY * glGetActiveAtomicCounterBufferiv)( GLuint program, GLuint bufferIndex, GLenum pname, GLint* params );
|
void (GL_APIENTRY * glGetActiveAtomicCounterBufferiv)( GLuint program, GLuint bufferIndex, GLenum pname, GLint* params );
|
||||||
void (GL_APIENTRY * glDispatchCompute)( GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ );
|
void (GL_APIENTRY * glDispatchCompute)( GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ );
|
||||||
|
GLuint64EXT (GL_APIENTRY* glGetTextureHandle)(GLint texture);
|
||||||
|
void (GL_APIENTRY* glMakeTextureHandleResident)(GLuint64EXT handle);
|
||||||
|
void (GL_APIENTRY* glMakeTextureHandleNonResident)(GLuint64EXT handle);
|
||||||
|
void (GL_APIENTRY* glUniformHandleui64)(GLint location, GLuint64EXT handle);
|
||||||
|
GLboolean (GL_APIENTRY* glIsTextureHandleResident)(GLuint64EXT handle);
|
||||||
|
|
||||||
// Buffer Object extensions
|
// Buffer Object extensions
|
||||||
bool isBufferObjectSupported;
|
bool isBufferObjectSupported;
|
||||||
|
@ -439,6 +439,9 @@ class OSG_EXPORT Uniform : public Object
|
|||||||
BOOL_VEC3 = GL_BOOL_VEC3,
|
BOOL_VEC3 = GL_BOOL_VEC3,
|
||||||
BOOL_VEC4 = GL_BOOL_VEC4,
|
BOOL_VEC4 = GL_BOOL_VEC4,
|
||||||
|
|
||||||
|
INT64 = GL_INT64_ARB,
|
||||||
|
UNSIGNED_INT64 = GL_UNSIGNED_INT64_ARB,
|
||||||
|
|
||||||
FLOAT_MAT2 = GL_FLOAT_MAT2,
|
FLOAT_MAT2 = GL_FLOAT_MAT2,
|
||||||
FLOAT_MAT3 = GL_FLOAT_MAT3,
|
FLOAT_MAT3 = GL_FLOAT_MAT3,
|
||||||
FLOAT_MAT4 = GL_FLOAT_MAT4,
|
FLOAT_MAT4 = GL_FLOAT_MAT4,
|
||||||
@ -603,6 +606,8 @@ class OSG_EXPORT Uniform : public Object
|
|||||||
explicit Uniform( const char* name, int i );
|
explicit Uniform( const char* name, int i );
|
||||||
explicit Uniform( const char* name, unsigned int ui );
|
explicit Uniform( const char* name, unsigned int ui );
|
||||||
explicit Uniform( const char* name, bool b );
|
explicit Uniform( const char* name, bool b );
|
||||||
|
explicit Uniform( const char* name, unsigned long long ull);
|
||||||
|
explicit Uniform( const char* name, long long ll );
|
||||||
Uniform( const char* name, const osg::Vec2& v2 );
|
Uniform( const char* name, const osg::Vec2& v2 );
|
||||||
Uniform( const char* name, const osg::Vec3& v3 );
|
Uniform( const char* name, const osg::Vec3& v3 );
|
||||||
Uniform( const char* name, const osg::Vec4& v4 );
|
Uniform( const char* name, const osg::Vec4& v4 );
|
||||||
@ -679,6 +684,8 @@ class OSG_EXPORT Uniform : public Object
|
|||||||
bool set( int i );
|
bool set( int i );
|
||||||
bool set( unsigned int ui );
|
bool set( unsigned int ui );
|
||||||
bool set( bool b );
|
bool set( bool b );
|
||||||
|
bool set( unsigned long long ull );
|
||||||
|
bool set( long long ll );
|
||||||
bool set( const osg::Vec2& v2 );
|
bool set( const osg::Vec2& v2 );
|
||||||
bool set( const osg::Vec3& v3 );
|
bool set( const osg::Vec3& v3 );
|
||||||
bool set( const osg::Vec4& v4 );
|
bool set( const osg::Vec4& v4 );
|
||||||
@ -719,6 +726,8 @@ class OSG_EXPORT Uniform : public Object
|
|||||||
bool get( int& i ) const;
|
bool get( int& i ) const;
|
||||||
bool get( unsigned int& ui ) const;
|
bool get( unsigned int& ui ) const;
|
||||||
bool get( bool& b ) const;
|
bool get( bool& b ) const;
|
||||||
|
bool get( unsigned long long & ull ) const;
|
||||||
|
bool get( long long& ll ) const;
|
||||||
bool get( osg::Vec2& v2 ) const;
|
bool get( osg::Vec2& v2 ) const;
|
||||||
bool get( osg::Vec3& v3 ) const;
|
bool get( osg::Vec3& v3 ) const;
|
||||||
bool get( osg::Vec4& v4 ) const;
|
bool get( osg::Vec4& v4 ) const;
|
||||||
@ -759,6 +768,8 @@ class OSG_EXPORT Uniform : public Object
|
|||||||
bool setElement( unsigned int index, int i );
|
bool setElement( unsigned int index, int i );
|
||||||
bool setElement( unsigned int index, unsigned int ui );
|
bool setElement( unsigned int index, unsigned int ui );
|
||||||
bool setElement( unsigned int index, bool b );
|
bool setElement( unsigned int index, bool b );
|
||||||
|
bool setElement( unsigned int index, unsigned long long ull );
|
||||||
|
bool setElement( unsigned int index, long long ll );
|
||||||
bool setElement( unsigned int index, const osg::Vec2& v2 );
|
bool setElement( unsigned int index, const osg::Vec2& v2 );
|
||||||
bool setElement( unsigned int index, const osg::Vec3& v3 );
|
bool setElement( unsigned int index, const osg::Vec3& v3 );
|
||||||
bool setElement( unsigned int index, const osg::Vec4& v4 );
|
bool setElement( unsigned int index, const osg::Vec4& v4 );
|
||||||
@ -799,6 +810,8 @@ class OSG_EXPORT Uniform : public Object
|
|||||||
bool getElement( unsigned int index, int& i ) const;
|
bool getElement( unsigned int index, int& i ) const;
|
||||||
bool getElement( unsigned int index, unsigned int& ui ) const;
|
bool getElement( unsigned int index, unsigned int& ui ) const;
|
||||||
bool getElement( unsigned int index, bool& b ) const;
|
bool getElement( unsigned int index, bool& b ) const;
|
||||||
|
bool getElement( unsigned int index, unsigned long long & ull ) const;
|
||||||
|
bool getElement( unsigned int index, long long& ll ) const;
|
||||||
bool getElement( unsigned int index, osg::Vec2& v2 ) const;
|
bool getElement( unsigned int index, osg::Vec2& v2 ) const;
|
||||||
bool getElement( unsigned int index, osg::Vec3& v3 ) const;
|
bool getElement( unsigned int index, osg::Vec3& v3 ) const;
|
||||||
bool getElement( unsigned int index, osg::Vec4& v4 ) const;
|
bool getElement( unsigned int index, osg::Vec4& v4 ) const;
|
||||||
@ -866,7 +879,8 @@ class OSG_EXPORT Uniform : public Object
|
|||||||
bool setArray( DoubleArray* array );
|
bool setArray( DoubleArray* array );
|
||||||
bool setArray( IntArray* array );
|
bool setArray( IntArray* array );
|
||||||
bool setArray( UIntArray* array );
|
bool setArray( UIntArray* array );
|
||||||
|
bool setArray( UInt64Array* array );
|
||||||
|
bool setArray( Int64Array* array );
|
||||||
/** Get the internal data array for a float osg::Uniform. */
|
/** Get the internal data array for a float osg::Uniform. */
|
||||||
FloatArray* getFloatArray() { return _floatArray.get(); }
|
FloatArray* getFloatArray() { return _floatArray.get(); }
|
||||||
const FloatArray* getFloatArray() const { return _floatArray.get(); }
|
const FloatArray* getFloatArray() const { return _floatArray.get(); }
|
||||||
@ -883,6 +897,14 @@ class OSG_EXPORT Uniform : public Object
|
|||||||
UIntArray* getUIntArray() { return _uintArray.get(); }
|
UIntArray* getUIntArray() { return _uintArray.get(); }
|
||||||
const UIntArray* getUIntArray() const { return _uintArray.get(); }
|
const UIntArray* getUIntArray() const { return _uintArray.get(); }
|
||||||
|
|
||||||
|
/** Get the internal data array for an unsigned int osg::Uniform. */
|
||||||
|
UInt64Array* getUInt64Array() { return _uint64Array.get(); }
|
||||||
|
const UInt64Array* getUInt64Array() const { return _uint64Array.get(); }
|
||||||
|
|
||||||
|
/** Get the internal data array for an unsigned int osg::Uniform. */
|
||||||
|
Int64Array* getInt64Array() { return _int64Array.get(); }
|
||||||
|
const Int64Array* getInt64Array() const { return _int64Array.get(); }
|
||||||
|
|
||||||
inline void setModifiedCount(unsigned int mc) { _modifiedCount = mc; }
|
inline void setModifiedCount(unsigned int mc) { _modifiedCount = mc; }
|
||||||
inline unsigned int getModifiedCount() const { return _modifiedCount; }
|
inline unsigned int getModifiedCount() const { return _modifiedCount; }
|
||||||
|
|
||||||
@ -922,6 +944,8 @@ class OSG_EXPORT Uniform : public Object
|
|||||||
ref_ptr<DoubleArray> _doubleArray;
|
ref_ptr<DoubleArray> _doubleArray;
|
||||||
ref_ptr<IntArray> _intArray;
|
ref_ptr<IntArray> _intArray;
|
||||||
ref_ptr<UIntArray> _uintArray;
|
ref_ptr<UIntArray> _uintArray;
|
||||||
|
ref_ptr<Int64Array> _int64Array;
|
||||||
|
ref_ptr<UInt64Array> _uint64Array;
|
||||||
|
|
||||||
ref_ptr<UniformCallback> _updateCallback;
|
ref_ptr<UniformCallback> _updateCallback;
|
||||||
ref_ptr<UniformCallback> _eventCallback;
|
ref_ptr<UniformCallback> _eventCallback;
|
||||||
|
@ -33,6 +33,7 @@ const int CHAR_SIZE = 1;
|
|||||||
const int SHORT_SIZE = 2;
|
const int SHORT_SIZE = 2;
|
||||||
const int INT_SIZE = 4;
|
const int INT_SIZE = 4;
|
||||||
const int LONG_SIZE = 4;
|
const int LONG_SIZE = 4;
|
||||||
|
const int INT64_SIZE = 8;
|
||||||
const int FLOAT_SIZE = 4;
|
const int FLOAT_SIZE = 4;
|
||||||
const int DOUBLE_SIZE = 8;
|
const int DOUBLE_SIZE = 8;
|
||||||
const int GLENUM_SIZE = 4;
|
const int GLENUM_SIZE = 4;
|
||||||
@ -71,6 +72,9 @@ const int ID_VEC2UI_ARRAY = 29;
|
|||||||
const int ID_VEC3UI_ARRAY = 30;
|
const int ID_VEC3UI_ARRAY = 30;
|
||||||
const int ID_VEC4UI_ARRAY = 31;
|
const int ID_VEC4UI_ARRAY = 31;
|
||||||
|
|
||||||
|
const int ID_UINT64_ARRAY = 32;
|
||||||
|
const int ID_INT64_ARRAY = 33;
|
||||||
|
|
||||||
const int ID_DRAWARRAYS = 50;
|
const int ID_DRAWARRAYS = 50;
|
||||||
const int ID_DRAWARRAY_LENGTH = 51;
|
const int ID_DRAWARRAY_LENGTH = 51;
|
||||||
const int ID_DRAWELEMENTS_UBYTE = 52;
|
const int ID_DRAWELEMENTS_UBYTE = 52;
|
||||||
|
@ -102,6 +102,8 @@ public:
|
|||||||
OutputStream& operator<<( unsigned long l ) { _out->writeULong(l); return *this; }
|
OutputStream& operator<<( unsigned long l ) { _out->writeULong(l); return *this; }
|
||||||
OutputStream& operator<<( float f ) { _out->writeFloat(f); return *this; }
|
OutputStream& operator<<( float f ) { _out->writeFloat(f); return *this; }
|
||||||
OutputStream& operator<<( double d ) { _out->writeDouble(d); return *this; }
|
OutputStream& operator<<( double d ) { _out->writeDouble(d); return *this; }
|
||||||
|
OutputStream& operator<<( long long ll ) { _out->writeInt64(ll); return *this; }
|
||||||
|
OutputStream& operator<<( unsigned long long ull ) { _out->writeUInt64(ull); return *this; }
|
||||||
OutputStream& operator<<( const std::string& s ) { _out->writeString(s); return *this; }
|
OutputStream& operator<<( const std::string& s ) { _out->writeString(s); return *this; }
|
||||||
OutputStream& operator<<( const char* s ) { _out->writeString(s); return *this; }
|
OutputStream& operator<<( const char* s ) { _out->writeString(s); return *this; }
|
||||||
OutputStream& operator<<( std::ostream& (*fn)(std::ostream&) ) { _out->writeStream(fn); return *this; }
|
OutputStream& operator<<( std::ostream& (*fn)(std::ostream&) ) { _out->writeStream(fn); return *this; }
|
||||||
|
@ -37,6 +37,8 @@ public:
|
|||||||
virtual void writeUInt( unsigned int i ) = 0;
|
virtual void writeUInt( unsigned int i ) = 0;
|
||||||
virtual void writeLong( long l ) = 0;
|
virtual void writeLong( long l ) = 0;
|
||||||
virtual void writeULong( unsigned long l ) = 0;
|
virtual void writeULong( unsigned long l ) = 0;
|
||||||
|
virtual void writeInt64( int64_t ll ) = 0;
|
||||||
|
virtual void writeUInt64( uint64_t ull ) = 0;
|
||||||
virtual void writeFloat( float f ) = 0;
|
virtual void writeFloat( float f ) = 0;
|
||||||
virtual void writeDouble( double d ) = 0;
|
virtual void writeDouble( double d ) = 0;
|
||||||
virtual void writeString( const std::string& s ) = 0;
|
virtual void writeString( const std::string& s ) = 0;
|
||||||
|
@ -58,6 +58,8 @@ public:
|
|||||||
virtual void writeULong( unsigned long l ) { write(l); }
|
virtual void writeULong( unsigned long l ) { write(l); }
|
||||||
virtual void writeFloat( float f ) { write(f); }
|
virtual void writeFloat( float f ) { write(f); }
|
||||||
virtual void writeDouble( double d ) { write(d); }
|
virtual void writeDouble( double d ) { write(d); }
|
||||||
|
virtual void writeInt64( long long ll ) { write(ll); }
|
||||||
|
virtual void writeUInt64( unsigned long long ull ) { write(ull); }
|
||||||
virtual void writeString( const std::string& s ) { _str.insert(_str.end(), s.begin(), s.end()); }
|
virtual void writeString( const std::string& s ) { _str.insert(_str.end(), s.begin(), s.end()); }
|
||||||
virtual void writeStream( std::ostream& (*)(std::ostream&) ) {}
|
virtual void writeStream( std::ostream& (*)(std::ostream&) ) {}
|
||||||
virtual void writeBase( std::ios_base& (*)(std::ios_base&) ) {}
|
virtual void writeBase( std::ios_base& (*)(std::ios_base&) ) {}
|
||||||
|
@ -497,6 +497,34 @@ void DataOutputStream::writeVec4b(const osg::Vec4b& v){
|
|||||||
|
|
||||||
if (_verboseOutput) std::cout<<"read/writeVec4b() ["<<v<<"]"<<std::endl;
|
if (_verboseOutput) std::cout<<"read/writeVec4b() ["<<v<<"]"<<std::endl;
|
||||||
}
|
}
|
||||||
|
void DataOutputStream::writeUInt64(unsigned long long ull){
|
||||||
|
_ostream->write((char*)&ull, INT64SIZE);
|
||||||
|
|
||||||
|
if (_verboseOutput) std::cout<<"read/writeUInt64() ["<<ull<<"]"<<std::endl;
|
||||||
|
}
|
||||||
|
void DataOutputStream::writeInt64(long long ll){
|
||||||
|
_ostream->write((char*)&ll, INT64SIZE);
|
||||||
|
|
||||||
|
if (_verboseOutput) std::cout<<"read/writeInt64() ["<<ll<<"]"<<std::endl;
|
||||||
|
}
|
||||||
|
void DataOutputStream::writeUInt64Array(const osg::UInt64Array* a){
|
||||||
|
int size = a->getNumElements();
|
||||||
|
writeUInt64(size);
|
||||||
|
for(int i =0; i<size ;i++){
|
||||||
|
writeInt((*a)[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_verboseOutput) std::cout<<"read/writeUInt64Array() ["<<size<<"]"<<std::endl;
|
||||||
|
}
|
||||||
|
void DataOutputStream::writeInt64Array(const osg::Int64Array* a){
|
||||||
|
int size = a->getNumElements();
|
||||||
|
writeInt64(size);
|
||||||
|
for(int i =0; i<size ;i++){
|
||||||
|
writeInt((*a)[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_verboseOutput) std::cout<<"read/writeInt64Array() ["<<size<<"]"<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
void DataOutputStream::writeQuat(const osg::Quat& q){
|
void DataOutputStream::writeQuat(const osg::Quat& q){
|
||||||
writeFloat(q.x());
|
writeFloat(q.x());
|
||||||
@ -589,10 +617,14 @@ void DataOutputStream::writeArray(const osg::Array* a){
|
|||||||
writeChar((char)16);
|
writeChar((char)16);
|
||||||
writeVec3dArray(static_cast<const osg::Vec3dArray*>(a));
|
writeVec3dArray(static_cast<const osg::Vec3dArray*>(a));
|
||||||
break;
|
break;
|
||||||
case osg::Array::Vec4dArrayType:
|
case osg::Array::Vec4dArrayType:
|
||||||
writeChar((char)17);
|
writeChar((char)17);
|
||||||
writeVec4dArray(static_cast<const osg::Vec4dArray*>(a));
|
writeVec4dArray(static_cast<const osg::Vec4dArray*>(a));
|
||||||
break;
|
break;
|
||||||
|
case osg::Array::UInt64ArrayType:
|
||||||
|
writeChar((char)18);
|
||||||
|
writeUInt64Array(static_cast<const osg::UInt64Array*>(a));
|
||||||
|
break;
|
||||||
default: throwException("Unknown array type in DataOutputStream::writeArray()");
|
default: throwException("Unknown array type in DataOutputStream::writeArray()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,11 @@ public:
|
|||||||
void writeVec2b(const osg::Vec2b& v);
|
void writeVec2b(const osg::Vec2b& v);
|
||||||
void writeVec3b(const osg::Vec3b& v);
|
void writeVec3b(const osg::Vec3b& v);
|
||||||
void writeVec4b(const osg::Vec4b& v);
|
void writeVec4b(const osg::Vec4b& v);
|
||||||
|
|
||||||
|
void writeUInt64(unsigned long long ull);
|
||||||
|
void writeInt64(long long ll);
|
||||||
|
void writeUInt64Array(const osg::UInt64Array* a);
|
||||||
|
void writeInt64Array(const osg::Int64Array* a);
|
||||||
void writePackedFloatArray(const osg::FloatArray* a, float maxError);
|
void writePackedFloatArray(const osg::FloatArray* a, float maxError);
|
||||||
|
|
||||||
void writeFloatArray(const osg::FloatArray* a);
|
void writeFloatArray(const osg::FloatArray* a);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#define FLOATSIZE 4
|
#define FLOATSIZE 4
|
||||||
#define LONGSIZE 4
|
#define LONGSIZE 4
|
||||||
#define DOUBLESIZE 8
|
#define DOUBLESIZE 8
|
||||||
|
#define INT64SIZE 8
|
||||||
//Don't know where else to put this
|
//Don't know where else to put this
|
||||||
namespace ive{
|
namespace ive{
|
||||||
|
|
||||||
|
@ -49,6 +49,12 @@ public:
|
|||||||
virtual void writeULong( unsigned long l )
|
virtual void writeULong( unsigned long l )
|
||||||
{ indentIfRequired(); *_out << l << ' '; }
|
{ indentIfRequired(); *_out << l << ' '; }
|
||||||
|
|
||||||
|
virtual void writeInt64( long long ll )
|
||||||
|
{ indentIfRequired(); *_out << ll << ' '; }
|
||||||
|
|
||||||
|
virtual void writeUInt64( unsigned long long ull )
|
||||||
|
{ indentIfRequired(); *_out << ull << ' '; }
|
||||||
|
|
||||||
virtual void writeFloat( float f )
|
virtual void writeFloat( float f )
|
||||||
{ indentIfRequired(); *_out << f << ' '; }
|
{ indentIfRequired(); *_out << f << ' '; }
|
||||||
|
|
||||||
|
@ -49,6 +49,18 @@ public:
|
|||||||
_out->write( (char*)&value, osgDB::LONG_SIZE );
|
_out->write( (char*)&value, osgDB::LONG_SIZE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void writeInt64( int64_t ll )
|
||||||
|
{_out->write( (char*)&ll, osgDB::INT64_SIZE );}
|
||||||
|
|
||||||
|
virtual void writeUInt64( uint64_t ull )
|
||||||
|
{_out->write( (char*)&ull, osgDB::INT64_SIZE );}
|
||||||
|
|
||||||
|
virtual void writeInt( long long ll )
|
||||||
|
{ _out->write( (char*)&ll, osgDB::INT64_SIZE ); }
|
||||||
|
|
||||||
|
virtual void writeUInt( unsigned long long ull )
|
||||||
|
{ _out->write( (char*)&ull, osgDB::INT64_SIZE ); }
|
||||||
|
|
||||||
virtual void writeFloat( float f )
|
virtual void writeFloat( float f )
|
||||||
{ _out->write( (char*)&f, osgDB::FLOAT_SIZE ); }
|
{ _out->write( (char*)&f, osgDB::FLOAT_SIZE ); }
|
||||||
|
|
||||||
|
@ -59,6 +59,18 @@ public:
|
|||||||
virtual void writeULong( unsigned long l )
|
virtual void writeULong( unsigned long l )
|
||||||
{ _sstream << l; addToCurrentNode( _sstream.str() ); _sstream.str(""); }
|
{ _sstream << l; addToCurrentNode( _sstream.str() ); _sstream.str(""); }
|
||||||
|
|
||||||
|
virtual void writeUInt64(uint64_t ull)
|
||||||
|
{_sstream << ull; addToCurrentNode( _sstream.str() ); _sstream.str("");}
|
||||||
|
|
||||||
|
virtual void writeInt64(int64_t ll)
|
||||||
|
{_sstream << ll; addToCurrentNode( _sstream.str() ); _sstream.str("");}
|
||||||
|
|
||||||
|
virtual void writeInt( unsigned long long ull )
|
||||||
|
{ _sstream << ull; addToCurrentNode( _sstream.str() ); _sstream.str(""); }
|
||||||
|
|
||||||
|
virtual void writeUInt( long long ll )
|
||||||
|
{ _sstream << ll; addToCurrentNode( _sstream.str() ); _sstream.str(""); }
|
||||||
|
|
||||||
virtual void writeFloat( float f )
|
virtual void writeFloat( float f )
|
||||||
{ _sstream << f; addToCurrentNode( _sstream.str() ); _sstream.str(""); }
|
{ _sstream << f; addToCurrentNode( _sstream.str() ); _sstream.str(""); }
|
||||||
|
|
||||||
|
@ -995,6 +995,21 @@ bool Array_writeLocalData(const Array& array,Output& fw)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case(Array::UInt64ArrayType):
|
||||||
|
{
|
||||||
|
fw<<array.className()<<" "<<array.getNumElements()<<std::endl;
|
||||||
|
const UInt64Array::ElementDataType* base = static_cast<const UInt64Array::ElementDataType*>(array.getDataPointer());
|
||||||
|
writeArray(fw,&base[0], &base[array.getNumElements()]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case(Array::Int64ArrayType):
|
||||||
|
{
|
||||||
|
fw<<array.className()<<" "<<array.getNumElements()<<std::endl;
|
||||||
|
const Int64Array::ElementDataType* base = static_cast<const Int64Array::ElementDataType*>(array.getDataPointer());
|
||||||
|
writeArray(fw,&base[0], &base[array.getNumElements()]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case(Array::ArrayType):
|
case(Array::ArrayType):
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user