summaryrefslogtreecommitdiff
path: root/indra/llrender/llvertexbuffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llvertexbuffer.h')
-rw-r--r--indra/llrender/llvertexbuffer.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h
index 2a4affdc60..d4c6fbaf18 100644
--- a/indra/llrender/llvertexbuffer.h
+++ b/indra/llrender/llvertexbuffer.h
@@ -38,6 +38,7 @@
#include <set>
#include <vector>
#include <list>
+#include <glm/gtc/matrix_transform.hpp>
#define LL_MAX_VERTEX_ATTRIB_LOCATION 64
@@ -63,8 +64,11 @@ public:
, mMode(0)
, mCount(0)
, mTexName(0)
+ , mProjection(glm::identity<glm::mat4>())
+ , mModelView(glm::identity<glm::mat4>())
+ , mTexture0(glm::identity<glm::mat4>())
{}
- LLVertexBufferData(LLVertexBuffer* buffer, U8 mode, U32 count, U32 tex_name, glh::matrix4f model_view, glh::matrix4f projection, glh::matrix4f texture0)
+ LLVertexBufferData(LLVertexBuffer* buffer, U8 mode, U32 count, U32 tex_name, const glm::mat4& model_view, const glm::mat4& projection, const glm::mat4& texture0)
: mVB(buffer)
, mMode(mode)
, mCount(count)
@@ -78,9 +82,9 @@ public:
U8 mMode;
U32 mCount;
U32 mTexName;
- glh::matrix4f mProjection;
- glh::matrix4f mModelView;
- glh::matrix4f mTexture0;
+ glm::mat4 mProjection;
+ glm::mat4 mModelView;
+ glm::mat4 mTexture0;
};
typedef std::list<LLVertexBufferData> buffer_data_list_t;
@@ -120,6 +124,9 @@ public:
// indexed by the following enum
static U32 calcOffsets(const U32& typemask, U32* offsets, U32 num_vertices);
+ // flush any pending mapped buffers
+ static void flushBuffers();
+
//WARNING -- when updating these enums you MUST
// 1 - update LLVertexBuffer::sTypeSize
// 2 - update LLVertexBuffer::vb_type_name
@@ -190,6 +197,8 @@ public:
// map for data access (see also getFooStrider below)
U8* mapVertexBuffer(AttributeType type, U32 index, S32 count = -1);
U8* mapIndexBuffer(U32 index, S32 count = -1);
+
+ // synonym for flushBuffers
void unmapBuffer();
// set for rendering
@@ -312,6 +321,13 @@ private:
bool allocateBuffer(S32 nverts, S32 nindices, bool create) { return allocateBuffer(nverts, nindices); }
+ // actually unmap buffer
+ void _unmapBuffer();
+
+ // add to set of mapped buffers
+ void _mapBuffer();
+ bool mMapped = false;
+
public:
static U64 getBytesAllocated();