Added ShyotlRenderVBOStrideMode to toggle between strided and unstrided VBOs.
This commit is contained in:
@@ -90,6 +90,7 @@ public:
|
||||
static S32 sWeight4Loc;
|
||||
|
||||
static BOOL sUseStreamDraw;
|
||||
static U32 sForceStrideMode;
|
||||
static BOOL sOmitBlank;
|
||||
static BOOL sPreferStreamDraw;
|
||||
|
||||
@@ -102,11 +103,15 @@ public:
|
||||
static void unbind(); //unbind any bound vertex buffer
|
||||
|
||||
//get the size of a vertex with the given typemask
|
||||
//if offsets is not NULL, its contents will be filled
|
||||
//with the offset of each vertex component in the buffer,
|
||||
// indexed by the following enum
|
||||
static S32 calcStride(const U32& typemask, S32* offsets = NULL);
|
||||
static S32 calcVertexSize(const U32& typemask);
|
||||
|
||||
//get the size of a buffer with the given typemask and vertex count
|
||||
//fill offsets with the offset of each vertex component array into the buffer
|
||||
// indexed by the following enum
|
||||
//If strided, num_vertices will be ignored.
|
||||
S32 calcOffsets(const U32& typemask, S32* offsets, S32 num_vertices);
|
||||
|
||||
|
||||
enum {
|
||||
TYPE_VERTEX,
|
||||
TYPE_NORMAL,
|
||||
@@ -162,11 +167,11 @@ protected:
|
||||
void allocateClientIndexBuffer() ;
|
||||
|
||||
public:
|
||||
LLVertexBuffer(U32 typemask, S32 usage);
|
||||
LLVertexBuffer(U32 typemask, S32 usage, bool strided=true);
|
||||
|
||||
// map for data access
|
||||
volatile U8* mapVertexBuffer(S32 type = -1, S32 access = -1);
|
||||
volatile U8* mapIndexBuffer(S32 access = -1);
|
||||
volatile U8* mapVertexBuffer(S32 type, S32 index);
|
||||
volatile U8* mapIndexBuffer(S32 index);
|
||||
|
||||
// set for rendering
|
||||
virtual void setBuffer(U32 data_mask, S32 type = -1); // calls setupVertexBuffer() if data_mask is not 0
|
||||
@@ -201,17 +206,15 @@ public:
|
||||
|
||||
volatile U8* getIndicesPointer() const { return useVBOs() ? (U8*) mAlignedIndexOffset : mMappedIndexData; }
|
||||
volatile U8* getVerticesPointer() const { return useVBOs() ? (U8*) mAlignedOffset : mMappedData; }
|
||||
S32 getStride() const { return mStride; }
|
||||
S32 getTypeMask() const { return mTypeMask; }
|
||||
BOOL hasDataType(S32 type) const { return ((1 << type) & getTypeMask()) ? TRUE : FALSE; }
|
||||
S32 getSize() const { return mNumVerts*mStride; }
|
||||
S32 getStride(S32 type) const { return mIsStrided ? mStride : sTypeSize[type]; }
|
||||
U32 getTypeMask() const { return mTypeMask; }
|
||||
bool hasDataType(S32 type) const { return ((1 << type) & getTypeMask()); }
|
||||
S32 getSize() const;
|
||||
S32 getIndicesSize() const { return mNumIndices * sizeof(U16); }
|
||||
volatile U8* getMappedData() const { return mMappedData; }
|
||||
volatile U8* getMappedIndices() const { return mMappedIndexData; }
|
||||
S32 getOffset(S32 type) const { return mOffsets[type]; }
|
||||
S32 getUsage() const { return mUsage; }
|
||||
|
||||
void setStride(S32 type, S32 new_stride);
|
||||
|
||||
void draw(U32 mode, U32 count, U32 indices_offset) const;
|
||||
void drawArrays(U32 mode, U32 offset, U32 count) const;
|
||||
@@ -230,7 +233,9 @@ protected:
|
||||
|
||||
ptrdiff_t mAlignedOffset;
|
||||
ptrdiff_t mAlignedIndexOffset;
|
||||
S32 mStride;
|
||||
bool mIsStrided;
|
||||
S32 mStride; // Vertex size.
|
||||
S32 mSize; // Full array size
|
||||
U32 mTypeMask;
|
||||
S32 mUsage; // GL usage
|
||||
U32 mGLBuffer; // GL VBO handle
|
||||
|
||||
Reference in New Issue
Block a user