From 7abecb48babe6a6f09bf6692ba55076546cfced9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Mon, 1 Dec 2008 17:39:58 -0600 Subject: Second Life viewer sources 1.22.0-RC --- linden/indra/newview/lldrawpoolbump.cpp | 55 ++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'linden/indra/newview/lldrawpoolbump.cpp') diff --git a/linden/indra/newview/lldrawpoolbump.cpp b/linden/indra/newview/lldrawpoolbump.cpp index 0dd11d6..6593547 100644 --- a/linden/indra/newview/lldrawpoolbump.cpp +++ b/linden/indra/newview/lldrawpoolbump.cpp @@ -349,27 +349,29 @@ void LLDrawPoolBump::beginShiny(bool invisible) cube_map->setMatrix(1); // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for // the cube map in the one pass shiny shaders - cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); + cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); cube_map->enableTexture(cube_channel); cube_map->enableTextureCoords(1); diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); } else { - cube_channel = 0; + cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); diffuse_channel = -1; cube_map->setMatrix(0); - cube_map->enable(shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB)); + cube_map->enable(cube_channel); } - cube_map->bind(); + gGL.getTexUnit(cube_channel)->bind(cube_map); + gGL.getTexUnit(0)->activate(); } else { cube_channel = 0; diffuse_channel = -1; + gGL.getTexUnit(0)->disable(); cube_map->enable(0); cube_map->setMatrix(0); - cube_map->bind(); + gGL.getTexUnit(0)->bind(cube_map); gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR); gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_VERT_ALPHA); @@ -423,7 +425,7 @@ void LLDrawPoolBump::endShiny(bool invisible) if (!invisible && mVertexShaderLevel > 1) { - shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); + shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0) { @@ -435,18 +437,20 @@ void LLDrawPoolBump::endShiny(bool invisible) shader->unbind(); gGL.getTexUnit(0)->activate(); - glEnable(GL_TEXTURE_2D); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); } if (cube_channel >= 0) { + gGL.getTexUnit(cube_channel)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(cube_channel)->setTextureBlendType(LLTexUnit::TB_MULT); } } - - gGL.getTexUnit(0)->activate(); - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(diffuse_channel)->disable(); + gGL.getTexUnit(cube_channel)->disable(); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - + diffuse_channel = -1; cube_channel = 0; mShiny = FALSE; @@ -489,12 +493,14 @@ void LLDrawPoolBump::beginFullbrightShiny() cube_map->setMatrix(1); // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for // the cube map in the one pass shiny shaders - cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); + gGL.getTexUnit(1)->disable(); + cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); cube_map->enableTexture(cube_channel); cube_map->enableTextureCoords(1); diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); - cube_map->bind(); + gGL.getTexUnit(cube_channel)->bind(cube_map); + gGL.getTexUnit(0)->activate(); } mShiny = TRUE; } @@ -535,14 +541,13 @@ void LLDrawPoolBump::endFullbrightShiny() shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); } gGL.getTexUnit(0)->activate(); - glEnable(GL_TEXTURE_2D); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); shader->unbind(); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } - LLImageGL::unbindTexture(0, GL_TEXTURE_2D); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); diffuse_channel = -1; @@ -561,7 +566,7 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL applyModelMatrix(params); params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); + params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); gPipeline.addTrianglesDrawn(params.mCount/3); } } @@ -599,8 +604,8 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params) if (bump) { - bump->bind(1); - bump->bind(0); + gGL.getTexUnit(1)->bind(bump); + gGL.getTexUnit(0)->bind(bump); return TRUE; } return FALSE; @@ -629,7 +634,7 @@ void LLDrawPoolBump::beginBump() // TEXTURE UNIT 1 gGL.getTexUnit(1)->activate(); - glEnable(GL_TEXTURE_2D); // Texture unit 1 + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD_SIGNED, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_ONE_MINUS_TEX_ALPHA); gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); @@ -648,7 +653,7 @@ void LLDrawPoolBump::beginBump() gGL.getTexUnit(0)->activate(); stop_glerror(); - LLViewerImage::unbindTexture(1, GL_TEXTURE_2D); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); } //static @@ -680,7 +685,7 @@ void LLDrawPoolBump::endBump() // Disable texture unit 1 gGL.getTexUnit(1)->activate(); - glDisable(GL_TEXTURE_2D); // Texture unit 1 + gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT); // Disable texture unit 0 @@ -1083,17 +1088,17 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) { if (params.mTexture.notNull()) { - params.mTexture->bind(diffuse_channel); + gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get()); params.mTexture->addTextureStats(params.mVSize); } else { - LLImageGL::unbindTexture(0); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } } params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); + params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); gPipeline.addTrianglesDrawn(params.mCount/3); if (params.mTextureMatrix) { -- cgit v1.1