Added osg::getBinding(osg::Array* array) convinience function that returns the Array::getBinding() is the array is not NULL, otherwise returns BIND_OFF.
This commit is contained in:
parent
7ee05a345a
commit
9f0bbbf831
@ -92,11 +92,11 @@ class OSG_EXPORT Array : public BufferData
|
|||||||
BIND_INSTANCE_DIVISOR_6=BIND_INSTANCE_DIVISOR_0+6,
|
BIND_INSTANCE_DIVISOR_6=BIND_INSTANCE_DIVISOR_0+6,
|
||||||
BIND_INSTANCE_DIVISOR_7=BIND_INSTANCE_DIVISOR_0+7
|
BIND_INSTANCE_DIVISOR_7=BIND_INSTANCE_DIVISOR_0+7
|
||||||
};
|
};
|
||||||
|
|
||||||
Array(Type arrayType=ArrayType,GLint dataSize=0,GLenum dataType=0, Binding=BIND_UNDEFINED):
|
Array(Type arrayType=ArrayType,GLint dataSize=0,GLenum dataType=0, Binding=BIND_UNDEFINED):
|
||||||
_arrayType(arrayType),
|
_arrayType(arrayType),
|
||||||
_dataSize(dataSize),
|
_dataSize(dataSize),
|
||||||
_dataType(dataType),
|
_dataType(dataType),
|
||||||
_binding(BIND_UNDEFINED),
|
_binding(BIND_UNDEFINED),
|
||||||
_normalize(false),
|
_normalize(false),
|
||||||
_preserveDataType(false) {}
|
_preserveDataType(false) {}
|
||||||
@ -127,7 +127,7 @@ class OSG_EXPORT Array : public BufferData
|
|||||||
Type getType() const { return _arrayType; }
|
Type getType() const { return _arrayType; }
|
||||||
GLint getDataSize() const { return _dataSize; }
|
GLint getDataSize() const { return _dataSize; }
|
||||||
GLenum getDataType() const { return _dataType; }
|
GLenum getDataType() const { return _dataType; }
|
||||||
|
|
||||||
virtual osg::Array* asArray() { return this; }
|
virtual osg::Array* asArray() { return this; }
|
||||||
virtual const osg::Array* asArray() const { return this; }
|
virtual const osg::Array* asArray() const { return this; }
|
||||||
|
|
||||||
@ -145,21 +145,21 @@ class OSG_EXPORT Array : public BufferData
|
|||||||
/** Get how this array should be passed to OpenGL.*/
|
/** Get how this array should be passed to OpenGL.*/
|
||||||
int getBinding() const { return _binding; }
|
int getBinding() const { return _binding; }
|
||||||
|
|
||||||
|
|
||||||
/** Specify whether the array data should be normalized by OpenGL.*/
|
/** Specify whether the array data should be normalized by OpenGL.*/
|
||||||
void setNormalize(bool normalize) { _normalize = normalize; }
|
void setNormalize(bool normalize) { _normalize = normalize; }
|
||||||
|
|
||||||
/** Get whether the array data should be normalized by OpenGL.*/
|
/** Get whether the array data should be normalized by OpenGL.*/
|
||||||
bool getNormalize() const { return _normalize; }
|
bool getNormalize() const { return _normalize; }
|
||||||
|
|
||||||
|
|
||||||
/** Set hint to ask that the array data is passed via integer or double, or normal setVertexAttribPointer function.*/
|
/** Set hint to ask that the array data is passed via integer or double, or normal setVertexAttribPointer function.*/
|
||||||
void setPreserveDataType(bool preserve) { _preserveDataType = preserve; }
|
void setPreserveDataType(bool preserve) { _preserveDataType = preserve; }
|
||||||
|
|
||||||
/** Get hint to ask that the array data is passed via integer or double, or normal setVertexAttribPointer function.*/
|
/** Get hint to ask that the array data is passed via integer or double, or normal setVertexAttribPointer function.*/
|
||||||
bool getPreserveDataType() const { return _preserveDataType; }
|
bool getPreserveDataType() const { return _preserveDataType; }
|
||||||
|
|
||||||
|
|
||||||
/** Frees unused space on this vector - i.e. the difference between size() and max_size() of the underlying vector.*/
|
/** Frees unused space on this vector - i.e. the difference between size() and max_size() of the underlying vector.*/
|
||||||
virtual void trim() {}
|
virtual void trim() {}
|
||||||
|
|
||||||
@ -184,6 +184,10 @@ class OSG_EXPORT Array : public BufferData
|
|||||||
bool _preserveDataType;
|
bool _preserveDataType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** convinience function for getting the binding of array via a ptr that may be null.*/
|
||||||
|
inline int getBinding(const osg::Array* array) { return array ? array->getBinding() : osg::Array::BIND_OFF; }
|
||||||
|
|
||||||
|
|
||||||
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
||||||
class TemplateArray : public Array, public MixinVector<T>
|
class TemplateArray : public Array, public MixinVector<T>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user