MatrixMode sanity checks and adjustments to physics debug display (fixes a crash with that debug view, too)

This commit is contained in:
Shyotl
2012-10-22 03:05:18 -05:00
parent ef27cc54dd
commit d2004e88f9
5 changed files with 10 additions and 0 deletions

View File

@@ -422,6 +422,7 @@ void LLRenderPass::applyModelMatrix(LLDrawInfo& params)
gGL.loadMatrix(gGLModelView);
if (params.mModelMatrix)
{
llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);
gGL.multMatrix((GLfloat*) params.mModelMatrix->mMatrix);
}
gPipeline.mMatrixOpCount++;

View File

@@ -316,6 +316,7 @@ void LLDrawPoolTerrain::drawLoop()
if (model_matrix != gGLLastMatrix)
{
llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);
gGLLastMatrix = model_matrix;
gGL.loadMatrix(gGLModelView);
if (model_matrix)
@@ -793,6 +794,7 @@ void LLDrawPoolTerrain::renderFull2TU()
gGL.loadIdentity();
gGL.translatef(-2.f, 0.f, 0.f);
gGL.matrixMode(LLRender::MM_MODELVIEW);
// Care about alpha only
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);

View File

@@ -128,6 +128,7 @@ void LLDrawPoolTree::render(S32 pass)
gGL.loadMatrix(gGLModelView);
if (model_matrix)
{
llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);
gGL.multMatrix((GLfloat*) model_matrix->mMatrix);
}
gPipeline.mMatrixOpCount++;

View File

@@ -3043,6 +3043,8 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo
void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color, const LLColor4& line_color)
{
if(mesh.mPositions.empty() || mesh.mNormals.empty())
return;
gGL.diffuseColor4fv(color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions, mesh.mNormals);
LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
@@ -3404,6 +3406,8 @@ void renderPhysicsShapes(LLSpatialGroup* group)
LLViewerObject* object = drawable->getVObj();
if (object && object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH)
{
gGL.pushMatrix();
gGL.multMatrix((F32*) object->getRegion()->mRenderMatrix.mMatrix);
//push face vertices for terrain
for (S32 i = 0; i < drawable->getNumFaces(); ++i)
{
@@ -3425,6 +3429,7 @@ void renderPhysicsShapes(LLSpatialGroup* group)
}
}
}
gGL.popMatrix();
}
}
}

View File

@@ -42,6 +42,7 @@
#include "llappviewer.h"
#include "llworld.h"
#include "llviewercontrol.h"
#include "llviewertexture.h"
#include "llsurfacepatch.h"
#include "llvosurfacepatch.h"
#include "llvowater.h"