summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolterrain.cpp
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2009-07-10 22:02:26 +0000
committerXiaohong Bao <bao@lindenlab.com>2009-07-10 22:02:26 +0000
commit77f56a3f3db72b2938eadb0868fc7be975dabafa (patch)
treeeb220e9890d0208969746a3e86fecf84b19e436b /indra/newview/lldrawpoolterrain.cpp
parente4dc104e3296319476bb0d6c327d6a326c967976 (diff)
merge QAR-1579: texture-cleanup-1.
Diffstat (limited to 'indra/newview/lldrawpoolterrain.cpp')
-rw-r--r--indra/newview/lldrawpoolterrain.cpp73
1 files changed, 39 insertions, 34 deletions
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 2c644b0fd5..a01c9026c8 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -49,7 +49,7 @@
#include "llviewerparceloverlay.h"
#include "llvosurfacepatch.h"
#include "llviewercamera.h"
-#include "llviewerimagelist.h" // To get alpha gradients
+#include "llviewertexturelist.h" // To get alpha gradients
#include "llworld.h"
#include "pipeline.h"
#include "llviewershadermgr.h"
@@ -62,28 +62,32 @@ S32 LLDrawPoolTerrain::sDetailMode = 1;
F32 LLDrawPoolTerrain::sDetailScale = DETAIL_SCALE;
static LLGLSLShader* sShader = NULL;
-LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerImage *texturep) :
+LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
LLFacePool(POOL_TERRAIN),
mTexturep(texturep)
{
// Hack!
sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale");
sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
- mAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient.tga",
- TRUE, TRUE, GL_ALPHA8, GL_ALPHA,
+ mAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga",
+ TRUE, TRUE,
+ LLViewerTexture::FETCHED_TEXTURE,
+ GL_ALPHA8, GL_ALPHA,
LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb"));
- gGL.getTexUnit(0)->bind(mAlphaRampImagep.get());
+ gGL.getTexUnit(0)->bind(mAlphaRampImagep);
mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
- m2DAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient_2d.j2c",
- TRUE, TRUE, GL_ALPHA8, GL_ALPHA,
+ m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient_2d.j2c",
+ TRUE, TRUE,
+ LLViewerTexture::FETCHED_TEXTURE,
+ GL_ALPHA8, GL_ALPHA,
LLUUID("38b86f85-2575-52a9-a531-23108d8da837"));
- gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
+ gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
- mTexturep->setBoostLevel(LLViewerImage::BOOST_TERRAIN);
+ mTexturep->setBoostLevel(LLViewerTexture::BOOST_TERRAIN);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
@@ -170,7 +174,7 @@ void LLDrawPoolTerrain::render(S32 pass)
LLVLComposition *compp = regionp->getComposition();
for (S32 i = 0; i < 4; i++)
{
- compp->mDetailTextures[i]->setBoostLevel(LLViewerImage::BOOST_TERRAIN);
+ compp->mDetailTextures[i]->setBoostLevel(LLViewerTexture::BOOST_TERRAIN);
compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
}
@@ -289,10 +293,10 @@ void LLDrawPoolTerrain::renderFullShader()
// Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition();
- LLViewerImage *detail_texture0p = compp->mDetailTextures[0];
- LLViewerImage *detail_texture1p = compp->mDetailTextures[1];
- LLViewerImage *detail_texture2p = compp->mDetailTextures[2];
- LLViewerImage *detail_texture3p = compp->mDetailTextures[3];
+ LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
+ LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
+ LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
+ LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
@@ -363,7 +367,7 @@ void LLDrawPoolTerrain::renderFullShader()
// Alpha Ramp
//
S32 alpha_ramp = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP);
- gGL.getTexUnit(alpha_ramp)->bind(m2DAlphaRampImagep.get());
+ gGL.getTexUnit(alpha_ramp)->bind(m2DAlphaRampImagep);
// GL_BLEND disabled by default
drawLoop();
@@ -429,10 +433,10 @@ void LLDrawPoolTerrain::renderFull4TU()
// Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition();
- LLViewerImage *detail_texture0p = compp->mDetailTextures[0];
- LLViewerImage *detail_texture1p = compp->mDetailTextures[1];
- LLViewerImage *detail_texture2p = compp->mDetailTextures[2];
- LLViewerImage *detail_texture3p = compp->mDetailTextures[3];
+ LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
+ LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
+ LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
+ LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
@@ -527,7 +531,7 @@ void LLDrawPoolTerrain::renderFull4TU()
//
// Stage 1: Generate alpha ramp for detail2/detail3 transition
//
- gGL.getTexUnit(1)->bind(m2DAlphaRampImagep.get());
+ gGL.getTexUnit(1)->bind(m2DAlphaRampImagep);
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->activate();
@@ -559,7 +563,7 @@ void LLDrawPoolTerrain::renderFull4TU()
//
// Stage 3: Generate alpha ramp for detail1/detail2 transition
//
- gGL.getTexUnit(3)->bind(m2DAlphaRampImagep.get());
+ gGL.getTexUnit(3)->bind(m2DAlphaRampImagep);
gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(3)->activate();
@@ -630,10 +634,10 @@ void LLDrawPoolTerrain::renderFull2TU()
// Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition();
- LLViewerImage *detail_texture0p = compp->mDetailTextures[0];
- LLViewerImage *detail_texture1p = compp->mDetailTextures[1];
- LLViewerImage *detail_texture2p = compp->mDetailTextures[2];
- LLViewerImage *detail_texture3p = compp->mDetailTextures[3];
+ LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
+ LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
+ LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
+ LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
@@ -671,7 +675,7 @@ void LLDrawPoolTerrain::renderFull2TU()
//
// Stage 0: Generate alpha ramp for detail0/detail1 transition
//
- gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
+ gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
@@ -709,7 +713,7 @@ void LLDrawPoolTerrain::renderFull2TU()
//
// Stage 0: Generate alpha ramp for detail1/detail2 transition
//
- gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
+ gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
// Set the texture matrix
glMatrixMode(GL_TEXTURE);
@@ -749,7 +753,7 @@ void LLDrawPoolTerrain::renderFull2TU()
// Stage 0: Generate alpha ramp for detail2/detail3 transition
//
gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
+ gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
// Set the texture matrix
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
@@ -822,7 +826,7 @@ void LLDrawPoolTerrain::renderSimple()
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(0)->bind(mTexturep.get());
+ gGL.getTexUnit(0)->bind(mTexturep);
LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent();
F32 tscale = 1.f/256.f;
@@ -872,7 +876,7 @@ void LLDrawPoolTerrain::renderOwnership()
LLSurface *surfacep = surface_patchp->getSurface();
LLViewerRegion *regionp = surfacep->getRegion();
LLViewerParcelOverlay *overlayp = regionp->getParcelOverlay();
- LLImageGL *texturep = overlayp->getTexture();
+ LLViewerTexture *texturep = overlayp->getTexture();
gGL.getTexUnit(0)->bind(texturep);
@@ -920,9 +924,10 @@ void LLDrawPoolTerrain::renderForSelect()
}
}
-void LLDrawPoolTerrain::dirtyTextures(const std::set<LLViewerImage*>& textures)
+void LLDrawPoolTerrain::dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures)
{
- if (textures.find(mTexturep) != textures.end())
+ LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(mTexturep) ;
+ if (tex && textures.find(tex) != textures.end())
{
for (std::vector<LLFace*>::iterator iter = mReferences.begin();
iter != mReferences.end(); iter++)
@@ -933,12 +938,12 @@ void LLDrawPoolTerrain::dirtyTextures(const std::set<LLViewerImage*>& textures)
}
}
-LLViewerImage *LLDrawPoolTerrain::getTexture()
+LLViewerTexture *LLDrawPoolTerrain::getTexture()
{
return mTexturep;
}
-LLViewerImage *LLDrawPoolTerrain::getDebugTexture()
+LLViewerTexture *LLDrawPoolTerrain::getDebugTexture()
{
return mTexturep;
}