diff options
Diffstat (limited to 'indra/llrender/llrender.cpp')
-rw-r--r-- | indra/llrender/llrender.cpp | 97 |
1 files changed, 79 insertions, 18 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 5597b23c69..64238b2008 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -851,9 +851,9 @@ void LLRender::translateUI(F32 x, F32 y, F32 z) llerrs << "Need to push a UI translation frame before offsetting" << llendl; } - mUIOffset.front().mV[0] += x; - mUIOffset.front().mV[1] += y; - mUIOffset.front().mV[2] += z; + mUIOffset.back().mV[0] += x; + mUIOffset.back().mV[1] += y; + mUIOffset.back().mV[2] += z; } void LLRender::scaleUI(F32 x, F32 y, F32 z) @@ -863,27 +863,27 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z) llerrs << "Need to push a UI transformation frame before scaling." << llendl; } - mUIScale.front().scaleVec(LLVector3(x,y,z)); + mUIScale.back().scaleVec(LLVector3(x,y,z)); } void LLRender::pushUIMatrix() { if (mUIOffset.empty()) { - mUIOffset.push_front(LLVector3(0,0,0)); + mUIOffset.push_back(LLVector3(0,0,0)); } else { - mUIOffset.push_front(mUIOffset.front()); + mUIOffset.push_back(mUIOffset.back()); } if (mUIScale.empty()) { - mUIScale.push_front(LLVector3(1,1,1)); + mUIScale.push_back(LLVector3(1,1,1)); } else { - mUIScale.push_front(mUIScale.front()); + mUIScale.push_back(mUIScale.back()); } } @@ -893,8 +893,8 @@ void LLRender::popUIMatrix() { llerrs << "UI offset stack blown." << llendl; } - mUIOffset.pop_front(); - mUIScale.pop_front(); + mUIOffset.pop_back(); + mUIScale.pop_back(); } LLVector3 LLRender::getUITranslation() @@ -903,7 +903,7 @@ LLVector3 LLRender::getUITranslation() { llerrs << "UI offset stack empty." << llendl; } - return mUIOffset.front(); + return mUIOffset.back(); } LLVector3 LLRender::getUIScale() @@ -912,7 +912,7 @@ LLVector3 LLRender::getUIScale() { llerrs << "UI scale stack empty." << llendl; } - return mUIScale.front(); + return mUIScale.back(); } @@ -922,8 +922,8 @@ void LLRender::loadUIIdentity() { llerrs << "Need to push UI translation frame before clearing offset." << llendl; } - mUIOffset.front().setVec(0,0,0); - mUIScale.front().setVec(1,1,1); + mUIOffset.back().setVec(0,0,0); + mUIScale.back().setVec(1,1,1); } void LLRender::setColorMask(bool writeColor, bool writeAlpha) @@ -1210,18 +1210,79 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) } else { - LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.front()).scaledVec(mUIScale.front()); + LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back()); mVerticesp[mCount] = vert; } mCount++; - if (mCount < 4096) + mVerticesp[mCount] = mVerticesp[mCount-1]; + mColorsp[mCount] = mColorsp[mCount-1]; + mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; +} + +void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count) +{ + if (mCount + vert_count > 4094) { - mVerticesp[mCount] = mVerticesp[mCount-1]; - mColorsp[mCount] = mColorsp[mCount-1]; + // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + return; + } + + for (S32 i = 0; i < vert_count; i++) + { + mVerticesp[mCount] = verts[i]; + + mCount++; mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; + mColorsp[mCount] = mColorsp[mCount-1]; } + + mVerticesp[mCount] = mVerticesp[mCount-1]; } + +void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count) +{ + if (mCount + vert_count > 4094) + { + // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + return; + } + + for (S32 i = 0; i < vert_count; i++) + { + mVerticesp[mCount] = verts[i]; + mTexcoordsp[mCount] = uvs[i]; + + mCount++; + mColorsp[mCount] = mColorsp[mCount-1]; + } + + mVerticesp[mCount] = mVerticesp[mCount-1]; + mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; +} + +void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count) +{ + if (mCount + vert_count > 4094) + { + // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + return; + } + + for (S32 i = 0; i < vert_count; i++) + { + mVerticesp[mCount] = verts[i]; + mTexcoordsp[mCount] = uvs[i]; + mColorsp[mCount] = colors[i]; + + mCount++; + } + + mVerticesp[mCount] = mVerticesp[mCount-1]; + mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; + mColorsp[mCount] = mColorsp[mCount-1]; +} + void LLRender::vertex2i(const GLint& x, const GLint& y) { vertex3f((GLfloat) x, (GLfloat) y, 0); |