summaryrefslogtreecommitdiff
path: root/indra/llrender/llvertexbuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llvertexbuffer.cpp')
-rw-r--r--indra/llrender/llvertexbuffer.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 2eb7c21f77..156e300853 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -570,6 +570,54 @@ public:
static LLVBOPool* sVBOPool = nullptr;
+void LLVertexBufferData::draw()
+{
+ if (!mVB)
+ {
+ llassert(false);
+ // Not supposed to happen, check buffer generation
+ return;
+ }
+
+ if (mTexName)
+ {
+ gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTexName);
+ }
+ else
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadMatrix(mModelView.m);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadMatrix(mProjection.m);
+ gGL.matrixMode(LLRender::MM_TEXTURE0);
+ gGL.pushMatrix();
+ gGL.loadMatrix(mTexture0.m);
+
+ mVB->setBuffer();
+
+ if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile)
+ {
+ mVB->drawArrays(LLRender::TRIANGLES, 0, mCount);
+ }
+ else
+ {
+ mVB->drawArrays(mMode, 0, mCount);
+ }
+
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
+}
+
+//============================================================================
+
//static
U64 LLVertexBuffer::getBytesAllocated()
{
@@ -794,6 +842,18 @@ void LLVertexBuffer::setLabel(const char* label) {
}
#endif
+void LLVertexBuffer::clone(LLVertexBuffer& target) const
+{
+ target.mTypeMask = mTypeMask;
+ target.mIndicesType = mIndicesType;
+ target.mIndicesStride = mIndicesStride;
+ if (target.getNumVerts() != getNumVerts() ||
+ target.getNumIndices() != getNumIndices())
+ {
+ target.allocateBuffer(getNumVerts(), getNumIndices());
+ }
+}
+
void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const
{
llassert(validateRange(start, end, count, indices_offset));