SL-20606: Refactor model matrix code

meow-7.2.2
Cosmic Linden 2023-09-15 17:18:07 -07:00
parent 7c2c49dd26
commit 42dafa5f09
4 changed files with 15 additions and 28 deletions

View File

@ -567,14 +567,19 @@ void LLRenderPass::pushRiggedMaskBatches(U32 type, bool texture, bool batch_text
void LLRenderPass::applyModelMatrix(const LLDrawInfo& params)
{
if (params.mModelMatrix != gGLLastMatrix)
applyModelMatrix(params.mModelMatrix);
}
void LLRenderPass::applyModelMatrix(const LLMatrix4* model_matrix)
{
if (model_matrix != gGLLastMatrix)
{
gGLLastMatrix = params.mModelMatrix;
gGLLastMatrix = model_matrix;
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.loadMatrix(gGLModelView);
if (params.mModelMatrix)
if (model_matrix)
{
gGL.multMatrix((GLfloat*) params.mModelMatrix->mMatrix);
gGL.multMatrix((GLfloat*) model_matrix->mMatrix);
}
gPipeline.mMatrixOpCount++;
}

View File

@ -349,6 +349,8 @@ public:
void resetDrawOrders() { }
static void applyModelMatrix(const LLDrawInfo& params);
// For rendering that doesn't use LLDrawInfo for some reason
static void applyModelMatrix(const LLMatrix4* model_matrix);
void pushBatches(U32 type, bool texture = true, bool batch_textures = false);
void pushUntexturedBatches(U32 type);

View File

@ -204,19 +204,8 @@ void LLDrawPoolTerrain::drawLoop()
{
LLFace *facep = *iter;
LLMatrix4* model_matrix = &(facep->getDrawable()->getRegion()->mRenderMatrix);
if (model_matrix != gGLLastMatrix)
{
llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);
gGLLastMatrix = model_matrix;
gGL.loadMatrix(gGLModelView);
if (model_matrix)
{
gGL.multMatrix((GLfloat*) model_matrix->mMatrix);
}
gPipeline.mMatrixOpCount++;
}
llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);
LLRenderPass::applyModelMatrix(&facep->getDrawable()->getRegion()->mRenderMatrix);
facep->renderIndexed();
}

View File

@ -85,17 +85,8 @@ void LLDrawPoolTree::renderDeferred(S32 pass)
{
LLMatrix4* model_matrix = &(face->getDrawable()->getRegion()->mRenderMatrix);
if (model_matrix != gGLLastMatrix)
{
gGLLastMatrix = model_matrix;
gGL.loadMatrix(gGLModelView);
if (model_matrix)
{
llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);
gGL.multMatrix((GLfloat*)model_matrix->mMatrix);
}
gPipeline.mMatrixOpCount++;
}
llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);
LLRenderPass::applyModelMatrix(model_matrix);
buff->setBuffer();
buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts() - 1, buff->getNumIndices(), 0);