Added VertexBufferObject and ElementBufferObject class interfaces, and wired
up osg::Array and osg::DrawElements* to these respectively. Updated wrappers
This commit is contained in:
@@ -276,8 +276,92 @@ void BufferObject::Extensions::glGetBufferPointerv (GLenum target, GLenum pname,
|
||||
else notify(WARN)<<"Error: glGetBufferPointerv not supported by OpenGL driver"<<std::endl;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// VertexBufferObject
|
||||
//
|
||||
VertexBufferObject::VertexBufferObject()
|
||||
{
|
||||
}
|
||||
|
||||
VertexBufferObject::VertexBufferObject(const VertexBufferObject& vbo,const CopyOp& copyop):
|
||||
BufferObject(vbo,copyop)
|
||||
{
|
||||
}
|
||||
|
||||
VertexBufferObject::~VertexBufferObject()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int VertexBufferObject::addArray(osg::Array* array)
|
||||
{
|
||||
unsigned int i = _bufferEntryArrayPairs.size();
|
||||
_bufferEntryArrayPairs.resize(i+1);
|
||||
_bufferEntryArrayPairs[i].second = array;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void VertexBufferObject::setArray(unsigned int i, Array* array)
|
||||
{
|
||||
if (i+1>=_bufferEntryArrayPairs.size()) _bufferEntryArrayPairs.resize(i+1);
|
||||
|
||||
_bufferEntryArrayPairs[i].second = array;
|
||||
}
|
||||
|
||||
bool VertexBufferObject::needsCompile(unsigned int contextID) const
|
||||
{
|
||||
}
|
||||
|
||||
void VertexBufferObject::compileBuffer(State& state) const
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ElementsBufferObject
|
||||
//
|
||||
ElementsBufferObject::ElementsBufferObject()
|
||||
{
|
||||
}
|
||||
|
||||
ElementsBufferObject::ElementsBufferObject(const ElementsBufferObject& vbo,const CopyOp& copyop):
|
||||
BufferObject(vbo,copyop)
|
||||
{
|
||||
}
|
||||
|
||||
ElementsBufferObject::~ElementsBufferObject()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int ElementsBufferObject::addDrawElements(osg::DrawElements* DrawElements)
|
||||
{
|
||||
unsigned int i = _bufferEntryDrawElementsPairs.size();
|
||||
_bufferEntryDrawElementsPairs.resize(i+1);
|
||||
_bufferEntryDrawElementsPairs[i].second = DrawElements;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void ElementsBufferObject::setDrawElements(unsigned int i, DrawElements* DrawElements)
|
||||
{
|
||||
if (i+1>=_bufferEntryDrawElementsPairs.size()) _bufferEntryDrawElementsPairs.resize(i+1);
|
||||
|
||||
_bufferEntryDrawElementsPairs[i].second = DrawElements;
|
||||
}
|
||||
|
||||
bool ElementsBufferObject::needsCompile(unsigned int contextID) const
|
||||
{
|
||||
}
|
||||
|
||||
void ElementsBufferObject::compileBuffer(State& state) const
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PixelBufferObject
|
||||
//
|
||||
PixelBufferObject::PixelBufferObject(osg::Image* image):
|
||||
BufferObject()
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/Array>
|
||||
#include <osg/BufferObject>
|
||||
#include <osg/CopyOp>
|
||||
#include <osg/Object>
|
||||
#include <osg/Vec2>
|
||||
@@ -153,6 +154,31 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Array)
|
||||
__unsigned_int__getModifiedCount,
|
||||
"Get modified count value. ",
|
||||
"");
|
||||
I_Method1(void, setVertexBufferObject, IN, osg::VertexBufferObject *, vbo,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setVertexBufferObject__osg_VertexBufferObject_P1,
|
||||
"Set the VertexBufferObject. ",
|
||||
"");
|
||||
I_Method0(osg::VertexBufferObject *, getVertexBufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_VertexBufferObject_P1__getVertexBufferObject,
|
||||
"Get the VertexBufferObject. ",
|
||||
"If no VBO is assigned returns NULL ");
|
||||
I_Method0(const osg::VertexBufferObject *, getVertexBufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_osg_VertexBufferObject_P1__getVertexBufferObject,
|
||||
"Get the const VertexBufferObject. ",
|
||||
"If no VBO is assigned returns NULL ");
|
||||
I_Method1(void, setVertexBufferObjectIndex, IN, unsigned int, index,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setVertexBufferObjectIndex__unsigned_int,
|
||||
"Set the index into the VertexBufferObject, if used. ",
|
||||
"");
|
||||
I_Method0(unsigned int, getVertexBufferObjectIndex,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__getVertexBufferObjectIndex,
|
||||
"Get the index into the VertexBufferObject, if used. ",
|
||||
"");
|
||||
I_SimpleProperty(const GLvoid *, DataPointer,
|
||||
__C5_GLvoid_P1__getDataPointer,
|
||||
0);
|
||||
@@ -171,6 +197,12 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Array)
|
||||
I_SimpleProperty(osg::Array::Type, Type,
|
||||
__Type__getType,
|
||||
0);
|
||||
I_SimpleProperty(osg::VertexBufferObject *, VertexBufferObject,
|
||||
__osg_VertexBufferObject_P1__getVertexBufferObject,
|
||||
__void__setVertexBufferObject__osg_VertexBufferObject_P1);
|
||||
I_SimpleProperty(unsigned int, VertexBufferObjectIndex,
|
||||
__unsigned_int__getVertexBufferObjectIndex,
|
||||
__void__setVertexBufferObjectIndex__unsigned_int);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_VALUE_REFLECTOR(osg::ArrayVisitor)
|
||||
|
||||
@@ -10,10 +10,12 @@
|
||||
#include <osgIntrospection/StaticMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/Array>
|
||||
#include <osg/BufferObject>
|
||||
#include <osg/CopyOp>
|
||||
#include <osg/Image>
|
||||
#include <osg/Object>
|
||||
#include <osg/PrimitiveSet>
|
||||
#include <osg/State>
|
||||
|
||||
// Must undefine IN and OUT macros defined in Windows headers
|
||||
@@ -217,6 +219,80 @@ BEGIN_OBJECT_REFLECTOR(osg::BufferObject::Extensions)
|
||||
|
||||
|
||||
|
||||
END_REFLECTOR
|
||||
|
||||
TYPE_NAME_ALIAS(std::pair< osg::BufferObject::BufferEntry COMMA osg::DrawElements * >, osg::ElementsBufferObject::BufferEntryDrawElementstPair)
|
||||
|
||||
TYPE_NAME_ALIAS(std::vector< osg::ElementsBufferObject::BufferEntryDrawElementstPair >, osg::ElementsBufferObject::BufferEntryDrawElementsPairs)
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osg::ElementsBufferObject)
|
||||
I_BaseType(osg::BufferObject);
|
||||
I_Constructor0(____ElementsBufferObject,
|
||||
"",
|
||||
"");
|
||||
I_ConstructorWithDefaults2(IN, const osg::ElementsBufferObject &, pbo, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
|
||||
____ElementsBufferObject__C5_ElementsBufferObject_R1__C5_CopyOp_R1,
|
||||
"Copy constructor using CopyOp to manage deep vs shallow copy. ",
|
||||
"");
|
||||
I_Method0(osg::Object *, cloneType,
|
||||
Properties::VIRTUAL,
|
||||
__osg_Object_P1__cloneType,
|
||||
"Clone the type of an object, with Object* return type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop,
|
||||
Properties::VIRTUAL,
|
||||
__osg_Object_P1__clone__C5_osg_CopyOp_R1,
|
||||
"Clone an object, with Object* return type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
|
||||
Properties::VIRTUAL,
|
||||
__bool__isSameKindAs__C5_osg_Object_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const char *, libraryName,
|
||||
Properties::VIRTUAL,
|
||||
__C5_char_P1__libraryName,
|
||||
"return the name of the object's library. ",
|
||||
"Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. ");
|
||||
I_Method0(const char *, className,
|
||||
Properties::VIRTUAL,
|
||||
__C5_char_P1__className,
|
||||
"return the name of the object's class type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method1(unsigned int, addDrawElements, IN, osg::DrawElements *, PrimitiveSet,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__addDrawElements__osg_DrawElements_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method2(void, setDrawElements, IN, unsigned int, i, IN, osg::DrawElements *, PrimitiveSet,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setDrawElements__unsigned_int__DrawElements_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::DrawElements *, getDrawElements, IN, unsigned int, i,
|
||||
Properties::NON_VIRTUAL,
|
||||
__DrawElements_P1__getDrawElements__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(const osg::DrawElements *, getDrawElements, IN, unsigned int, i,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_DrawElements_P1__getDrawElements__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(bool, needsCompile, IN, unsigned int, contextID,
|
||||
Properties::VIRTUAL,
|
||||
__bool__needsCompile__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, compileBuffer, IN, osg::State &, state,
|
||||
Properties::VIRTUAL,
|
||||
__void__compileBuffer__State_R1,
|
||||
"",
|
||||
"");
|
||||
I_IndexedProperty(osg::DrawElements *, DrawElements,
|
||||
__DrawElements_P1__getDrawElements__unsigned_int,
|
||||
__void__setDrawElements__unsigned_int__DrawElements_P1,
|
||||
0);
|
||||
END_REFLECTOR
|
||||
|
||||
TYPE_NAME_ALIAS(std::pair< osg::BufferObject::BufferEntry COMMA osg::Image * >, osg::PixelBufferObject::BufferEntryImagePair)
|
||||
@@ -292,5 +368,87 @@ BEGIN_OBJECT_REFLECTOR(osg::PixelBufferObject)
|
||||
__void__setImage__osg_Image_P1);
|
||||
END_REFLECTOR
|
||||
|
||||
TYPE_NAME_ALIAS(std::pair< osg::BufferObject::BufferEntry COMMA osg::Array * >, osg::VertexBufferObject::BufferEntryArrayPair)
|
||||
|
||||
TYPE_NAME_ALIAS(std::vector< osg::VertexBufferObject::BufferEntryArrayPair >, osg::VertexBufferObject::BufferEntryArrayPairs)
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osg::VertexBufferObject)
|
||||
I_BaseType(osg::BufferObject);
|
||||
I_Constructor0(____VertexBufferObject,
|
||||
"",
|
||||
"");
|
||||
I_ConstructorWithDefaults2(IN, const osg::VertexBufferObject &, vbo, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
|
||||
____VertexBufferObject__C5_VertexBufferObject_R1__C5_CopyOp_R1,
|
||||
"Copy constructor using CopyOp to manage deep vs shallow copy. ",
|
||||
"");
|
||||
I_Method0(osg::Object *, cloneType,
|
||||
Properties::VIRTUAL,
|
||||
__osg_Object_P1__cloneType,
|
||||
"Clone the type of an object, with Object* return type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop,
|
||||
Properties::VIRTUAL,
|
||||
__osg_Object_P1__clone__C5_osg_CopyOp_R1,
|
||||
"Clone an object, with Object* return type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
|
||||
Properties::VIRTUAL,
|
||||
__bool__isSameKindAs__C5_osg_Object_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const char *, libraryName,
|
||||
Properties::VIRTUAL,
|
||||
__C5_char_P1__libraryName,
|
||||
"return the name of the object's library. ",
|
||||
"Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. ");
|
||||
I_Method0(const char *, className,
|
||||
Properties::VIRTUAL,
|
||||
__C5_char_P1__className,
|
||||
"return the name of the object's class type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method1(unsigned int, addArray, IN, osg::Array *, array,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__addArray__osg_Array_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method2(void, setArray, IN, unsigned int, i, IN, osg::Array *, array,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setArray__unsigned_int__Array_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Array *, getArray, IN, unsigned int, i,
|
||||
Properties::NON_VIRTUAL,
|
||||
__Array_P1__getArray__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(const osg::Array *, getArray, IN, unsigned int, i,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_Array_P1__getArray__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(bool, needsCompile, IN, unsigned int, contextID,
|
||||
Properties::VIRTUAL,
|
||||
__bool__needsCompile__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, compileBuffer, IN, osg::State &, state,
|
||||
Properties::VIRTUAL,
|
||||
__void__compileBuffer__State_R1,
|
||||
"",
|
||||
"");
|
||||
I_IndexedProperty(osg::Array *, Array,
|
||||
__Array_P1__getArray__unsigned_int,
|
||||
__void__setArray__unsigned_int__Array_P1,
|
||||
0);
|
||||
END_REFLECTOR
|
||||
|
||||
STD_PAIR_REFLECTOR(std::pair< osg::BufferObject::BufferEntry COMMA osg::Array * >)
|
||||
|
||||
STD_PAIR_REFLECTOR(std::pair< osg::BufferObject::BufferEntry COMMA osg::DrawElements * >)
|
||||
|
||||
STD_PAIR_REFLECTOR(std::pair< osg::BufferObject::BufferEntry COMMA osg::Image * >)
|
||||
|
||||
STD_VECTOR_REFLECTOR(std::vector< osg::ElementsBufferObject::BufferEntryDrawElementstPair >)
|
||||
|
||||
STD_VECTOR_REFLECTOR(std::vector< osg::VertexBufferObject::BufferEntryArrayPair >)
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <osgIntrospection/StaticMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/BufferObject>
|
||||
#include <osg/CopyOp>
|
||||
#include <osg/Object>
|
||||
#include <osg/PrimitiveSet>
|
||||
@@ -230,10 +231,53 @@ BEGIN_OBJECT_REFLECTOR(osg::DrawArrays)
|
||||
__void__setFirst__GLint);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::DrawElements)
|
||||
I_BaseType(osg::PrimitiveSet);
|
||||
I_ConstructorWithDefaults2(IN, osg::PrimitiveSet::Type, primType, osg::PrimitiveSet::PrimitiveType, IN, GLenum, mode, 0,
|
||||
____DrawElements__Type__GLenum,
|
||||
"",
|
||||
"");
|
||||
I_ConstructorWithDefaults2(IN, const osg::DrawElements &, copy, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
|
||||
____DrawElements__C5_DrawElements_R1__C5_CopyOp_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setElementsBufferObject, IN, osg::ElementsBufferObject *, ebo,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setElementsBufferObject__osg_ElementsBufferObject_P1,
|
||||
"Set the ElementsBufferObject. ",
|
||||
"");
|
||||
I_Method0(osg::ElementsBufferObject *, getElementsBufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_ElementsBufferObject_P1__getElementsBufferObject,
|
||||
"Get the ElementsBufferObject. ",
|
||||
"If no EBO is assigned returns NULL ");
|
||||
I_Method0(const osg::ElementsBufferObject *, getElementsBufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_osg_ElementsBufferObject_P1__getElementsBufferObject,
|
||||
"Get the const ElementsBufferObject. ",
|
||||
"If no EBO is assigned returns NULL ");
|
||||
I_Method1(void, setElementsBufferObjectIndex, IN, unsigned int, index,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setElementsBufferObjectIndex__unsigned_int,
|
||||
"Set the index into the ElementsBufferObject, if used. ",
|
||||
"");
|
||||
I_Method0(unsigned int, getElementsBufferObjectIndex,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__getElementsBufferObjectIndex,
|
||||
"Get the index into the ElementsBufferObject, if used. ",
|
||||
"");
|
||||
I_SimpleProperty(osg::ElementsBufferObject *, ElementsBufferObject,
|
||||
__osg_ElementsBufferObject_P1__getElementsBufferObject,
|
||||
__void__setElementsBufferObject__osg_ElementsBufferObject_P1);
|
||||
I_SimpleProperty(unsigned int, ElementsBufferObjectIndex,
|
||||
__unsigned_int__getElementsBufferObjectIndex,
|
||||
__void__setElementsBufferObjectIndex__unsigned_int);
|
||||
END_REFLECTOR
|
||||
|
||||
TYPE_NAME_ALIAS(osg::VectorGLubyte, osg::DrawElementsUByte::vector_type)
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osg::DrawElementsUByte)
|
||||
I_BaseType(osg::PrimitiveSet);
|
||||
I_BaseType(osg::DrawElements);
|
||||
I_BaseType(osg::VectorGLubyte);
|
||||
I_ConstructorWithDefaults1(IN, GLenum, mode, 0,
|
||||
Properties::NON_EXPLICIT,
|
||||
@@ -348,7 +392,7 @@ END_REFLECTOR
|
||||
TYPE_NAME_ALIAS(osg::VectorGLuint, osg::DrawElementsUInt::vector_type)
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osg::DrawElementsUInt)
|
||||
I_BaseType(osg::PrimitiveSet);
|
||||
I_BaseType(osg::DrawElements);
|
||||
I_BaseType(osg::VectorGLuint);
|
||||
I_ConstructorWithDefaults1(IN, GLenum, mode, 0,
|
||||
Properties::NON_EXPLICIT,
|
||||
@@ -463,7 +507,7 @@ END_REFLECTOR
|
||||
TYPE_NAME_ALIAS(osg::VectorGLushort, osg::DrawElementsUShort::vector_type)
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osg::DrawElementsUShort)
|
||||
I_BaseType(osg::PrimitiveSet);
|
||||
I_BaseType(osg::DrawElements);
|
||||
I_BaseType(osg::VectorGLushort);
|
||||
I_ConstructorWithDefaults1(IN, GLenum, mode, 0,
|
||||
Properties::NON_EXPLICIT,
|
||||
|
||||
Reference in New Issue
Block a user