Compare commits

...

1 Commits

Author SHA1 Message Date
Shyotl
5036cfe566 Innitial commit of experimental v2 texture system port work. Compiles and runs on windows, at least. Fixing bugs as they come.
Need to test:
localassetbrowser
preview related floaters
hgfloatertexteditor
maps
media textures! Currently very hacky
web browser
alpha masks on avatars
bumpmaps
Are all sky components appearing?
LLViewerDynamicTexture (texture baking, browser, animated textures, anim previews, etc)
Snapshot related features
Customize avatar
vfs floater
UI textures in general
Texture priority issues
2011-04-01 05:16:04 +02:00
212 changed files with 8149 additions and 4443 deletions

View File

@@ -3391,7 +3391,8 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
std::vector<S32> &segments, std::vector<S32> &segments,
const LLVector3& obj_cam_vec, const LLVector3& obj_cam_vec,
const LLMatrix4& mat, const LLMatrix4& mat,
const LLMatrix3& norm_mat) const LLMatrix3& norm_mat,
S32 face_mask)
{ {
LLMemType m1(LLMemType::MTYPE_VOLUME); LLMemType m1(LLMemType::MTYPE_VOLUME);
@@ -3399,12 +3400,17 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
normals.clear(); normals.clear();
segments.clear(); segments.clear();
S32 cur_index = 0;
//for each face //for each face
for (face_list_t::iterator iter = mVolumeFaces.begin(); for (face_list_t::iterator iter = mVolumeFaces.begin();
iter != mVolumeFaces.end(); ++iter) iter != mVolumeFaces.end(); ++iter)
{ {
const LLVolumeFace& face = *iter; const LLVolumeFace& face = *iter;
if (!(face_mask & (0x1 << cur_index++)))
{
continue;
}
if (face.mTypeMask & (LLVolumeFace::CAP_MASK)) { if (face.mTypeMask & (LLVolumeFace::CAP_MASK)) {
} }

View File

@@ -909,7 +909,8 @@ public:
std::vector<S32> &segments, std::vector<S32> &segments,
const LLVector3& view_vec, const LLVector3& view_vec,
const LLMatrix4& mat, const LLMatrix4& mat,
const LLMatrix3& norm_mat); const LLMatrix3& norm_mat,
S32 face_index);
//get the face index of the face that intersects with the given line segment at the point //get the face index of the face that intersects with the given line segment at the point
//closest to start. Moves end to the point of intersection. Returns -1 if no intersection. //closest to start. Moves end to the point of intersection. Returns -1 if no intersection.

View File

@@ -35,6 +35,7 @@ set(llrender_SOURCE_FILES
llpostprocess.cpp llpostprocess.cpp
llrendersphere.cpp llrendersphere.cpp
llshadermgr.cpp llshadermgr.cpp
lltexture.cpp
llvertexbuffer.cpp llvertexbuffer.cpp
) )
@@ -57,6 +58,7 @@ set(llrender_HEADER_FILES
llrender.h llrender.h
llrendersphere.h llrendersphere.h
llshadermgr.h llshadermgr.h
lltexture.h
llvertexbuffer.h llvertexbuffer.h
) )

View File

@@ -1079,15 +1079,15 @@ void LLFontGL::clearEmbeddedChars()
mEmbeddedChars.clear(); mEmbeddedChars.clear();
} }
void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label ) const void LLFontGL::addEmbeddedChar( llwchar wc, LLTexture* image, const std::string& label ) const
{ {
LLWString wlabel = utf8str_to_wstring(label); LLWString wlabel = utf8str_to_wstring(label);
addEmbeddedChar(wc, image, wlabel); addEmbeddedChar(wc, image, wlabel);
} }
void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& wlabel ) const void LLFontGL::addEmbeddedChar( llwchar wc, LLTexture* image, const LLWString& wlabel ) const
{ {
embedded_data_t* ext_data = new embedded_data_t(image, wlabel); embedded_data_t* ext_data = new embedded_data_t(image->getGLTexture(), wlabel);
mEmbeddedChars[wc] = ext_data; mEmbeddedChars[wc] = ext_data;
} }

View File

@@ -35,7 +35,7 @@
#define LL_LLFONTGL_H #define LL_LLFONTGL_H
#include "llfont.h" #include "llfont.h"
#include "llimagegl.h" #include "lltexture.h"
#include "v2math.h" #include "v2math.h"
#include "llcoord.h" #include "llcoord.h"
#include "llrect.h" #include "llrect.h"
@@ -194,10 +194,10 @@ public:
BOOL round = TRUE, BOOL use_embedded = FALSE) const; BOOL round = TRUE, BOOL use_embedded = FALSE) const;
LLImageGL *getImageGL() const; LLTexture *getTexture() const;
void addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label) const; void addEmbeddedChar( llwchar wc, LLTexture* image, const std::string& label) const;
void addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& label) const; void addEmbeddedChar( llwchar wc, LLTexture* image, const LLWString& label) const;
void removeEmbeddedChar( llwchar wc ) const; void removeEmbeddedChar( llwchar wc ) const;
static std::string nameFromFont(const LLFontGL* fontp); static std::string nameFromFont(const LLFontGL* fontp);

View File

@@ -61,6 +61,7 @@ std::list<U32> LLImageGL::sDeadTextureList;
BOOL LLImageGL::sGlobalUseAnisotropic = FALSE; BOOL LLImageGL::sGlobalUseAnisotropic = FALSE;
F32 LLImageGL::sLastFrameTime = 0.f; F32 LLImageGL::sLastFrameTime = 0.f;
BOOL LLImageGL::sAllowReadBackRaw = FALSE ; BOOL LLImageGL::sAllowReadBackRaw = FALSE ;
LLImageGL* LLImageGL::sDefaultGLTexture = NULL ;
std::set<LLImageGL*> LLImageGL::sImageList; std::set<LLImageGL*> LLImageGL::sImageList;
@@ -105,9 +106,9 @@ void check_all_images()
} }
} }
void LLImageGL::checkTexSize() const void LLImageGL::checkTexSize(bool forced) const
{ {
if (gDebugGL && mTarget == GL_TEXTURE_2D) if ((forced || gDebugGL) && mTarget == GL_TEXTURE_2D)
{ {
GLint texname; GLint texname;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname); glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname);
@@ -186,7 +187,6 @@ void LLImageGL::setHighlightTexture(S32 category)
} }
} }
sHighlightTexturep->createGLTexture(0, image_raw, 0, TRUE, category); sHighlightTexturep->createGLTexture(0, image_raw, 0, TRUE, category);
sHighlightTexturep->dontDiscard();
image_raw = NULL; image_raw = NULL;
} }
@@ -272,27 +272,15 @@ void LLImageGL::updateStats(F32 current_time)
} }
//static //static
S32 LLImageGL::updateBoundTexMemStatic(const S32 delta, const S32 size, S32 category) S32 LLImageGL::updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category)
{ {
if(gAuditTexture) if(gAuditTexture && ncomponents > 0 && category > -1)
{ {
sTextureCurBoundCounter[getTextureCounterIndex(size)]++ ; sTextureCurBoundCounter[getTextureCounterIndex(mem / ncomponents)]++ ;
sTextureCurMemByCategoryBound[category] += delta ; sTextureCurMemByCategoryBound[category] += mem ;
} }
LLImageGL::sCurBoundTextureMemory += delta ; LLImageGL::sCurBoundTextureMemory += mem ;
return LLImageGL::sCurBoundTextureMemory;
}
S32 LLImageGL::updateBoundTexMem()const
{
if(gAuditTexture)
{
sTextureCurBoundCounter[getTextureCounterIndex(mTextureMemory / mComponents)]++ ;
sTextureCurMemByCategoryBound[mCategory] += mTextureMemory ;
}
LLImageGL::sCurBoundTextureMemory += mTextureMemory ;
return LLImageGL::sCurBoundTextureMemory; return LLImageGL::sCurBoundTextureMemory;
} }
@@ -478,11 +466,7 @@ void LLImageGL::init(BOOL usemipmaps)
mMissed = FALSE; mMissed = FALSE;
#endif #endif
mCategory = -1 ; mCategory = -1;
//LLTexture stuff
mDontDiscard = FALSE;
mTextureState = NO_DELETE ;
} }
void LLImageGL::cleanup() void LLImageGL::cleanup()
@@ -592,7 +576,7 @@ void LLImageGL::forceUpdateBindStats(void) const
mLastBindTime = sLastFrameTime; mLastBindTime = sLastFrameTime;
} }
BOOL LLImageGL::updateBindStats() const BOOL LLImageGL::updateBindStats(S32 tex_mem) const
{ {
if (mTexName != 0) if (mTexName != 0)
{ {
@@ -604,32 +588,18 @@ BOOL LLImageGL::updateBindStats() const
{ {
// we haven't accounted for this texture yet this frame // we haven't accounted for this texture yet this frame
sUniqueCount++; sUniqueCount++;
updateBoundTexMem(tex_mem, mComponents, mCategory);
updateBoundTexMem();
mLastBindTime = sLastFrameTime; mLastBindTime = sLastFrameTime;
return TRUE ; return TRUE ;
} }
} }
return FALSE; return FALSE ;
} }
//virtual F32 LLImageGL::getTimePassedSinceLastBound()
bool LLImageGL::bindError(const S32 stage) const
{ {
return false; return sLastFrameTime - mLastBindTime ;
}
//virtual
bool LLImageGL::bindDefaultImage(const S32 stage)
{
return false;
}
//virtual
void LLImageGL::forceImmediateUpdate()
{
return ;
} }
void LLImageGL::setExplicitFormat( LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes ) void LLImageGL::setExplicitFormat( LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes )
@@ -1184,7 +1154,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
if(gAuditTexture) if(gAuditTexture)
{ {
decTextureCounter() ; decTextureCounter(mTextureMemory, mComponents, mCategory) ;
} }
LLImageGL::deleteTextures(1, &old_name); LLImageGL::deleteTextures(1, &old_name);
@@ -1194,11 +1164,10 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
mTextureMemory = getMipBytes(discard_level); mTextureMemory = getMipBytes(discard_level);
sGlobalTextureMemoryInBytes += mTextureMemory; sGlobalTextureMemoryInBytes += mTextureMemory;
setActive() ;
if(gAuditTexture) if(gAuditTexture)
{ {
incTextureCounter() ; incTextureCounter(mTextureMemory, mComponents, mCategory) ;
} }
// mark this as bound at this point, so we don't throw it out immediately // mark this as bound at this point, so we don't throw it out immediately
mLastBindTime = sLastFrameTime; mLastBindTime = sLastFrameTime;
@@ -1398,20 +1367,21 @@ void LLImageGL::destroyGLTexture()
{ {
if(gAuditTexture) if(gAuditTexture)
{ {
decTextureCounter() ; decTextureCounter(mTextureMemory, mComponents, mCategory) ;
} }
sGlobalTextureMemoryInBytes -= mTextureMemory; sGlobalTextureMemoryInBytes -= mTextureMemory;
mTextureMemory = 0; mTextureMemory = 0;
} }
LLImageGL::deleteTextures(1, &mTexName); LLImageGL::deleteTextures(1, &mTexName);
mTextureState = DELETED ;
mTexName = 0; mTexName = 0;
mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel. mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel.
mGLTextureCreated = FALSE ; mGLTextureCreated = FALSE ;
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void LLImageGL::setAddressMode(LLTexUnit::eTextureAddressMode mode) void LLImageGL::setAddressMode(LLTexUnit::eTextureAddressMode mode)
@@ -1724,59 +1694,6 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
} }
} }
BOOL LLImageGL::isDeleted()
{
return mTextureState == DELETED ;
}
BOOL LLImageGL::isInactive()
{
return mTextureState == INACTIVE ;
}
BOOL LLImageGL::isDeletionCandidate()
{
return mTextureState == DELETION_CANDIDATE ;
}
//----------------------------------------------------------------------------
void LLImageGL::setDeletionCandidate()
{
if(mTexName && (mTextureState == INACTIVE))
{
mTextureState = DELETION_CANDIDATE ;
}
}
void LLImageGL::forceActive()
{
mTextureState = ACTIVE ;
}
void LLImageGL::setActive()
{
if(mTextureState != NO_DELETE)
{
mTextureState = ACTIVE ;
}
}
//set the texture inactive
void LLImageGL::setInactive()
{
if(mTexName && (mTextureState == ACTIVE) && !getBoundRecently())
{
mTextureState = INACTIVE ;
}
}
//set the texture to stay in memory
void LLImageGL::setNoDelete()
{
mTextureState = NO_DELETE ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in)
{ {
@@ -1928,26 +1845,21 @@ S32 LLImageGL::getTextureCounterIndex(U32 val)
return ret ; return ret ;
} }
} }
void LLImageGL::incTextureCounterStatic(U32 val, S32 ncomponents, S32 category)
//static
void LLImageGL::incTextureCounter(U32 val, S32 ncomponents, S32 category)
{ {
sTextureLoadedCounter[getTextureCounterIndex(val)]++ ; sTextureLoadedCounter[getTextureCounterIndex(val)]++ ;
sTextureMemByCategory[category] += (S32)val * ncomponents ; sTextureMemByCategory[category] += (S32)val * ncomponents ;
} }
void LLImageGL::decTextureCounterStatic(U32 val, S32 ncomponents, S32 category)
//static
void LLImageGL::decTextureCounter(U32 val, S32 ncomponents, S32 category)
{ {
sTextureLoadedCounter[getTextureCounterIndex(val)]-- ; sTextureLoadedCounter[getTextureCounterIndex(val)]-- ;
sTextureMemByCategory[category] += (S32)val * ncomponents ; sTextureMemByCategory[category] += (S32)val * ncomponents ;
} }
void LLImageGL::incTextureCounter()
{
sTextureLoadedCounter[getTextureCounterIndex(mTextureMemory / mComponents)]++ ;
sTextureMemByCategory[mCategory] += mTextureMemory ;
}
void LLImageGL::decTextureCounter()
{
sTextureLoadedCounter[getTextureCounterIndex(mTextureMemory / mComponents)]-- ;
sTextureMemByCategory[mCategory] -= mTextureMemory ;
}
void LLImageGL::setCurTexSizebar(S32 index, BOOL set_pick_size) void LLImageGL::setCurTexSizebar(S32 index, BOOL set_pick_size)
{ {
sCurTexSizeBar = index ; sCurTexSizeBar = index ;

View File

@@ -59,7 +59,8 @@ public:
static S32 dataFormatBytes(S32 dataformat, S32 width, S32 height); static S32 dataFormatBytes(S32 dataformat, S32 width, S32 height);
static S32 dataFormatComponents(S32 dataformat); static S32 dataFormatComponents(S32 dataformat);
BOOL updateBindStats(void) const; BOOL updateBindStats(S32 tex_mem) const ;
F32 getTimePassedSinceLastBound();
void forceUpdateBindStats(void) const; void forceUpdateBindStats(void) const;
// needs to be called every frame // needs to be called every frame
@@ -71,8 +72,7 @@ public:
static void dirtyTexOptions(); static void dirtyTexOptions();
// Sometimes called externally for textures not using LLImageGL (should go away...) // Sometimes called externally for textures not using LLImageGL (should go away...)
static S32 updateBoundTexMemStatic(const S32 delta, const S32 size, S32 category) ; static S32 updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category) ;
S32 updateBoundTexMem()const;
static bool checkSize(S32 width, S32 height); static bool checkSize(S32 width, S32 height);
@@ -95,11 +95,9 @@ protected:
public: public:
virtual void dump(); // debugging info to llinfos virtual void dump(); // debugging info to llinfos
virtual bool bindError(const S32 stage = 0) const;
virtual bool bindDefaultImage(const S32 stage = 0) ;
virtual void forceImmediateUpdate() ;
void setSize(S32 width, S32 height, S32 ncomponents); void setSize(S32 width, S32 height, S32 ncomponents);
void setComponents(S32 ncomponents) { mComponents = (S8)ncomponents ;}
// These 3 functions currently wrap glGenTextures(), glDeleteTextures(), and glTexImage2D() // These 3 functions currently wrap glGenTextures(), glDeleteTextures(), and glTexImage2D()
// for tracking purposes and will be deprecated in the future // for tracking purposes and will be deprecated in the future
@@ -122,7 +120,6 @@ public:
void destroyGLTexture(); void destroyGLTexture();
void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE); void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE);
void dontDiscard() { mDontDiscard = 1; mTextureState = NO_DELETE; }
void setComponents(S8 ncomponents) { mComponents = ncomponents; } void setComponents(S8 ncomponents) { mComponents = ncomponents; }
S32 getDiscardLevel() const { return mCurrentDiscardLevel; } S32 getDiscardLevel() const { return mCurrentDiscardLevel; }
@@ -154,14 +151,12 @@ public:
void setGLTextureCreated (bool initialized) { mGLTextureCreated = initialized; } void setGLTextureCreated (bool initialized) { mGLTextureCreated = initialized; }
BOOL getUseMipMaps() const { return mUseMipMaps; } BOOL getUseMipMaps() const { return mUseMipMaps; }
void setUseMipMaps(BOOL usemips) { mUseMipMaps = usemips; } void setUseMipMaps(BOOL usemips) { mUseMipMaps = usemips; }
BOOL getUseDiscard() const { return mUseMipMaps && !mDontDiscard; }
BOOL getDontDiscard() const { return mDontDiscard; }
void updatePickMask(S32 width, S32 height, const U8* data_in); void updatePickMask(S32 width, S32 height, const U8* data_in);
BOOL getMask(const LLVector2 &tc); BOOL getMask(const LLVector2 &tc);
void checkTexSize() const ; void checkTexSize(bool forced = false) const ;
// Sets the addressing mode used to sample the texture // Sets the addressing mode used to sample the texture
// (such as wrapping, mirrored wrapping, and clamp) // (such as wrapping, mirrored wrapping, and clamp)
@@ -175,17 +170,7 @@ public:
void setFilteringOption(LLTexUnit::eTextureFilterOptions option); void setFilteringOption(LLTexUnit::eTextureFilterOptions option);
LLTexUnit::eTextureFilterOptions getFilteringOption(void) const { return mFilterOption; } LLTexUnit::eTextureFilterOptions getFilteringOption(void) const { return mFilterOption; }
BOOL isDeleted() ; LLGLenum getTexTarget()const { return mTarget ;}
BOOL isInactive() ;
BOOL isDeletionCandidate();
void setDeletionCandidate() ;
void setInactive() ;
void setActive() ;
void forceActive() ;
void setNoDelete() ;
void setTextureSize(S32 size) {mTextureMemory = size;}
protected:
void init(BOOL usemipmaps); void init(BOOL usemipmaps);
virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors
@@ -224,8 +209,7 @@ protected:
S8 mComponents; S8 mComponents;
S8 mMaxDiscardLevel; S8 mMaxDiscardLevel;
S8 mDontDiscard; // Keep full res version of this image (for UI, etc)
bool mTexOptionsDirty; bool mTexOptionsDirty;
LLTexUnit::eTextureAddressMode mAddressMode; // Defaults to TAM_WRAP LLTexUnit::eTextureAddressMode mAddressMode; // Defaults to TAM_WRAP
LLTexUnit::eTextureFilterOptions mFilterOption; // Defaults to TFO_TRILINEAR LLTexUnit::eTextureFilterOptions mFilterOption; // Defaults to TFO_TRILINEAR
@@ -235,17 +219,6 @@ protected:
LLGLenum mFormatPrimary; // = GL format (pixel data format) LLGLenum mFormatPrimary; // = GL format (pixel data format)
LLGLenum mFormatType; LLGLenum mFormatType;
BOOL mFormatSwapBytes;// if true, use glPixelStorei(GL_UNPACK_SWAP_BYTES, 1) BOOL mFormatSwapBytes;// if true, use glPixelStorei(GL_UNPACK_SWAP_BYTES, 1)
protected:
typedef enum
{
DELETED = 0, //removed from memory
DELETION_CANDIDATE, //ready to be removed from memory
INACTIVE, //not be used for the last certain period (i.e., 30 seconds).
ACTIVE, //just being used, can become inactive if not being used for a certain time (10 seconds).
NO_DELETE = 99 //stay in memory, can not be removed.
} LLGLTexureState;
LLGLTexureState mTextureState ;
// STATICS // STATICS
public: public:
@@ -263,6 +236,8 @@ public:
static U32 sBindCount; // Tracks number of texture binds for current frame static U32 sBindCount; // Tracks number of texture binds for current frame
static U32 sUniqueCount; // Tracks number of unique texture binds for current frame static U32 sUniqueCount; // Tracks number of unique texture binds for current frame
static BOOL sGlobalUseAnisotropic; static BOOL sGlobalUseAnisotropic;
static LLImageGL* sDefaultGLTexture ;
#if DEBUG_MISS #if DEBUG_MISS
BOOL mMissed; // Missed on last bind? BOOL mMissed; // Missed on last bind?
BOOL getMissed() const { return mMissed; }; BOOL getMissed() const { return mMissed; };
@@ -300,13 +275,10 @@ public:
static void setHighlightTexture(S32 category) ; static void setHighlightTexture(S32 category) ;
static S32 getTextureCounterIndex(U32 val) ; static S32 getTextureCounterIndex(U32 val) ;
static void incTextureCounterStatic(U32 val, S32 ncomponents, S32 category) ; static void incTextureCounter(U32 val, S32 ncomponents, S32 category) ;
static void decTextureCounterStatic(U32 val, S32 ncomponents, S32 category) ; static void decTextureCounter(U32 val, S32 ncomponents, S32 category) ;
static void setCurTexSizebar(S32 index, BOOL set_pick_size = TRUE) ; static void setCurTexSizebar(S32 index, BOOL set_pick_size = TRUE) ;
static void resetCurTexSizebar(); static void resetCurTexSizebar();
void incTextureCounter() ;
void decTextureCounter() ;
//---------------------------------------- //----------------------------------------
//for debug use: show texture category distribution //for debug use: show texture category distribution

View File

@@ -38,6 +38,7 @@
#include "llcubemap.h" #include "llcubemap.h"
#include "llimagegl.h" #include "llimagegl.h"
#include "llrendertarget.h" #include "llrendertarget.h"
#include "lltexture.h"
LLRender gGL; LLRender gGL;
@@ -179,50 +180,86 @@ void LLTexUnit::disable(void)
} }
} }
bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind)
{ {
stop_glerror(); stop_glerror();
if (mIndex < 0) return false; if (mIndex < 0) return false;
gGL.flush(); gGL.flush();
if (texture == NULL) LLImageGL* gl_tex = NULL ;
if (texture == NULL || !(gl_tex = texture->getGLTexture()))
{ {
llwarns << "NULL LLTexUnit::bind texture" << llendl; llwarns << "NULL LLTexUnit::bind texture" << llendl;
return false; return false;
} }
if (!texture->getTexName()) //if texture does not exist
{
if (texture->isDeleted())
{
// This will re-generate the texture immediately.
texture->forceImmediateUpdate() ;
}
texture->forceUpdateBindStats() ; if (!gl_tex->getTexName()) //if texture does not exist
{
//if deleted, will re-generate it immediately
texture->forceImmediateUpdate() ;
gl_tex->forceUpdateBindStats() ;
return texture->bindDefaultImage(mIndex); return texture->bindDefaultImage(mIndex);
} }
//in audit, replace the selected texture by the default one.
if(gAuditTexture && for_rendering && LLImageGL::sCurTexPickSize > 0) if(gAuditTexture && for_rendering && LLImageGL::sCurTexPickSize > 0)
{ {
if(texture->getWidth() * texture->getHeight() == LLImageGL::sCurTexPickSize) if(texture->getWidth() * texture->getHeight() == LLImageGL::sCurTexPickSize)
{ {
texture->updateBindStats(); gl_tex->updateBindStats(gl_tex->mTextureMemory);
return bind(LLImageGL::sHighlightTexturep.get()); return bind(LLImageGL::sHighlightTexturep.get());
} }
} }
if ((mCurrTexture != gl_tex->getTexName()) || forceBind)
{
activate();
enable(gl_tex->getTarget());
mCurrTexture = gl_tex->getTexName();
glBindTexture(sGLTextureType[gl_tex->getTarget()], mCurrTexture);
if(gl_tex->updateBindStats(gl_tex->mTextureMemory))
{
texture->setActive() ;
texture->updateBindStatsForTester() ;
}
mHasMipMaps = gl_tex->mHasMipMaps;
if (gl_tex->mTexOptionsDirty)
{
gl_tex->mTexOptionsDirty = false;
setTextureAddressMode(gl_tex->mAddressMode);
setTextureFilteringOption(gl_tex->mFilterOption);
}
}
return true;
}
bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind)
{
stop_glerror();
if (mIndex < 0) return false;
if(!texture)
{
llwarns << "NULL LLTexUnit::bind texture" << llendl;
return false;
}
if(!texture->getTexName())
{
if(LLImageGL::sDefaultGLTexture && LLImageGL::sDefaultGLTexture->getTexName())
{
return bind(LLImageGL::sDefaultGLTexture) ;
}
return false ;
}
if ((mCurrTexture != texture->getTexName()) || forceBind) if ((mCurrTexture != texture->getTexName()) || forceBind)
{ {
activate(); activate();
enable(texture->getTarget()); enable(texture->getTarget());
mCurrTexture = texture->getTexName(); mCurrTexture = texture->getTexName();
glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture); glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture);
if(texture->updateBindStats()) texture->updateBindStats(texture->mTextureMemory);
{
texture->setActive() ;
}
mHasMipMaps = texture->mHasMipMaps; mHasMipMaps = texture->mHasMipMaps;
if (texture->mTexOptionsDirty) if (texture->mTexOptionsDirty)
{ {
@@ -255,7 +292,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap)
mCurrTexture = cubeMap->mImages[0]->getTexName(); mCurrTexture = cubeMap->mImages[0]->getTexName();
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mCurrTexture); glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mCurrTexture);
mHasMipMaps = cubeMap->mImages[0]->mHasMipMaps; mHasMipMaps = cubeMap->mImages[0]->mHasMipMaps;
cubeMap->mImages[0]->updateBindStats(); cubeMap->mImages[0]->updateBindStats(cubeMap->mImages[0]->mTextureMemory);
if (cubeMap->mImages[0]->mTexOptionsDirty) if (cubeMap->mImages[0]->mTexOptionsDirty)
{ {
cubeMap->mImages[0]->mTexOptionsDirty = false; cubeMap->mImages[0]->mTexOptionsDirty = false;

View File

@@ -51,6 +51,7 @@ class LLVertexBuffer;
class LLCubeMap; class LLCubeMap;
class LLImageGL; class LLImageGL;
class LLRenderTarget; class LLRenderTarget;
class LLTexture ;
class LLTexUnit class LLTexUnit
{ {
@@ -149,6 +150,7 @@ public:
// Binds the LLImageGL to this texture unit // Binds the LLImageGL to this texture unit
// (automatically enables the unit for the LLImageGL's texture type) // (automatically enables the unit for the LLImageGL's texture type)
bool bind(LLImageGL* texture, bool for_rendering = false, bool forceBind = false); bool bind(LLImageGL* texture, bool for_rendering = false, bool forceBind = false);
bool bind(LLTexture* texture, bool for_rendering = false, bool forceBind = false);
// Binds a cubemap to this texture unit // Binds a cubemap to this texture unit
// (automatically enables the texture unit for cubemaps) // (automatically enables the texture unit for cubemaps)

View File

@@ -0,0 +1,38 @@
/**
* @file lltexture.cpp
*
* $LicenseInfo:firstyear=2000&license=viewergpl$
*
* Copyright (c) 2000-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*
*/
#include "linden_common.h"
#include "lltexture.h"
//virtual
LLTexture::~LLTexture()
{
}

View File

@@ -0,0 +1,80 @@
/**
* @file lltexture.h
* @brief LLTexture definition
*
* This class acts as a wrapper for OpenGL calls.
* The goal of this class is to minimize the number of api calls due to legacy rendering
* code, to define an interface for a multiple rendering API abstraction of the UI
* rendering, and to abstract out direct rendering calls in a way that is cleaner and easier to maintain.
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*
*/
#ifndef LL_TEXTURE_H
#define LL_TEXTURE_H
#include "llmemory.h"
class LLImageGL ;
class LLTexUnit ;
class LLFontGL ;
//
//this is an abstract class as the parent for the class LLViewerTexture
//through the following virtual functions, the class LLViewerTexture can be reached from /llrender.
//
class LLTexture : public LLRefCount
{
friend class LLTexUnit ;
friend class LLFontGL ;
protected:
virtual ~LLTexture();
public:
LLTexture(){}
//
//interfaces to access LLViewerTexture
//
virtual S8 getType() const = 0 ;
virtual void setKnownDrawSize(S32 width, S32 height) = 0 ;
virtual bool bindDefaultImage(const S32 stage = 0) = 0 ;
virtual void forceImmediateUpdate() = 0 ;
virtual void setActive() = 0 ;
virtual S32 getWidth(S32 discard_level = -1) const = 0 ;
virtual S32 getHeight(S32 discard_level = -1) const = 0 ;
private:
//note: do not make this function public.
virtual LLImageGL* getGLTexture() const = 0 ;
virtual void updateBindStatsForTester() = 0 ;
};
#endif

View File

@@ -105,7 +105,7 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
mList->setCommitOnKeyboardMovement(FALSE); mList->setCommitOnKeyboardMovement(FALSE);
addChild(mList); addChild(mList);
mArrowImage = LLUI::sImageProvider->getUIImage("combobox_arrow.tga"); mArrowImage = LLUI::getUIImage("combobox_arrow.tga");
mButton->setImageOverlay("combobox_arrow.tga", LLFontGL::RIGHT); mButton->setImageOverlay("combobox_arrow.tga", LLFontGL::RIGHT);
updateLayout(); updateLayout();

View File

@@ -89,7 +89,7 @@ void LLIconCtrl::setImage(const std::string& image_name)
else else
{ {
mImageName = image_name; mImageName = image_name;
mImagep = LLUI::sImageProvider->getUIImage(image_name); mImagep = LLUI::getUIImage(image_name);
mImageID.setNull(); mImageID.setNull();
} }
} }
@@ -97,7 +97,7 @@ void LLIconCtrl::setImage(const std::string& image_name)
void LLIconCtrl::setImage(const LLUUID& image_id) void LLIconCtrl::setImage(const LLUUID& image_id)
{ {
mImageName.clear(); mImageName.clear();
mImagep = LLUI::sImageProvider->getUIImageByID(image_id); mImagep = LLUI::getUIImageByID(image_id);
mImageID = image_id; mImageID = image_id;
} }

View File

@@ -439,7 +439,7 @@ void LLMultiSlider::draw()
F32 opacity = getEnabled() ? 1.f : 0.3f; F32 opacity = getEnabled() ? 1.f : 0.3f;
// Track // Track
LLUIImagePtr thumb_imagep = LLUI::sImageProvider->getUIImage("rounded_square.tga"); LLUIImagePtr thumb_imagep = LLUI::getUIImage("rounded_square.tga");
S32 height_offset = (getRect().getHeight() - MULTI_TRACK_HEIGHT) / 2; S32 height_offset = (getRect().getHeight() - MULTI_TRACK_HEIGHT) / 2;
LLRect track_rect(0, getRect().getHeight() - height_offset, getRect().getWidth(), height_offset ); LLRect track_rect(0, getRect().getHeight() - height_offset, getRect().getWidth(), height_offset );

View File

@@ -98,12 +98,12 @@ void LLProgressBar::setPercent(const F32 percent)
void LLProgressBar::setImageBar( const std::string &bar_name ) void LLProgressBar::setImageBar( const std::string &bar_name )
{ {
mImageBar = LLUI::sImageProvider->getUIImage(bar_name)->getImage(); mImageBar = LLUI::getUIImage(bar_name)->getImage();
} }
void LLProgressBar::setImageShadow(const std::string &shadow_name) void LLProgressBar::setImageShadow(const std::string &shadow_name)
{ {
mImageShadow = LLUI::sImageProvider->getUIImage(shadow_name)->getImage(); mImageShadow = LLUI::getUIImage(shadow_name)->getImage();
} }
void LLProgressBar::setColorBar(const LLColor4 &c) void LLProgressBar::setColorBar(const LLColor4 &c)

View File

@@ -61,13 +61,13 @@ public:
protected: protected:
F32 mPercentDone; F32 mPercentDone;
LLPointer<LLImageGL> mImageBar; LLPointer<LLTexture> mImageBar;
//LLUUID mImageBarID; //LLUUID mImageBarID;
//LLString mImageBarName; //LLString mImageBarName;
LLColor4 mColorBar; LLColor4 mColorBar;
LLColor4 mColorBar2; LLColor4 mColorBar2;
LLPointer<LLImageGL> mImageShadow; LLPointer<LLTexture> mImageShadow;
//LLUUID mImageShadowID; //LLUUID mImageShadowID;
//LLString mImageShadowName; //LLString mImageShadowName;
LLColor4 mColorShadow; LLColor4 mColorShadow;

View File

@@ -60,7 +60,7 @@ LLResizeHandle::LLResizeHandle( const std::string& name, const LLRect& rect, S32
if( RIGHT_BOTTOM == mCorner) if( RIGHT_BOTTOM == mCorner)
{ {
mImage = LLUI::sImageProvider->getUIImage("UIImgResizeBottomRightUUID"); mImage = LLUI::getUIImage("UIImgResizeBottomRightUUID");
} }
switch( mCorner ) switch( mCorner )

View File

@@ -509,7 +509,7 @@ void LLScrollbar::draw()
// Draw background and thumb. // Draw background and thumb.
LLUIImage* rounded_rect_imagep = LLUI::sImageProvider->getUIImage("rounded_square.tga"); LLUIImage* rounded_rect_imagep = LLUI::getUIImage("rounded_square.tga");
if (!rounded_rect_imagep) if (!rounded_rect_imagep)
{ {

View File

@@ -132,7 +132,7 @@ void LLScrollListIcon::setValue(const LLSD& value)
{ {
// don't use default image specified by LLUUID::null, use no image in that case // don't use default image specified by LLUUID::null, use no image in that case
LLUUID image_id = value.asUUID(); LLUUID image_id = value.asUUID();
mIcon = image_id.notNull() ? LLUI::sImageProvider->getUIImageByID(image_id) : LLUIImagePtr(NULL); mIcon = image_id.notNull() ? LLUI::getUIImageByID(image_id) : LLUIImagePtr(NULL);
} }
else else
{ {
@@ -325,7 +325,7 @@ LLScrollListText::LLScrollListText( const std::string& text, const LLFontGL* fon
// initialize rounded rect image // initialize rounded rect image
if (!mRoundedRectImage) if (!mRoundedRectImage)
{ {
mRoundedRectImage = LLUI::sImageProvider->getUIImage("rounded_square.tga"); mRoundedRectImage = LLUI::getUIImage("rounded_square.tga");
} }
} }
//virtual //virtual

View File

@@ -73,9 +73,9 @@ LLSlider::LLSlider(
mMouseDownCallback( NULL ), mMouseDownCallback( NULL ),
mMouseUpCallback( NULL ) mMouseUpCallback( NULL )
{ {
mThumbImage = LLUI::sImageProvider->getUIImage("icn_slide-thumb_dark.tga"); mThumbImage = LLUI::getUIImage("icn_slide-thumb_dark.tga");
mTrackImage = LLUI::sImageProvider->getUIImage("icn_slide-groove_dark.tga"); mTrackImage = LLUI::getUIImage("icn_slide-groove_dark.tga");
mTrackHighlightImage = LLUI::sImageProvider->getUIImage("icn_slide-highlight.tga"); mTrackHighlightImage = LLUI::getUIImage("icn_slide-highlight.tga");
// properly handle setting the starting thumb rect // properly handle setting the starting thumb rect
// do it this way to handle both the operating-on-settings // do it this way to handle both the operating-on-settings

View File

@@ -36,7 +36,6 @@
#include "lluictrl.h" #include "lluictrl.h"
#include "v4color.h" #include "v4color.h"
class LLImageGL;
class LLSlider : public LLUICtrl class LLSlider : public LLUICtrl
{ {

View File

@@ -36,7 +36,7 @@
#include "llstring.h" #include "llstring.h"
#include "llui.h" #include "llui.h"
//#include "llviewerimagelist.h" //#include "llviewertexturelist.h"
LLStyle::LLStyle() LLStyle::LLStyle()
{ {
@@ -166,7 +166,7 @@ LLUIImagePtr LLStyle::getImage() const
void LLStyle::setImage(const LLUUID& src) void LLStyle::setImage(const LLUUID& src)
{ {
mImagep = LLUI::sImageProvider->getUIImageByID(src); mImagep = LLUI::getUIImageByID(src);
} }

View File

@@ -42,7 +42,6 @@
#include "v4color.h" #include "v4color.h"
#include "llrender.h" #include "llrender.h"
#include "llrect.h" #include "llrect.h"
#include "llimagegl.h"
#include "lldir.h" #include "lldir.h"
#include "llfontgl.h" #include "llfontgl.h"
@@ -76,6 +75,7 @@ LLHtmlHelp* LLUI::sHtmlHelp = NULL;
BOOL LLUI::sShowXUINames = FALSE; BOOL LLUI::sShowXUINames = FALSE;
std::stack<LLRect> LLScreenClipRect::sClipRectStack; std::stack<LLRect> LLScreenClipRect::sClipRectStack;
BOOL LLUI::sQAMode = FALSE; BOOL LLUI::sQAMode = FALSE;
S32 LLUI::sDefaultIconPriority = 0;
// //
// Functions // Functions
@@ -407,7 +407,7 @@ void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max
} }
void gl_draw_image( S32 x, S32 y, LLImageGL* image, const LLColor4& color, const LLRectf& uv_rect ) void gl_draw_image( S32 x, S32 y, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect )
{ {
if (NULL == image) if (NULL == image)
{ {
@@ -417,7 +417,7 @@ void gl_draw_image( S32 x, S32 y, LLImageGL* image, const LLColor4& color, const
gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), 0.f, image, color, uv_rect ); gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), 0.f, image, color, uv_rect );
} }
void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLImageGL* image, const LLColor4& color, const LLRectf& uv_rect) void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect)
{ {
if (NULL == image) if (NULL == image)
{ {
@@ -427,7 +427,7 @@ void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLImageGL* image,
gl_draw_scaled_rotated_image( x, y, width, height, 0.f, image, color, uv_rect ); gl_draw_scaled_rotated_image( x, y, width, height, 0.f, image, color, uv_rect );
} }
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLImageGL* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect) void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect)
{ {
if (NULL == image) if (NULL == image)
{ {
@@ -443,7 +443,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border
gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect); gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect);
} }
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLImageGL* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect, const LLRectf& scale_rect) void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect, const LLRectf& scale_rect)
{ {
stop_glerror(); stop_glerror();
@@ -629,12 +629,12 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLIma
} }
} }
void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLImageGL* image, const LLColor4& color, const LLRectf& uv_rect) void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect)
{ {
gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), degrees, image, color, uv_rect ); gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), degrees, image, color, uv_rect );
} }
void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLImageGL* image, const LLColor4& color, const LLRectf& uv_rect) void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect)
{ {
if (NULL == image) if (NULL == image)
{ {
@@ -680,7 +680,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
} }
void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLImageGL* image, const LLColor4& color, const LLRectf& uv_rect) void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect)
{ {
if (NULL == image) if (NULL == image)
{ {
@@ -1559,7 +1559,8 @@ void LLUI::initClass(LLControlGroup* config,
LLImageProviderInterface* image_provider, LLImageProviderInterface* image_provider,
LLUIAudioCallback audio_callback, LLUIAudioCallback audio_callback,
const LLVector2* scale_factor, const LLVector2* scale_factor,
const std::string& language) const std::string& language,
const S32 default_icon_priority)
{ {
sConfigGroup = config; sConfigGroup = config;
sIgnoresGroup = ignores; sIgnoresGroup = ignores;
@@ -1577,6 +1578,7 @@ void LLUI::initClass(LLControlGroup* config,
sGLScaleFactor = (scale_factor == NULL) ? LLVector2(1.f, 1.f) : *scale_factor; sGLScaleFactor = (scale_factor == NULL) ? LLVector2(1.f, 1.f) : *scale_factor;
sWindow = NULL; // set later in startup sWindow = NULL; // set later in startup
LLFontGL::sShadowColor = colors->getColor("ColorDropShadow"); LLFontGL::sShadowColor = colors->getColor("ColorDropShadow");
sDefaultIconPriority = default_icon_priority;
LLUI::sShowXUINames = LLUI::sConfigGroup->getBOOL("ShowXUINames"); LLUI::sShowXUINames = LLUI::sConfigGroup->getBOOL("ShowXUINames");
LLUI::sConfigGroup->getControl("ShowXUINames")->getSignal()->connect(&handleShowXUINamesChanged); LLUI::sConfigGroup->getControl("ShowXUINames")->getSignal()->connect(&handleShowXUINamesChanged);
@@ -1764,11 +1766,24 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen)
glPointToScreen(gl.mRight, gl.mBottom, &screen->mRight, &screen->mBottom); glPointToScreen(gl.mRight, gl.mBottom, &screen->mRight, &screen->mBottom);
} }
//static //static
LLUIImage* LLUI::getUIImage(const std::string& name) LLPointer<LLUIImage> LLUI::getUIImageByID(const LLUUID& image_id, S32 priority)
{ {
if (!name.empty()) if (sImageProvider)
return sImageProvider->getUIImage(name); {
return sImageProvider->getUIImageByID(image_id, priority);
}
else
{
return NULL;
}
}
//static
LLPointer<LLUIImage> LLUI::getUIImage(const std::string& name, S32 priority)
{
if (!name.empty() && sImageProvider)
return sImageProvider->getUIImage(name, priority);
else else
return NULL; return NULL;
} }
@@ -1853,7 +1868,7 @@ LLLocalClipRect::LLLocalClipRect(const LLRect &rect, BOOL enabled)
// LLUIImage // LLUIImage
// //
LLUIImage::LLUIImage(const std::string& name, LLPointer<LLImageGL> image) : LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image) :
mName(name), mName(name),
mImage(image), mImage(image),
mScaleRegion(0.f, 1.f, 1.f, 0.f), mScaleRegion(0.f, 1.f, 1.f, 0.f),

View File

@@ -42,7 +42,7 @@
//#include "llhtmlhelp.h" //#include "llhtmlhelp.h"
#include "llgl.h" // *TODO: break this dependency #include "llgl.h" // *TODO: break this dependency
#include <stack> #include <stack>
//#include "llimagegl.h" #include "lltexture.h"
#include <boost/signal.hpp> #include <boost/signal.hpp>
// LLUIFactory // LLUIFactory
@@ -50,7 +50,6 @@
class LLColor4; class LLColor4;
class LLHtmlHelp; class LLHtmlHelp;
class LLImageGL;
class LLVector3; class LLVector3;
class LLVector2; class LLVector2;
class LLUUID; class LLUUID;
@@ -91,14 +90,14 @@ void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4&
void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, F32 end_radians, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color); void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, F32 end_radians, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color);
void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LLColor4& inner_color, const LLColor4& outer_color); void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LLColor4& inner_color, const LLColor4& outer_color);
void gl_draw_image(S32 x, S32 y, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_image(S32 x, S32 y, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLImageGL* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLImageGL* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
// Flip vertical, used for LLFloaterHTML // Flip vertical, used for LLFloaterHTML
void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom); void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom);
void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f ); void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f );
@@ -163,7 +162,8 @@ public:
LLImageProviderInterface* image_provider, LLImageProviderInterface* image_provider,
LLUIAudioCallback audio_callback = NULL, LLUIAudioCallback audio_callback = NULL,
const LLVector2 *scale_factor = NULL, const LLVector2 *scale_factor = NULL,
const std::string& language = LLStringUtil::null); const std::string& language = LLStringUtil::null,
const S32 default_icon_priority = 0);
static void cleanupClass(); static void cleanupClass();
static void pushMatrix(); static void pushMatrix();
@@ -182,7 +182,8 @@ public:
static void getCursorPositionLocal(const LLView* viewp, S32 *x, S32 *y); static void getCursorPositionLocal(const LLView* viewp, S32 *x, S32 *y);
static void setScaleFactor(const LLVector2& scale_factor); static void setScaleFactor(const LLVector2& scale_factor);
static void setLineWidth(F32 width); static void setLineWidth(F32 width);
static LLUIImage* getUIImage(const std::string& name); static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = LLUI::sDefaultIconPriority);
static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = LLUI::sDefaultIconPriority);
static LLVector2 getWindowSize(); static LLVector2 getWindowSize();
static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y); static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y);
static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y); static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y);
@@ -203,6 +204,8 @@ public:
static BOOL sShowXUINames; static BOOL sShowXUINames;
static LLHtmlHelp* sHtmlHelp; static LLHtmlHelp* sHtmlHelp;
static S32 sDefaultIconPriority;
// *TODO: remove the following when QAR-369 settings clean-up work is in. // *TODO: remove the following when QAR-369 settings clean-up work is in.
// Also remove the call to this method which will then be obsolete. // Also remove the call to this method which will then be obsolete.
// Search for QAR-369 below to enable the proper accessing of this feature. -MG // Search for QAR-369 below to enable the proper accessing of this feature. -MG
@@ -416,13 +419,13 @@ public:
class LLUIImage : public LLRefCount class LLUIImage : public LLRefCount
{ {
public: public:
LLUIImage(const std::string& name, LLPointer<LLImageGL> image); LLUIImage(const std::string& name, LLPointer<LLTexture> image);
void setClipRegion(const LLRectf& region); void setClipRegion(const LLRectf& region);
void setScaleRegion(const LLRectf& region); void setScaleRegion(const LLRectf& region);
LLPointer<LLImageGL> getImage() { return mImage; } LLPointer<LLTexture> getImage() { return mImage; }
const LLPointer<LLImageGL>& getImage() const { return mImage; } const LLPointer<LLTexture>& getImage() const { return mImage; }
void draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color = UI_VERTEX_COLOR) const; void draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color = UI_VERTEX_COLOR) const;
void draw(S32 x, S32 y, const LLColor4& color = UI_VERTEX_COLOR) const; void draw(S32 x, S32 y, const LLColor4& color = UI_VERTEX_COLOR) const;
@@ -449,7 +452,7 @@ protected:
std::string mName; std::string mName;
LLRectf mScaleRegion; LLRectf mScaleRegion;
LLRectf mClipRegion; LLRectf mClipRegion;
LLPointer<LLImageGL> mImage; LLPointer<LLTexture> mImage;
BOOL mUniformScaling; BOOL mUniformScaling;
BOOL mNoClip; BOOL mNoClip;
}; };
@@ -597,8 +600,8 @@ public:
LLImageProviderInterface() {}; LLImageProviderInterface() {};
virtual ~LLImageProviderInterface() {}; virtual ~LLImageProviderInterface() {};
virtual LLUIImagePtr getUIImage(const std::string& name) = 0; virtual LLUIImagePtr getUIImage(const std::string& name, S32 priority) = 0;
virtual LLUIImagePtr getUIImageByID(const LLUUID& id) = 0; virtual LLUIImagePtr getUIImageByID(const LLUUID& id, S32 priority) = 0;
virtual void cleanUp() = 0; virtual void cleanUp() = 0;
}; };

View File

@@ -69,7 +69,7 @@ void LLViewBorder::setColorsExtended( const LLColor4& shadow_light, const LLColo
void LLViewBorder::setTexture( const LLUUID &image_id ) void LLViewBorder::setTexture( const LLUUID &image_id )
{ {
mTexture = LLUI::sImageProvider->getUIImageByID(image_id); mTexture = LLUI::getUIImageByID(image_id);
} }

View File

@@ -426,8 +426,8 @@ set(viewer_SOURCE_FILES
llviewerdisplay.cpp llviewerdisplay.cpp
llviewergenericmessage.cpp llviewergenericmessage.cpp
llviewergesture.cpp llviewergesture.cpp
llviewerimage.cpp #llviewerimage.cpp
llviewerimagelist.cpp #llviewerimagelist.cpp
llviewerinventory.cpp llviewerinventory.cpp
llviewerjointattachment.cpp llviewerjointattachment.cpp
llviewerjoint.cpp llviewerjoint.cpp
@@ -457,7 +457,9 @@ set(viewer_SOURCE_FILES
llviewershadermgr.cpp llviewershadermgr.cpp
llviewerstats.cpp llviewerstats.cpp
llviewertexteditor.cpp llviewertexteditor.cpp
llviewertexture.cpp
llviewertextureanim.cpp llviewertextureanim.cpp
llviewertexturelist.cpp
llviewerthrottle.cpp llviewerthrottle.cpp
llviewervisualparam.cpp llviewervisualparam.cpp
llviewerwindow.cpp llviewerwindow.cpp
@@ -902,8 +904,8 @@ set(viewer_HEADER_FILES
llviewerdisplay.h llviewerdisplay.h
llviewergenericmessage.h llviewergenericmessage.h
llviewergesture.h llviewergesture.h
llviewerimage.h #llviewerimage.h
llviewerimagelist.h #llviewerimagelist.h
llviewerinventory.h llviewerinventory.h
llviewerjoint.h llviewerjoint.h
llviewerjointattachment.h llviewerjointattachment.h
@@ -931,7 +933,9 @@ set(viewer_HEADER_FILES
llviewershadermgr.h llviewershadermgr.h
llviewerstats.h llviewerstats.h
llviewertexteditor.h llviewertexteditor.h
llviewertexture.h
llviewertextureanim.h llviewertextureanim.h
llviewertexturelist.h
llviewerthrottle.h llviewerthrottle.h
llviewervisualparam.h llviewervisualparam.h
llviewerwindow.h llviewerwindow.h

View File

@@ -141,7 +141,7 @@ BOOL DOFloaterHex::postBuild(void)
// static // static
void DOFloaterHex::imageCallback(BOOL success, void DOFloaterHex::imageCallback(BOOL success,
LLViewerImage *src_vi, LLViewerFetchedTexture *src_vi,
LLImageRaw* src, LLImageRaw* src,
LLImageRaw* aux_src, LLImageRaw* aux_src,
S32 discard_level, S32 discard_level,
@@ -179,7 +179,7 @@ void DOFloaterHex::imageCallback(BOOL success,
} }
else else
{ {
src_vi->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI); src_vi->setBoostLevel(LLViewerTexture::BOOST_UI);
} }
} }

View File

@@ -7,7 +7,7 @@
#include "llfloater.h" #include "llfloater.h"
#include "dohexeditor.h" #include "dohexeditor.h"
#include "llinventory.h" #include "llinventory.h"
#include "llviewerimage.h" #include "llviewertexture.h"
#include "llassettype.h" #include "llassettype.h"
class DOFloaterHex class DOFloaterHex
@@ -19,7 +19,7 @@ public:
BOOL postBuild(void); BOOL postBuild(void);
void close(bool app_quitting); void close(bool app_quitting);
static void imageCallback(BOOL success, static void imageCallback(BOOL success,
LLViewerImage *src_vi, LLViewerFetchedTexture *src_vi,
LLImageRaw* src, LLImageRaw* src,
LLImageRaw* aux_src, LLImageRaw* aux_src,
S32 discard_level, S32 discard_level,

View File

@@ -53,7 +53,7 @@ this feature is still a work in progress.
/* misc headers */ /* misc headers */
#include <time.h> #include <time.h>
#include <ctime> #include <ctime>
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llviewerobjectlist.h" #include "llviewerobjectlist.h"
#include "llfilepicker.h" #include "llfilepicker.h"
#include "llviewermenufile.h" #include "llviewermenufile.h"
@@ -129,16 +129,16 @@ LocalBitmap::LocalBitmap(std::string fullpath)
LLImageRaw* raw_image = new LLImageRaw(); LLImageRaw* raw_image = new LLImageRaw();
if ( this->decodeSelf(raw_image) ) if ( this->decodeSelf(raw_image) )
{ {
/* creating a shell LLViewerImage and fusing raw image into it */ /* creating a shell LLViewerTexture and fusing raw image into it */
LLViewerImage* viewer_image = new LLViewerImage( "file://"+this->filename, this->id, LOCAL_USE_MIPMAPS ); LLViewerFetchedTexture* viewer_image = new LLViewerFetchedTexture( "file://"+this->filename, this->id, LOCAL_USE_MIPMAPS );
viewer_image->createGLTexture( LOCAL_DISCARD_LEVEL, raw_image ); viewer_image->createGLTexture( LOCAL_DISCARD_LEVEL, raw_image );
viewer_image->mCachedRawImage = raw_image; viewer_image->setCachedRawImage(-1,raw_image);
/* making damn sure gImageList will not delete it prematurely */ /* making damn sure gTextureList will not delete it prematurely */
viewer_image->ref(); viewer_image->ref();
/* finalizing by adding LLViewerImage instance into gImageList */ /* finalizing by adding LLViewerTexture instance into gTextureList */
gImageList.addImage(viewer_image); gTextureList.addImage(viewer_image);
/* filename is valid, bitmap is decoded and valid, i can haz liftoff! */ /* filename is valid, bitmap is decoded and valid, i can haz liftoff! */
this->valid = true; this->valid = true;
@@ -172,12 +172,12 @@ void LocalBitmap::updateSelf()
if ( !decodeSelf(new_imgraw) ) { this->linkstatus = LINK_UPDATING; return; } if ( !decodeSelf(new_imgraw) ) { this->linkstatus = LINK_UPDATING; return; }
else { this->linkstatus = LINK_ON; } else { this->linkstatus = LINK_ON; }
LLViewerImage* image = gImageList.hasImage(this->id); LLViewerFetchedTexture* image = gTextureList.findImage(this->id);
if (!image->mForSculpt) if (!image->forSculpt())
{ image->createGLTexture( LOCAL_DISCARD_LEVEL, new_imgraw ); } { image->createGLTexture( LOCAL_DISCARD_LEVEL, new_imgraw ); }
else else
{ image->mCachedRawImage = new_imgraw; } { image->setCachedRawImage(-1,new_imgraw); }
/* finalizing by updating lastmod to current */ /* finalizing by updating lastmod to current */
this->last_modified = new_last_modified; this->last_modified = new_last_modified;
@@ -222,7 +222,7 @@ bool LocalBitmap::decodeSelf(LLImageRaw* rawimg)
if ( !bmp_image->load(filename) ) { break; } if ( !bmp_image->load(filename) ) { break; }
if ( !bmp_image->decode(rawimg, 0.0f) ) { break; } if ( !bmp_image->decode(rawimg, 0.0f) ) { break; }
rawimg->biasedScaleToPowerOfTwo( LLViewerImage::MAX_IMAGE_SIZE_DEFAULT ); rawimg->biasedScaleToPowerOfTwo( LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT );
return true; return true;
} }
@@ -235,7 +235,7 @@ bool LocalBitmap::decodeSelf(LLImageRaw* rawimg)
if( ( tga_image->getComponents() != 3) && if( ( tga_image->getComponents() != 3) &&
( tga_image->getComponents() != 4) ) { break; } ( tga_image->getComponents() != 4) ) { break; }
rawimg->biasedScaleToPowerOfTwo( LLViewerImage::MAX_IMAGE_SIZE_DEFAULT ); rawimg->biasedScaleToPowerOfTwo( LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT );
return true; return true;
} }
@@ -245,7 +245,7 @@ bool LocalBitmap::decodeSelf(LLImageRaw* rawimg)
if ( !jpeg_image->load(filename) ) { break; } if ( !jpeg_image->load(filename) ) { break; }
if ( !jpeg_image->decode(rawimg, 0.0f) ) { break; } if ( !jpeg_image->decode(rawimg, 0.0f) ) { break; }
rawimg->biasedScaleToPowerOfTwo( LLViewerImage::MAX_IMAGE_SIZE_DEFAULT ); rawimg->biasedScaleToPowerOfTwo( LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT );
return true; return true;
} }
@@ -255,7 +255,7 @@ bool LocalBitmap::decodeSelf(LLImageRaw* rawimg)
if ( !png_image->load(filename) ) { break; } if ( !png_image->load(filename) ) { break; }
if ( !png_image->decode(rawimg, 0.0f) ) { break; } if ( !png_image->decode(rawimg, 0.0f) ) { break; }
rawimg->biasedScaleToPowerOfTwo( LLViewerImage::MAX_IMAGE_SIZE_DEFAULT ); rawimg->biasedScaleToPowerOfTwo( LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT );
return true; return true;
} }
@@ -493,8 +493,8 @@ void LocalAssetBrowser::DelBitmap( std::vector<LLScrollListItem*> delete_vector,
if ( unit->getID() == id ) if ( unit->getID() == id )
{ {
LLViewerImage* image = gImageList.hasImage(id); LLViewerFetchedTexture* image = gTextureList.findImage(id);
gImageList.deleteImage( image ); gTextureList.deleteImage( image );
image->unref(); image->unref();
iter = loaded_bitmaps.erase(iter); iter = loaded_bitmaps.erase(iter);
@@ -685,7 +685,7 @@ void LocalAssetBrowser::PerformSculptUpdates(LocalBitmap* unit)
// update code [begin] // update code [begin]
if ( unit->volume_dirty ) if ( unit->volume_dirty )
{ {
LLImageRaw* rawimage = gImageList.hasImage( unit->getID() )->getCachedRawImage(); LLImageRaw* rawimage = gTextureList.findImage( unit->getID() )->getCachedRawImage();
aobj.object->getVolume()->sculpt(rawimage->getWidth(), rawimage->getHeight(), aobj.object->getVolume()->sculpt(rawimage->getWidth(), rawimage->getHeight(),
rawimage->getComponents(), rawimage->getData(), 0); rawimage->getComponents(), rawimage->getData(), 0);

View File

@@ -55,7 +55,7 @@
#include "llvoavatar.h" #include "llvoavatar.h"
#include "pipeline.h" #include "pipeline.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llstring.h" #include "llstring.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
@@ -157,8 +157,8 @@ LLFloaterSculptPreview::~LLFloaterSculptPreview()
clearAllPreviewTextures(); clearAllPreviewTextures();
mRawImagep = NULL; mRawImagep = NULL;
delete mAvatarPreview; mAvatarPreview = NULL;
delete mSculptedPreview; mSculptedPreview = NULL;
mImagep = NULL ; mImagep = NULL ;
} }
@@ -267,10 +267,9 @@ void LLFloaterSculptPreview::draw()
} }
else else
{ {
mImagep = new LLImageGL(mRawImagep, FALSE) ; mImagep = LLViewerTextureManager::getLocalTexture(mRawImagep.get(), FALSE) ;
gGL.getTexUnit(0)->unbind(mImagep->getTarget()) ; gGL.getTexUnit(0)->bind(mImagep);
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName());
stop_glerror(); stop_glerror();
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
@@ -309,11 +308,11 @@ void LLFloaterSculptPreview::draw()
if (selected == 9) if (selected == 9)
{ {
gGL.getTexUnit(0)->bind(mSculptedPreview->getTexture()); gGL.getTexUnit(0)->bind(mSculptedPreview);
} }
else else
{ {
gGL.getTexUnit(0)->bind(mAvatarPreview->getTexture()); gGL.getTexUnit(0)->bind(mAvatarPreview);
} }
gGL.begin( LLRender::QUADS ); gGL.begin( LLRender::QUADS );
@@ -513,7 +512,7 @@ void LLFloaterSculptPreview::onMouseCaptureLostImagePreview(LLMouseHandler* hand
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// LLPreviewAvatar // LLPreviewAvatar
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLPreviewAvatar::LLPreviewAvatar(S32 width, S32 height) : LLDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE) LLPreviewAvatar::LLPreviewAvatar(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE)
{ {
mNeedsUpdate = TRUE; mNeedsUpdate = TRUE;
mTargetJoint = NULL; mTargetJoint = NULL;
@@ -603,7 +602,7 @@ BOOL LLPreviewAvatar::render()
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
gGL.pushMatrix(); gGL.pushMatrix();
glLoadIdentity(); glLoadIdentity();
glOrtho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f); glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
gGL.pushMatrix(); gGL.pushMatrix();
@@ -612,7 +611,7 @@ BOOL LLPreviewAvatar::render()
LLGLSUIDefault def; LLGLSUIDefault def;
gGL.color4f(0.15f, 0.2f, 0.3f, 1.f); gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
gl_rect_2d_simple( mWidth, mHeight ); gl_rect_2d_simple( mFullWidth, mFullHeight );
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
gGL.popMatrix(); gGL.popMatrix();
@@ -634,9 +633,9 @@ BOOL LLPreviewAvatar::render()
stop_glerror(); stop_glerror();
LLViewerCamera::getInstance()->setAspect((F32)mWidth / mHeight); LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / mFullHeight);
LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
LLVertexBuffer::unbind(); LLVertexBuffer::unbind();
avatarp->updateLOD(); avatarp->updateLOD();
@@ -694,7 +693,7 @@ void LLPreviewAvatar::pan(F32 right, F32 up)
// LLPreviewSculpted // LLPreviewSculpted
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLPreviewSculpted::LLPreviewSculpted(S32 width, S32 height) : LLDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE) LLPreviewSculpted::LLPreviewSculpted(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE)
{ {
mNeedsUpdate = TRUE; mNeedsUpdate = TRUE;
mCameraDistance = 0.f; mCameraDistance = 0.f;
@@ -777,7 +776,7 @@ BOOL LLPreviewSculpted::render()
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
gGL.pushMatrix(); gGL.pushMatrix();
glLoadIdentity(); glLoadIdentity();
glOrtho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f); glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
gGL.pushMatrix(); gGL.pushMatrix();
@@ -785,7 +784,7 @@ BOOL LLPreviewSculpted::render()
gGL.color4f(1.f, 1.f, 1.f, 1.f); gGL.color4f(1.f, 1.f, 1.f, 1.f);
gl_rect_2d_simple( mWidth, mHeight ); gl_rect_2d_simple( mFullWidth, mFullHeight );
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
gGL.popMatrix(); gGL.popMatrix();
@@ -808,9 +807,9 @@ BOOL LLPreviewSculpted::render()
stop_glerror(); stop_glerror();
LLViewerCamera::getInstance()->setAspect((F32) mWidth / mHeight); LLViewerCamera::getInstance()->setAspect((F32) mFullWidth / mFullHeight);
LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
const LLVolumeFace &vf = mVolume->getVolumeFace(0); const LLVolumeFace &vf = mVolume->getVolumeFace(0);
U32 num_indices = vf.mIndices.size(); U32 num_indices = vf.mIndices.size();

View File

@@ -46,7 +46,7 @@ class LLVOAvatar;
class LLTextBox; class LLTextBox;
class LLVertexBuffer; class LLVertexBuffer;
class LLPreviewSculpted : public LLDynamicTexture class LLPreviewSculpted : public LLViewerDynamicTexture
{ {
public: public:
LLPreviewSculpted(S32 width, S32 height); LLPreviewSculpted(S32 width, S32 height);
@@ -75,7 +75,7 @@ class LLPreviewSculpted : public LLDynamicTexture
}; };
class LLPreviewAvatar : public LLDynamicTexture class LLPreviewAvatar : public LLViewerDynamicTexture
{ {
public: public:
LLPreviewAvatar(S32 width, S32 height); LLPreviewAvatar(S32 width, S32 height);
@@ -129,13 +129,13 @@ protected:
bool loadImage(LLImageRaw* src); bool loadImage(LLImageRaw* src);
LLPointer<LLImageRaw> mRawImagep; LLPointer<LLImageRaw> mRawImagep;
LLPreviewAvatar* mAvatarPreview; LLPointer<LLPreviewAvatar> mAvatarPreview;
LLPreviewSculpted* mSculptedPreview; LLPointer<LLPreviewSculpted> mSculptedPreview;
S32 mLastMouseX; S32 mLastMouseX;
S32 mLastMouseY; S32 mLastMouseY;
LLRect mPreviewRect; LLRect mPreviewRect;
LLRectf mPreviewImageRect; LLRectf mPreviewImageRect;
LLPointer<LLImageGL> mImagep ; LLPointer<LLViewerTexture> mImagep ;
LLViewerObject* tmpvolume; LLViewerObject* tmpvolume;
static S32 sUploadAmount; static S32 sUploadAmount;

View File

@@ -102,7 +102,7 @@ BOOL HGFloaterTextEditor::postBuild(void)
// static // static
void HGFloaterTextEditor::imageCallback(BOOL success, void HGFloaterTextEditor::imageCallback(BOOL success,
LLViewerImage *src_vi, LLViewerFetchedTexture *src_vi,
LLImageRaw* src, LLImageRaw* src,
LLImageRaw* aux_src, LLImageRaw* aux_src,
S32 discard_level, S32 discard_level,
@@ -141,7 +141,7 @@ void HGFloaterTextEditor::imageCallback(BOOL success,
} }
else else
{ {
src_vi->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI); src_vi->setBoostLevel(LLViewerTexture::BOOST_UI);
} }
} }

View File

@@ -14,7 +14,7 @@
#include "llfloater.h" #include "llfloater.h"
#include "lltexteditor.h" #include "lltexteditor.h"
#include "llinventory.h" #include "llinventory.h"
#include "llviewerimage.h" #include "llviewertexture.h"
class HGFloaterTextEditor class HGFloaterTextEditor
: public LLFloater : public LLFloater
@@ -25,7 +25,7 @@ public:
BOOL postBuild(void); BOOL postBuild(void);
void close(bool app_quitting); void close(bool app_quitting);
static void imageCallback(BOOL success, static void imageCallback(BOOL success,
LLViewerImage *src_vi, LLViewerFetchedTexture *src_vi,
LLImageRaw* src, LLImageRaw* src,
LLImageRaw* aux_src, LLImageRaw* aux_src,
S32 discard_level, S32 discard_level,

View File

@@ -44,7 +44,7 @@
#include "lltexteditor.h" #include "lltexteditor.h"
#include "llalertdialog.h" #include "llalertdialog.h"
#include "llerrorcontrol.h" #include "llerrorcontrol.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llgroupmgr.h" #include "llgroupmgr.h"
#include "llagent.h" #include "llagent.h"
#include "llwindow.h" #include "llwindow.h"
@@ -654,7 +654,9 @@ bool LLAppViewer::init()
&gColors, &gColors,
LLUIImageList::getInstance(), LLUIImageList::getInstance(),
ui_audio_callback, ui_audio_callback,
&LLUI::sGLScaleFactor); &LLUI::sGLScaleFactor,
std::string(),
LLViewerFetchedTexture::BOOST_ICON);
LLWeb::initClass(); // do this after LLUI LLWeb::initClass(); // do this after LLUI
LLTextEditor::setURLCallbacks(&LLWeb::loadURL, LLTextEditor::setURLCallbacks(&LLWeb::loadURL,
@@ -1424,12 +1426,12 @@ bool LLAppViewer::cleanup()
sImageDecodeThread = NULL; sImageDecodeThread = NULL;
//Note: //Note:
//LLViewerMedia::cleanupClass() has to be put before gImageList.shutdown() //LLViewerMedia::cleanupClass() has to be put before gTextureList.shutdown()
//because some new image might be generated during cleaning up media. --bao //because some new image might be generated during cleaning up media. --bao
LLViewerMediaFocus::cleanupClass(); LLViewerMediaFocus::cleanupClass();
LLViewerMedia::cleanupClass(); LLViewerMedia::cleanupClass();
LLViewerParcelMedia::cleanupClass(); LLViewerParcelMedia::cleanupClass();
gImageList.shutdown(); // shutdown again in case a callback added something gTextureList.shutdown(); // shutdown again in case a callback added something
LLUIImageList::getInstance()->cleanUp(); LLUIImageList::getInstance()->cleanUp();
// This should eventually be done in LLAppViewer // This should eventually be done in LLAppViewer

View File

@@ -4,7 +4,7 @@
#include "llapr.h" #include "llapr.h"
#include "llvfile.h" #include "llvfile.h"
#include "llassetconverter.h" #include "llassetconverter.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llvorbisencode.h" #include "llvorbisencode.h"
#include "llbvhloader.h" #include "llbvhloader.h"
// static // static
@@ -18,7 +18,7 @@ LLAssetType::EType LLAssetConverter::convert(std::string src_filename, std::stri
else if(exten == "bmp") else if(exten == "bmp")
{ {
asset_type = LLAssetType::AT_TEXTURE; asset_type = LLAssetType::AT_TEXTURE;
if (!LLViewerImageList::createUploadFile(src_filename, if (!LLViewerTextureList::createUploadFile(src_filename,
filename, filename,
IMG_CODEC_BMP )) IMG_CODEC_BMP ))
{ {
@@ -28,7 +28,7 @@ LLAssetType::EType LLAssetConverter::convert(std::string src_filename, std::stri
else if( exten == "tga") else if( exten == "tga")
{ {
asset_type = LLAssetType::AT_TEXTURE; asset_type = LLAssetType::AT_TEXTURE;
if (!LLViewerImageList::createUploadFile(src_filename, if (!LLViewerTextureList::createUploadFile(src_filename,
filename, filename,
IMG_CODEC_TGA )) IMG_CODEC_TGA ))
{ {
@@ -38,7 +38,7 @@ LLAssetType::EType LLAssetConverter::convert(std::string src_filename, std::stri
else if( exten == "jpg" || exten == "jpeg") else if( exten == "jpg" || exten == "jpeg")
{ {
asset_type = LLAssetType::AT_TEXTURE; asset_type = LLAssetType::AT_TEXTURE;
if (!LLViewerImageList::createUploadFile(src_filename, if (!LLViewerTextureList::createUploadFile(src_filename,
filename, filename,
IMG_CODEC_JPEG )) IMG_CODEC_JPEG ))
{ {
@@ -48,7 +48,7 @@ LLAssetType::EType LLAssetConverter::convert(std::string src_filename, std::stri
else if( exten == "png") else if( exten == "png")
{ {
asset_type = LLAssetType::AT_TEXTURE; asset_type = LLAssetType::AT_TEXTURE;
if (!LLViewerImageList::createUploadFile(src_filename, if (!LLViewerTextureList::createUploadFile(src_filename,
filename, filename,
IMG_CODEC_PNG )) IMG_CODEC_PNG ))
{ {

View File

@@ -48,7 +48,7 @@
#include "lltextbox.h" #include "lltextbox.h"
#include "llfloatercolorpicker.h" #include "llfloatercolorpicker.h"
#include "llviewborder.h" #include "llviewborder.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llfocusmgr.h" #include "llfocusmgr.h"
static LLRegisterWidget<LLColorSwatchCtrl> r("color_swatch"); static LLRegisterWidget<LLColorSwatchCtrl> r("color_swatch");
@@ -236,7 +236,7 @@ void LLColorSwatchCtrl::draw()
{ {
if (!mFallbackImageName.empty()) if (!mFallbackImageName.empty())
{ {
LLPointer<LLViewerImage> fallback_image = gImageList.getImageFromFile(mFallbackImageName); LLPointer<LLViewerFetchedTexture> fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName);
if( fallback_image->getComponents() == 4 ) if( fallback_image->getComponents() == 4 )
{ {
gl_rect_2d_checkerboard( interior ); gl_rect_2d_checkerboard( interior );

View File

@@ -36,7 +36,7 @@
#include "lluictrl.h" #include "lluictrl.h"
#include "v4color.h" #include "v4color.h"
#include "llfloater.h" #include "llfloater.h"
#include "llviewerimage.h" #include "llviewertexture.h"
// //
// Classes // Classes
@@ -44,7 +44,6 @@
class LLColor4; class LLColor4;
class LLTextBox; class LLTextBox;
class LLFloaterColorPicker; class LLFloaterColorPicker;
class LLViewerImage;
class LLColorSwatchCtrl class LLColorSwatchCtrl
: public LLUICtrl : public LLUICtrl

View File

@@ -43,8 +43,7 @@
#include "llagent.h" #include "llagent.h"
#include "llcompass.h" #include "llcompass.h"
#include "llviewerimage.h" #include "llviewertexturelist.h"
#include "llviewerimagelist.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llviewercamera.h" #include "llviewercamera.h"
@@ -76,12 +75,12 @@ LLCompass::LLCompass( const std::string& name, const LLRect& rect)
void LLCompass::setTexture(LLUUID image_id) void LLCompass::setTexture(LLUUID image_id)
{ {
mTexture = gImageList.getImage(image_id, FALSE, TRUE); mTexture = LLViewerTextureManager::getFetchedTexture(image_id, FALSE, LLViewerTexture::BOOST_UI);
} }
void LLCompass::setBkgndTexture(LLUUID image_id) void LLCompass::setBkgndTexture(LLUUID image_id)
{ {
mBkgndTexture = gImageList.getImage(image_id, FALSE, TRUE); mBkgndTexture = LLViewerTextureManager::getFetchedTexture(image_id, FALSE, LLViewerTexture::BOOST_UI);
} }
// //
@@ -107,5 +106,5 @@ LLHorizontalCompass::LLHorizontalCompass( const std::string& name, const LLRect&
void LLHorizontalCompass::setTexture( const LLUUID& image_id ) void LLHorizontalCompass::setTexture( const LLUUID& image_id )
{ {
mTexture = gImageList.getImage(image_id, FALSE, TRUE); mTexture = LLViewerTextureManager::getFetchedTexture(image_id, FALSE, LLViewerTexture::BOOST_UI);
} }

View File

@@ -35,7 +35,7 @@
#include "llmath.h" #include "llmath.h"
#include "llview.h" #include "llview.h"
#include "llviewerimage.h" #include "llviewertexture.h"
#ifndef LL_V4COLOR_H #ifndef LL_V4COLOR_H
#include "v4color.h" #include "v4color.h"
#endif #endif
@@ -43,8 +43,8 @@
class LLCompass : public LLView class LLCompass : public LLView
{ {
protected: protected:
LLPointer<LLViewerImage> mTexture; LLPointer<LLViewerTexture> mTexture;
LLPointer<LLViewerImage> mBkgndTexture; LLPointer<LLViewerTexture> mBkgndTexture;
public: public:
LLCompass( const std::string& name, const LLRect& rect); LLCompass( const std::string& name, const LLRect& rect);
@@ -77,7 +77,7 @@ class LLHorizontalCompass : public LLView
{ {
protected: protected:
LLColor4 mFocusColor; LLColor4 mFocusColor;
LLPointer<LLViewerImage> mTexture; LLPointer<LLViewerTexture> mTexture;
public: public:
LLHorizontalCompass( const std::string& name, const LLRect& rect, LLHorizontalCompass( const std::string& name, const LLRect& rect,

View File

@@ -41,8 +41,7 @@
#include "llfontgl.h" #include "llfontgl.h"
#include "llgl.h" #include "llgl.h"
#include "llui.h" #include "llui.h"
#include "llviewerimage.h" #include "llviewertexturelist.h"
#include "llviewerimagelist.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "lltextparser.h" #include "lltextparser.h"
#include "llsd.h" #include "llsd.h"

View File

@@ -229,7 +229,7 @@ S32 LLDrawable::findReferences(LLDrawable *drawablep)
return count; return count;
} }
LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerImage *texturep) LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerTexture *texturep)
{ {
LLMemType mt(LLMemType::MTYPE_DRAWABLE); LLMemType mt(LLMemType::MTYPE_DRAWABLE);
@@ -253,7 +253,7 @@ LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerImage *texturep)
return face; return face;
} }
LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerImage *texturep) LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep)
{ {
LLMemType mt(LLMemType::MTYPE_DRAWABLE); LLMemType mt(LLMemType::MTYPE_DRAWABLE);
@@ -275,7 +275,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerImage *texturep)
} }
void LLDrawable::setNumFaces(const S32 newFaces, LLFacePool *poolp, LLViewerImage *texturep) void LLDrawable::setNumFaces(const S32 newFaces, LLFacePool *poolp, LLViewerTexture *texturep)
{ {
if (newFaces == (S32)mFaces.size()) if (newFaces == (S32)mFaces.size())
{ {
@@ -298,7 +298,7 @@ void LLDrawable::setNumFaces(const S32 newFaces, LLFacePool *poolp, LLViewerImag
llassert_always(mFaces.size() == newFaces); llassert_always(mFaces.size() == newFaces);
} }
void LLDrawable::setNumFacesFast(const S32 newFaces, LLFacePool *poolp, LLViewerImage *texturep) void LLDrawable::setNumFacesFast(const S32 newFaces, LLFacePool *poolp, LLViewerTexture *texturep)
{ {
if (newFaces <= (S32)mFaces.size() && newFaces >= (S32)mFaces.size()/2) if (newFaces <= (S32)mFaces.size() && newFaces >= (S32)mFaces.size()/2)
{ {

View File

@@ -59,7 +59,7 @@ class LLSpatialGroup;
class LLSpatialBridge; class LLSpatialBridge;
class LLSpatialPartition; class LLSpatialPartition;
class LLVOVolume; class LLVOVolume;
class LLViewerImage; class LLViewerTexture;
// Can have multiple silhouettes for each object // Can have multiple silhouettes for each object
const U32 SILHOUETTE_HIGHLIGHT = 0; const U32 SILHOUETTE_HIGHLIGHT = 0;
@@ -127,11 +127,11 @@ public:
inline S32 getNumFaces() const; inline S32 getNumFaces() const;
//void removeFace(const S32 i); // SJB: Avoid using this, it's slow //void removeFace(const S32 i); // SJB: Avoid using this, it's slow
LLFace* addFace(LLFacePool *poolp, LLViewerImage *texturep); LLFace* addFace(LLFacePool *poolp, LLViewerTexture *texturep);
LLFace* addFace(const LLTextureEntry *te, LLViewerImage *texturep); LLFace* addFace(const LLTextureEntry *te, LLViewerTexture *texturep);
void deleteFaces(S32 offset, S32 count); void deleteFaces(S32 offset, S32 count);
void setNumFaces(const S32 numFaces, LLFacePool *poolp, LLViewerImage *texturep); void setNumFaces(const S32 numFaces, LLFacePool *poolp, LLViewerTexture *texturep);
void setNumFacesFast(const S32 numFaces, LLFacePool *poolp, LLViewerImage *texturep); void setNumFacesFast(const S32 numFaces, LLFacePool *poolp, LLViewerTexture *texturep);
void mergeFaces(LLDrawable* src); void mergeFaces(LLDrawable* src);
void init(); void init();

View File

@@ -60,7 +60,7 @@ S32 LLDrawPool::sNumDrawPools = 0;
//============================= //=============================
// Draw Pool Implementation // Draw Pool Implementation
//============================= //=============================
LLDrawPool *LLDrawPool::createPool(const U32 type, LLViewerImage *tex0) LLDrawPool *LLDrawPool::createPool(const U32 type, LLViewerTexture *tex0)
{ {
LLDrawPool *poolp = NULL; LLDrawPool *poolp = NULL;
switch (type) switch (type)
@@ -130,7 +130,7 @@ LLDrawPool::~LLDrawPool()
} }
LLViewerImage *LLDrawPool::getDebugTexture() LLViewerTexture *LLDrawPool::getDebugTexture()
{ {
return NULL; return NULL;
} }
@@ -245,7 +245,7 @@ void LLFacePool::destroy()
} }
} }
void LLFacePool::dirtyTextures(const std::set<LLViewerImage*>& textures) void LLFacePool::dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures)
{ {
} }
@@ -297,7 +297,7 @@ void LLFacePool::drawLoop()
} }
void LLFacePool::renderFaceSelected(LLFace *facep, void LLFacePool::renderFaceSelected(LLFace *facep,
LLImageGL *image, LLViewerTexture *image,
const LLColor4 &color, const LLColor4 &color,
const S32 index_offset, const S32 index_count) const S32 index_offset, const S32 index_count)
{ {
@@ -331,7 +331,7 @@ void LLFacePool::resetDrawOrders()
mDrawFace.resize(0); mDrawFace.resize(0);
} }
LLViewerImage *LLFacePool::getTexture() LLViewerTexture *LLFacePool::getTexture()
{ {
return NULL; return NULL;
} }

View File

@@ -39,8 +39,8 @@
#include "llvertexbuffer.h" #include "llvertexbuffer.h"
class LLFace; class LLFace;
class LLImageGL; class LLViewerTexture;
class LLViewerImage; class LLViewerFetchedTexture;
class LLSpatialGroup; class LLSpatialGroup;
class LLDrawInfo; class LLDrawInfo;
@@ -78,7 +78,7 @@ public:
S32 getId() const { return mId; } S32 getId() const { return mId; }
U32 getType() const { return mType; } U32 getType() const { return mType; }
virtual LLViewerImage *getDebugTexture(); virtual LLViewerTexture *getDebugTexture();
virtual void beginRenderPass( S32 pass ); virtual void beginRenderPass( S32 pass );
virtual void endRenderPass( S32 pass ); virtual void endRenderPass( S32 pass );
virtual S32 getNumPasses(); virtual S32 getNumPasses();
@@ -104,9 +104,9 @@ public:
virtual BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct! virtual BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct!
virtual S32 getVertexShaderLevel() const { return mVertexShaderLevel; } virtual S32 getVertexShaderLevel() const { return mVertexShaderLevel; }
static LLDrawPool* createPool(const U32 type, LLViewerImage *tex0 = NULL); static LLDrawPool* createPool(const U32 type, LLViewerTexture *tex0 = NULL);
virtual LLDrawPool *instancePool() = 0; // Create an empty new instance of the pool. virtual LLDrawPool *instancePool() = 0; // Create an empty new instance of the pool.
virtual LLViewerImage* getTexture() = 0; virtual LLViewerTexture* getTexture() = 0;
virtual BOOL isFacePool() { return FALSE; } virtual BOOL isFacePool() { return FALSE; }
virtual void resetDrawOrders() = 0; virtual void resetDrawOrders() = 0;
@@ -140,8 +140,8 @@ public:
LLRenderPass(const U32 type); LLRenderPass(const U32 type);
virtual ~LLRenderPass(); virtual ~LLRenderPass();
/*virtual*/ LLDrawPool* instancePool(); /*virtual*/ LLDrawPool* instancePool();
/*virtual*/ LLViewerImage* getDebugTexture() { return NULL; } /*virtual*/ LLViewerTexture* getDebugTexture() { return NULL; }
LLViewerImage* getTexture() { return NULL; } LLViewerTexture* getTexture() { return NULL; }
BOOL isDead() { return FALSE; } BOOL isDead() { return FALSE; }
void resetDrawOrders() { } void resetDrawOrders() { }
@@ -170,11 +170,11 @@ public:
virtual void renderForSelect() = 0; virtual void renderForSelect() = 0;
BOOL isDead() { return mReferences.empty(); } BOOL isDead() { return mReferences.empty(); }
virtual void renderFaceSelected(LLFace *facep, LLImageGL *image, const LLColor4 &color, virtual void renderFaceSelected(LLFace *facep, LLViewerTexture *image, const LLColor4 &color,
const S32 index_offset = 0, const S32 index_count = 0); const S32 index_offset = 0, const S32 index_count = 0);
virtual LLViewerImage *getTexture(); virtual LLViewerTexture *getTexture();
virtual void dirtyTextures(const std::set<LLViewerImage*>& textures); virtual void dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures);
virtual void enqueue(LLFace *face); virtual void enqueue(LLFace *face);
virtual BOOL addFace(LLFace *face); virtual BOOL addFace(LLFace *face);

View File

@@ -46,7 +46,7 @@
#include "lldrawable.h" #include "lldrawable.h"
#include "llface.h" #include "llface.h"
#include "llviewercamera.h" #include "llviewercamera.h"
#include "llviewerimagelist.h" // For debugging #include "llviewertexturelist.h" // For debugging
#include "llviewerobjectlist.h" // For debugging #include "llviewerobjectlist.h" // For debugging
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "pipeline.h" #include "pipeline.h"
@@ -237,8 +237,8 @@ void LLDrawPoolAlpha::render(S32 pass)
} }
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
glColor4f(1,0,0,1); glColor4f(1,0,0,1);
LLViewerImage::sSmokeImagep->addTextureStats(1024.f*1024.f); LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(0)->bind(LLViewerImage::sSmokeImagep.get(), TRUE); gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sSmokeImagep.get(), TRUE);
renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX | renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_TEXCOORD0); LLVertexBuffer::MAP_TEXCOORD0);
} }

View File

@@ -650,7 +650,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
if (pass==1 && (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) || LLViewerPartSim::getMaxPartCount() <= 0)) if (pass==1 && (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) || LLViewerPartSim::getMaxPartCount() <= 0))
{ {
// debug code to draw a sphere in place of avatar // debug code to draw a sphere in place of avatar
gGL.getTexUnit(0)->bind(LLViewerImage::sWhiteImagep.get()); gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep.get());
gGL.setColorMask(true, true); gGL.setColorMask(true, true);
LLVector3 pos = avatarp->getPositionAgent(); LLVector3 pos = avatarp->getPositionAgent();
gGL.color4f(1.0f, 1.0f, 1.0f, 0.7f); gGL.color4f(1.0f, 1.0f, 1.0f, 0.7f);
@@ -839,7 +839,7 @@ void LLDrawPoolAvatar::renderForSelect()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// getDebugTexture() // getDebugTexture()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLViewerImage *LLDrawPoolAvatar::getDebugTexture() LLViewerTexture *LLDrawPoolAvatar::getDebugTexture()
{ {
if (mReferences.empty()) if (mReferences.empty())
{ {

View File

@@ -105,7 +105,7 @@ public:
void endDeferredRigid(); void endDeferredRigid();
void endDeferredSkinned(); void endDeferredSkinned();
/*virtual*/ LLViewerImage *getDebugTexture(); /*virtual*/ LLViewerTexture *getDebugTexture();
/*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
void renderAvatars(LLVOAvatar *single_avatar, S32 pass = -1); // renders only one avatar if single_avatar is not null. void renderAvatars(LLVOAvatar *single_avatar, S32 pass = -1); // renders only one avatar if single_avatar is not null.

View File

@@ -37,7 +37,6 @@
#include "llstl.h" #include "llstl.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "lldir.h" #include "lldir.h"
#include "llimagegl.h"
#include "m3math.h" #include "m3math.h"
#include "m4math.h" #include "m4math.h"
#include "v4math.h" #include "v4math.h"
@@ -51,7 +50,7 @@
#include "llsky.h" #include "llsky.h"
#include "lltextureentry.h" #include "lltextureentry.h"
#include "llviewercamera.h" #include "llviewercamera.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "pipeline.h" #include "pipeline.h"
#include "llspatialpartition.h" #include "llspatialpartition.h"
#include "llviewershadermgr.h" #include "llviewershadermgr.h"
@@ -95,7 +94,16 @@ void LLStandardBumpmap::shutdown()
// static // static
void LLStandardBumpmap::restoreGL() void LLStandardBumpmap::restoreGL()
{ {
llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); addstandard();
}
// static
void LLStandardBumpmap::addstandard()
{
// can't assert; we destroyGL and restoreGL a lot during *first* startup, which populates this list already, THEN we explicitly init the list as part of *normal* startup. Sigh. So clear the list every time before we (re-)add the standard bumpmaps.
//llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 );
clear();
llinfos << "Adding standard bumpmaps." << llendl;
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Brightness"); // BE_BRIGHTNESS gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Brightness"); // BE_BRIGHTNESS
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness"); // BE_DARKNESS gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness"); // BE_DARKNESS
@@ -127,9 +135,9 @@ void LLStandardBumpmap::restoreGL()
{ {
// *NOTE: This buffer size is hard coded into scanf() below. // *NOTE: This buffer size is hard coded into scanf() below.
char label[2048] = ""; /* Flawfinder: ignore */ char label[2048] = ""; /* Flawfinder: ignore */
char bump_file[2048] = ""; /* Flawfinder: ignore */ char bump_image_id[2048] = ""; /* Flawfinder: ignore */
fields_read = fscanf( /* Flawfinder: ignore */ fields_read = fscanf( /* Flawfinder: ignore */
file, "\n%2047s %2047s", label, bump_file); file, "\n%2047s %2047s", label, bump_image_id);
if( EOF == fields_read ) if( EOF == fields_read )
{ {
break; break;
@@ -139,16 +147,19 @@ void LLStandardBumpmap::restoreGL()
llwarns << "Bad LLStandardBumpmap entry" << llendl; llwarns << "Bad LLStandardBumpmap entry" << llendl;
return; return;
} }
if(strlen(bump_image_id) == (UUID_STR_LENGTH - 1) + 4 && !stricmp(&(bump_image_id[UUID_STR_LENGTH-1]),".j2c"))
bump_image_id[UUID_STR_LENGTH-1] = 0; // truncate to a valid uuid (hopefully)
// llinfos << "Loading bumpmap: " << bump_file << " from viewerart" << llendl; // llinfos << "Loading bumpmap: " << bump_file << " from viewerart" << llendl;
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label;
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage =
gImageList.getImageFromFile(bump_file, LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id),
TRUE, TRUE,
FALSE, LLViewerTexture::BOOST_NONE,
LLViewerTexture::LOD_TEXTURE,
0, 0,
0); 0);
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL ); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL );
LLStandardBumpmap::sStandardBumpmapCount++; LLStandardBumpmap::sStandardBumpmapCount++;
} }
@@ -156,8 +167,9 @@ void LLStandardBumpmap::restoreGL()
} }
// static // static
void LLStandardBumpmap::destroyGL() void LLStandardBumpmap::clear()
{ {
llinfos << "Clearing standard bumpmaps." << llendl;
for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ ) for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ )
{ {
gStandardBumpmapList[i].mLabel.assign(""); gStandardBumpmapList[i].mLabel.assign("");
@@ -166,6 +178,12 @@ void LLStandardBumpmap::destroyGL()
sStandardBumpmapCount = 0; sStandardBumpmapCount = 0;
} }
// static
void LLStandardBumpmap::destroyGL()
{
clear();
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@@ -570,27 +588,25 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL
// static // static
BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel)
{ {
LLImageGL* bump = NULL; LLViewerTexture* bump = NULL;
U8 bump_code = params.mBump; U8 bump_code = params.mBump;
LLViewerImage* tex = params.mTexture;
//Note: texture atlas does not support bump texture now.
LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(params.mTexture) ;
if(!tex)
{
//if the texture is not a fetched texture
return FALSE;
}
switch( bump_code ) switch( bump_code )
{ {
case BE_NO_BUMP: case BE_NO_BUMP:
bump = NULL;
break; break;
case BE_BRIGHTNESS: case BE_BRIGHTNESS:
case BE_DARKNESS: case BE_DARKNESS:
if( tex ) bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code );
{
if(tex->getID()== IMG_DEFAULT)
{
return TRUE;
}
bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code );
}
break; break;
default: default:
@@ -785,24 +801,32 @@ void LLBumpImageList::init()
LLStandardBumpmap::init(); LLStandardBumpmap::init();
} }
void LLBumpImageList::shutdown() void LLBumpImageList::clear()
{ {
llinfos << "Clearing dynamic bumpmaps." << llendl;
// these will be re-populated on-demand
mBrightnessEntries.clear(); mBrightnessEntries.clear();
mDarknessEntries.clear(); mDarknessEntries.clear();
LLStandardBumpmap::clear();
}
void LLBumpImageList::shutdown()
{
clear();
LLStandardBumpmap::shutdown(); LLStandardBumpmap::shutdown();
} }
void LLBumpImageList::destroyGL() void LLBumpImageList::destroyGL()
{ {
mBrightnessEntries.clear(); clear();
mDarknessEntries.clear();
LLStandardBumpmap::destroyGL(); LLStandardBumpmap::destroyGL();
} }
void LLBumpImageList::restoreGL() void LLBumpImageList::restoreGL()
{ {
// Images will be recreated as they are needed.
LLStandardBumpmap::restoreGL(); LLStandardBumpmap::restoreGL();
// Images will be recreated as they are needed.
} }
@@ -818,9 +842,9 @@ LLBumpImageList::~LLBumpImageList()
void LLBumpImageList::addTextureStats(U8 bump, const LLUUID& base_image_id, F32 virtual_size) void LLBumpImageList::addTextureStats(U8 bump, const LLUUID& base_image_id, F32 virtual_size)
{ {
bump &= TEM_BUMP_MASK; bump &= TEM_BUMP_MASK;
LLViewerImage* bump_image = gStandardBumpmapList[bump].mImage; LLViewerFetchedTexture* bump_image = gStandardBumpmapList[bump].mImage;
if( bump_image ) if( bump_image )
{ {
bump_image->addTextureStats(virtual_size); bump_image->addTextureStats(virtual_size);
} }
} }
@@ -832,11 +856,11 @@ void LLBumpImageList::updateImages()
for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); ) for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); )
{ {
bump_image_map_t::iterator curiter = iter++; bump_image_map_t::iterator curiter = iter++;
LLImageGL* image = curiter->second; LLViewerTexture* image = curiter->second;
if( image ) if( image )
{ {
BOOL destroy = TRUE; BOOL destroy = TRUE;
if( image->getHasGLTexture()) if( image->hasGLTexture())
{ {
if( image->getBoundRecently() ) if( image->getBoundRecently() )
{ {
@@ -859,11 +883,11 @@ void LLBumpImageList::updateImages()
for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); ) for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); )
{ {
bump_image_map_t::iterator curiter = iter++; bump_image_map_t::iterator curiter = iter++;
LLImageGL* image = curiter->second; LLViewerTexture* image = curiter->second;
if( image ) if( image )
{ {
BOOL destroy = TRUE; BOOL destroy = TRUE;
if( image->getHasGLTexture()) if( image->hasGLTexture())
{ {
if( image->getBoundRecently() ) if( image->getBoundRecently() )
{ {
@@ -887,16 +911,16 @@ void LLBumpImageList::updateImages()
// Note: the caller SHOULD NOT keep the pointer that this function returns. It may be updated as more data arrives. // Note: the caller SHOULD NOT keep the pointer that this function returns. It may be updated as more data arrives.
LLImageGL* LLBumpImageList::getBrightnessDarknessImage(LLViewerImage* src_image, U8 bump_code ) LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedTexture* src_image, U8 bump_code )
{ {
llassert( (bump_code == BE_BRIGHTNESS) || (bump_code == BE_DARKNESS) ); llassert( (bump_code == BE_BRIGHTNESS) || (bump_code == BE_DARKNESS) );
LLImageGL* bump = NULL; LLViewerTexture* bump = NULL;
const F32 BRIGHTNESS_DARKNESS_PIXEL_AREA_THRESHOLD = 1000; const F32 BRIGHTNESS_DARKNESS_PIXEL_AREA_THRESHOLD = 1000;
if( src_image->mMaxVirtualSize > BRIGHTNESS_DARKNESS_PIXEL_AREA_THRESHOLD ) if( src_image->getMaxVirtualSize() > BRIGHTNESS_DARKNESS_PIXEL_AREA_THRESHOLD )
{ {
bump_image_map_t* entries_list = NULL; bump_image_map_t* entries_list = NULL;
void (*callback_func)( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) = NULL; void (*callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) = NULL;
switch( bump_code ) switch( bump_code )
{ {
@@ -923,17 +947,12 @@ LLImageGL* LLBumpImageList::getBrightnessDarknessImage(LLViewerImage* src_image,
LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1); LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1);
raw->clear(0x77, 0x77, 0x77, 0xFF); raw->clear(0x77, 0x77, 0x77, 0xFF);
//------------------------------ (*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( raw.get(), TRUE);
bump = new LLImageGL( raw, TRUE); (*entries_list)[src_image->getID()]->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
//immediately assign bump to a global smart pointer in case some local smart pointer
//accidently releases it.
(*entries_list)[src_image->getID()] = bump;
//------------------------------
bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
// Note: this may create an LLImageGL immediately // Note: this may create an LLImageGL immediately
src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()) ); src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image
// bump_total++; // bump_total++;
@@ -946,7 +965,7 @@ LLImageGL* LLBumpImageList::getBrightnessDarknessImage(LLViewerImage* src_image,
// static // static
void LLBumpImageList::onSourceBrightnessLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) void LLBumpImageList::onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata )
{ {
LLUUID* source_asset_id = (LLUUID*)userdata; LLUUID* source_asset_id = (LLUUID*)userdata;
LLBumpImageList::onSourceLoaded( success, src_vi, src, *source_asset_id, BE_BRIGHTNESS ); LLBumpImageList::onSourceLoaded( success, src_vi, src, *source_asset_id, BE_BRIGHTNESS );
@@ -957,7 +976,7 @@ void LLBumpImageList::onSourceBrightnessLoaded( BOOL success, LLViewerImage *src
} }
// static // static
void LLBumpImageList::onSourceDarknessLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) void LLBumpImageList::onSourceDarknessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata )
{ {
LLUUID* source_asset_id = (LLUUID*)userdata; LLUUID* source_asset_id = (LLUUID*)userdata;
LLBumpImageList::onSourceLoaded( success, src_vi, src, *source_asset_id, BE_DARKNESS ); LLBumpImageList::onSourceLoaded( success, src_vi, src, *source_asset_id, BE_DARKNESS );
@@ -967,14 +986,14 @@ void LLBumpImageList::onSourceDarknessLoaded( BOOL success, LLViewerImage *src_v
} }
} }
void LLBumpImageList::onSourceStandardLoaded( BOOL success, LLViewerImage* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) void LLBumpImageList::onSourceStandardLoaded( BOOL success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
{ {
if (success && LLPipeline::sRenderDeferred) if (success && LLPipeline::sRenderDeferred)
{ {
LLPointer<LLImageRaw> nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4); LLPointer<LLImageRaw> nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4);
generateNormalMapFromAlpha(src, nrm_image); generateNormalMapFromAlpha(src, nrm_image);
src_vi->setExplicitFormat(GL_RGBA, GL_RGBA); src_vi->setExplicitFormat(GL_RGBA, GL_RGBA);
src_vi->createGLTexture(0, nrm_image); src_vi->createGLTexture(src_vi->getDiscardLevel(), nrm_image);
} }
} }
@@ -1014,8 +1033,8 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr
LLVector3 right = LLVector3(norm_scale, 0, (F32) src_data[(j*resX+rX)*src_cmp+src_cmp-1]-cH); LLVector3 right = LLVector3(norm_scale, 0, (F32) src_data[(j*resX+rX)*src_cmp+src_cmp-1]-cH);
LLVector3 left = LLVector3(-norm_scale, 0, (F32) src_data[(j*resX+lX)*src_cmp+src_cmp-1]-cH); LLVector3 left = LLVector3(-norm_scale, 0, (F32) src_data[(j*resX+lX)*src_cmp+src_cmp-1]-cH);
LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH); LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH);
LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH); LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH);
LLVector3 norm = right%down + down%left + left%up + up%right; LLVector3 norm = right%down + down%left + left%up + up%right;
@@ -1034,7 +1053,7 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr
} }
// static // static
void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump_code ) void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump_code )
{ {
if( success ) if( success )
{ {
@@ -1151,9 +1170,9 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLIma
} }
//--------------------------------------------------- //---------------------------------------------------
//immediately assign bump to a global smart pointer in case some local smart pointer // immediately assign bump to a global smart pointer in case some local smart pointer
//accidently releases it. // accidentally releases it.
LLPointer<LLImageGL> bump = new LLImageGL( TRUE); LLPointer<LLViewerTexture> bump = LLViewerTextureManager::getLocalTexture( TRUE );
if (!LLPipeline::sRenderDeferred) if (!LLPipeline::sRenderDeferred)
{ {
@@ -1162,8 +1181,8 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLIma
} }
else else
{ {
LLPointer<LLImageRaw> nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4); LLPointer<LLImageRaw> nrm_image = new LLImageRaw(dst_image->getWidth(), dst_image->getHeight(), 4);
generateNormalMapFromAlpha(src, nrm_image); generateNormalMapFromAlpha(dst_image, nrm_image);
bump->setExplicitFormat(GL_RGBA, GL_RGBA); bump->setExplicitFormat(GL_RGBA, GL_RGBA);
bump->createGLTexture(0, nrm_image); bump->createGLTexture(0, nrm_image);
} }
@@ -1226,8 +1245,8 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
{ {
if (params.mTexture.notNull()) if (params.mTexture.notNull())
{ {
gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get()); gGL.getTexUnit(diffuse_channel)->bind(params.mTexture) ;
//params.mTexture->addTextureStats(params.mVSize); params.mTexture->addTextureStats(params.mVSize);
} }
else else
{ {

View File

@@ -41,6 +41,7 @@
class LLImageRaw; class LLImageRaw;
class LLSpatialGroup; class LLSpatialGroup;
class LLDrawInfo; class LLDrawInfo;
class LLViewerFetchedTexture;
class LLDrawPoolBump : public LLRenderPass class LLDrawPoolBump : public LLRenderPass
{ {
@@ -110,10 +111,12 @@ public:
LLStandardBumpmap( const std::string& label ) : mLabel(label) {} LLStandardBumpmap( const std::string& label ) : mLabel(label) {}
std::string mLabel; std::string mLabel;
LLPointer<LLViewerImage> mImage; LLPointer<LLViewerFetchedTexture> mImage;
static U32 sStandardBumpmapCount; // Number of valid values in gStandardBumpmapList[] static U32 sStandardBumpmapCount; // Number of valid values in gStandardBumpmapList[]
static void clear();
static void addstandard();
static void init(); static void init();
static void shutdown(); static void shutdown();
static void restoreGL(); static void restoreGL();
@@ -135,26 +138,26 @@ public:
void init(); void init();
void shutdown(); void shutdown();
void clear();
void destroyGL(); void destroyGL();
void restoreGL(); void restoreGL();
void updateImages(); void updateImages();
LLImageGL* getBrightnessDarknessImage(LLViewerImage* src_image, U8 bump_code); LLViewerTexture* getBrightnessDarknessImage(LLViewerFetchedTexture* src_image, U8 bump_code);
// LLImageGL* getTestImage();
void addTextureStats(U8 bump, const LLUUID& base_image_id, F32 virtual_size); void addTextureStats(U8 bump, const LLUUID& base_image_id, F32 virtual_size);
static void onSourceBrightnessLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); static void onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
static void onSourceDarknessLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); static void onSourceDarknessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
static void onSourceStandardLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); static void onSourceStandardLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
static void generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nrm_image); static void generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nrm_image);
private: private:
static void onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump ); static void onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump );
private: private:
typedef std::map<LLUUID, LLPointer<LLImageGL> > bump_image_map_t; typedef std::map<LLUUID, LLPointer<LLViewerTexture> > bump_image_map_t;
bump_image_map_t mBrightnessEntries; bump_image_map_t mBrightnessEntries;
bump_image_map_t mDarknessEntries; bump_image_map_t mDarknessEntries;
}; };

View File

@@ -41,7 +41,7 @@
#include "llface.h" #include "llface.h"
#include "llsky.h" #include "llsky.h"
#include "llviewercamera.h" #include "llviewercamera.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llviewerregion.h" #include "llviewerregion.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llvosky.h" #include "llvosky.h"

View File

@@ -49,7 +49,7 @@
#include "llviewerparceloverlay.h" #include "llviewerparceloverlay.h"
#include "llvosurfacepatch.h" #include "llvosurfacepatch.h"
#include "llviewercamera.h" #include "llviewercamera.h"
#include "llviewerimagelist.h" // To get alpha gradients #include "llviewertexturelist.h" // To get alpha gradients
#include "llworld.h" #include "llworld.h"
#include "pipeline.h" #include "pipeline.h"
#include "llviewershadermgr.h" #include "llviewershadermgr.h"
@@ -62,28 +62,32 @@ S32 LLDrawPoolTerrain::sDetailMode = 1;
F32 LLDrawPoolTerrain::sDetailScale = DETAIL_SCALE; F32 LLDrawPoolTerrain::sDetailScale = DETAIL_SCALE;
static LLGLSLShader* sShader = NULL; static LLGLSLShader* sShader = NULL;
LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerImage *texturep) : LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
LLFacePool(POOL_TERRAIN), LLFacePool(POOL_TERRAIN),
mTexturep(texturep) mTexturep(texturep)
{ {
// Hack! // Hack!
sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale"); sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale");
sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
mAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient.tga", mAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga",
TRUE, TRUE, GL_ALPHA8, GL_ALPHA, TRUE, LLViewerTexture::BOOST_UI,
LLViewerTexture::FETCHED_TEXTURE,
GL_ALPHA8, GL_ALPHA,
LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb")); LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb"));
//gGL.getTexUnit(0)->bind(mAlphaRampImagep.get()); //gGL.getTexUnit(0)->bind(mAlphaRampImagep.get());
mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
m2DAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient_2d.j2c", m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient_2d.j2c",
TRUE, TRUE, GL_ALPHA8, GL_ALPHA, TRUE, LLViewerTexture::BOOST_UI,
LLViewerTexture::FETCHED_TEXTURE,
GL_ALPHA8, GL_ALPHA,
LLUUID("38b86f85-2575-52a9-a531-23108d8da837")); LLUUID("38b86f85-2575-52a9-a531-23108d8da837"));
//gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); //gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
mTexturep->setBoostLevel(LLViewerImageBoostLevel::BOOST_TERRAIN); mTexturep->setBoostLevel(LLViewerTexture::BOOST_TERRAIN);
//gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
} }
@@ -170,7 +174,7 @@ void LLDrawPoolTerrain::render(S32 pass)
LLVLComposition *compp = regionp->getComposition(); LLVLComposition *compp = regionp->getComposition();
for (S32 i = 0; i < 4; i++) for (S32 i = 0; i < 4; i++)
{ {
compp->mDetailTextures[i]->setBoostLevel(LLViewerImageBoostLevel::BOOST_TERRAIN); compp->mDetailTextures[i]->setBoostLevel(LLViewerTexture::BOOST_TERRAIN);
compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
} }
@@ -290,10 +294,10 @@ void LLDrawPoolTerrain::renderFullShader()
// Hack! Get the region that this draw pool is rendering from! // Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition(); LLVLComposition *compp = regionp->getComposition();
LLViewerImage *detail_texture0p = compp->mDetailTextures[0]; LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
LLViewerImage *detail_texture1p = compp->mDetailTextures[1]; LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
LLViewerImage *detail_texture2p = compp->mDetailTextures[2]; LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
LLViewerImage *detail_texture3p = compp->mDetailTextures[3]; LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal(); LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale; F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
@@ -364,7 +368,7 @@ void LLDrawPoolTerrain::renderFullShader()
// Alpha Ramp // Alpha Ramp
// //
S32 alpha_ramp = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP); 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 // GL_BLEND disabled by default
drawLoop(); drawLoop();
@@ -430,10 +434,10 @@ void LLDrawPoolTerrain::renderFull4TU()
// Hack! Get the region that this draw pool is rendering from! // Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition(); LLVLComposition *compp = regionp->getComposition();
LLViewerImage *detail_texture0p = compp->mDetailTextures[0]; LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
LLViewerImage *detail_texture1p = compp->mDetailTextures[1]; LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
LLViewerImage *detail_texture2p = compp->mDetailTextures[2]; LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
LLViewerImage *detail_texture3p = compp->mDetailTextures[3]; LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal(); LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale; F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
@@ -528,7 +532,7 @@ void LLDrawPoolTerrain::renderFull4TU()
// //
// Stage 1: Generate alpha ramp for detail2/detail3 transition // 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)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->activate(); gGL.getTexUnit(1)->activate();
@@ -560,7 +564,7 @@ void LLDrawPoolTerrain::renderFull4TU()
// //
// Stage 3: Generate alpha ramp for detail1/detail2 transition // 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)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(3)->activate(); gGL.getTexUnit(3)->activate();
@@ -631,10 +635,10 @@ void LLDrawPoolTerrain::renderFull2TU()
// Hack! Get the region that this draw pool is rendering from! // Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition(); LLVLComposition *compp = regionp->getComposition();
LLViewerImage *detail_texture0p = compp->mDetailTextures[0]; LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
LLViewerImage *detail_texture1p = compp->mDetailTextures[1]; LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
LLViewerImage *detail_texture2p = compp->mDetailTextures[2]; LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
LLViewerImage *detail_texture3p = compp->mDetailTextures[3]; LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal(); LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale; F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
@@ -672,7 +676,7 @@ void LLDrawPoolTerrain::renderFull2TU()
// //
// Stage 0: Generate alpha ramp for detail0/detail1 transition // 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_S);
glDisable(GL_TEXTURE_GEN_T); glDisable(GL_TEXTURE_GEN_T);
@@ -710,7 +714,7 @@ void LLDrawPoolTerrain::renderFull2TU()
// //
// Stage 0: Generate alpha ramp for detail1/detail2 transition // Stage 0: Generate alpha ramp for detail1/detail2 transition
// //
gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
// Set the texture matrix // Set the texture matrix
glMatrixMode(GL_TEXTURE); glMatrixMode(GL_TEXTURE);
@@ -750,7 +754,7 @@ void LLDrawPoolTerrain::renderFull2TU()
// Stage 0: Generate alpha ramp for detail2/detail3 transition // Stage 0: Generate alpha ramp for detail2/detail3 transition
// //
gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
// Set the texture matrix // Set the texture matrix
glMatrixMode(GL_TEXTURE); glMatrixMode(GL_TEXTURE);
glLoadIdentity(); glLoadIdentity();
@@ -823,7 +827,7 @@ void LLDrawPoolTerrain::renderSimple()
gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); 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(); LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent();
F32 tscale = 1.f/256.f; F32 tscale = 1.f/256.f;
@@ -873,7 +877,7 @@ void LLDrawPoolTerrain::renderOwnership()
LLSurface *surfacep = surface_patchp->getSurface(); LLSurface *surfacep = surface_patchp->getSurface();
LLViewerRegion *regionp = surfacep->getRegion(); LLViewerRegion *regionp = surfacep->getRegion();
LLViewerParcelOverlay *overlayp = regionp->getParcelOverlay(); LLViewerParcelOverlay *overlayp = regionp->getParcelOverlay();
LLImageGL *texturep = overlayp->getTexture(); LLViewerTexture *texturep = overlayp->getTexture();
gGL.getTexUnit(0)->bind(texturep); gGL.getTexUnit(0)->bind(texturep);
@@ -921,9 +925,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(); for (std::vector<LLFace*>::iterator iter = mReferences.begin();
iter != mReferences.end(); iter++) iter != mReferences.end(); iter++)
@@ -934,12 +939,12 @@ void LLDrawPoolTerrain::dirtyTextures(const std::set<LLViewerImage*>& textures)
} }
} }
LLViewerImage *LLDrawPoolTerrain::getTexture() LLViewerTexture *LLDrawPoolTerrain::getTexture()
{ {
return mTexturep; return mTexturep;
} }
LLViewerImage *LLDrawPoolTerrain::getDebugTexture() LLViewerTexture *LLDrawPoolTerrain::getDebugTexture()
{ {
return mTexturep; return mTexturep;
} }

View File

@@ -35,9 +35,11 @@
#include "lldrawpool.h" #include "lldrawpool.h"
class LLViewerFetchedTexture;
class LLDrawPoolTerrain : public LLFacePool class LLDrawPoolTerrain : public LLFacePool
{ {
LLPointer<LLViewerImage> mTexturep; LLPointer<LLViewerTexture> mTexturep;
public: public:
enum enum
{ {
@@ -53,7 +55,7 @@ public:
virtual U32 getVertexDataMask(); virtual U32 getVertexDataMask();
static S32 getDetailMode(); static S32 getDetailMode();
LLDrawPoolTerrain(LLViewerImage *texturep); LLDrawPoolTerrain(LLViewerTexture *texturep);
virtual ~LLDrawPoolTerrain(); virtual ~LLDrawPoolTerrain();
/*virtual*/ LLDrawPool *instancePool(); /*virtual*/ LLDrawPool *instancePool();
@@ -73,14 +75,14 @@ public:
/*virtual*/ void beginRenderPass( S32 pass ); /*virtual*/ void beginRenderPass( S32 pass );
/*virtual*/ void endRenderPass( S32 pass ); /*virtual*/ void endRenderPass( S32 pass );
/*virtual*/ void renderForSelect(); /*virtual*/ void renderForSelect();
/*virtual*/ void dirtyTextures(const std::set<LLViewerImage*>& textures); /*virtual*/ void dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures);
/*virtual*/ LLViewerImage *getTexture(); /*virtual*/ LLViewerTexture *getTexture();
/*virtual*/ LLViewerImage *getDebugTexture(); /*virtual*/ LLViewerTexture *getDebugTexture();
/*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
LLPointer<LLViewerImage> mAlphaRampImagep; LLPointer<LLViewerTexture> mAlphaRampImagep;
LLPointer<LLViewerImage> m2DAlphaRampImagep; LLPointer<LLViewerTexture> m2DAlphaRampImagep;
LLPointer<LLViewerImage> mAlphaNoiseImagep; LLPointer<LLViewerTexture> mAlphaNoiseImagep;
static S32 sDetailMode; static S32 sDetailMode;
static F32 sDetailScale; // meters per texture static F32 sDetailScale; // meters per texture

View File

@@ -48,7 +48,7 @@
S32 LLDrawPoolTree::sDiffTex = 0; S32 LLDrawPoolTree::sDiffTex = 0;
static LLGLSLShader* shader = NULL; static LLGLSLShader* shader = NULL;
LLDrawPoolTree::LLDrawPoolTree(LLViewerImage *texturep) : LLDrawPoolTree::LLDrawPoolTree(LLViewerTexture *texturep) :
LLFacePool(POOL_TREE), LLFacePool(POOL_TREE),
mTexturep(texturep) mTexturep(texturep)
{ {
@@ -380,12 +380,12 @@ BOOL LLDrawPoolTree::verify() const
return TRUE; return TRUE;
} }
LLViewerImage *LLDrawPoolTree::getTexture() LLViewerTexture *LLDrawPoolTree::getTexture()
{ {
return mTexturep; return mTexturep;
} }
LLViewerImage *LLDrawPoolTree::getDebugTexture() LLViewerTexture *LLDrawPoolTree::getDebugTexture()
{ {
return mTexturep; return mTexturep;
} }

View File

@@ -37,7 +37,7 @@
class LLDrawPoolTree : public LLFacePool class LLDrawPoolTree : public LLFacePool
{ {
LLPointer<LLViewerImage> mTexturep; LLPointer<LLViewerTexture> mTexturep;
public: public:
enum enum
{ {
@@ -48,7 +48,7 @@ public:
virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
LLDrawPoolTree(LLViewerImage *texturep); LLDrawPoolTree(LLViewerTexture *texturep);
/*virtual*/ LLDrawPool *instancePool(); /*virtual*/ LLDrawPool *instancePool();
@@ -70,8 +70,8 @@ public:
/*virtual*/ S32 getNumPasses() { return 1; } /*virtual*/ S32 getNumPasses() { return 1; }
/*virtual*/ void renderForSelect(); /*virtual*/ void renderForSelect();
/*virtual*/ BOOL verify() const; /*virtual*/ BOOL verify() const;
/*virtual*/ LLViewerImage *getTexture(); /*virtual*/ LLViewerTexture *getTexture();
/*virtual*/ LLViewerImage *getDebugTexture(); /*virtual*/ LLViewerTexture *getDebugTexture();
/*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
static S32 sDiffTex; static S32 sDiffTex;

View File

@@ -46,7 +46,7 @@
#include "llface.h" #include "llface.h"
#include "llsky.h" #include "llsky.h"
#include "llviewercamera.h" // to get OGL_TO_CFR_ROTATION #include "llviewercamera.h" // to get OGL_TO_CFR_ROTATION
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llviewerregion.h" #include "llviewerregion.h"
#include "llvosky.h" #include "llvosky.h"
#include "llvowater.h" #include "llvowater.h"
@@ -70,18 +70,20 @@ LLVector3 LLDrawPoolWater::sLightDir;
LLDrawPoolWater::LLDrawPoolWater() : LLDrawPoolWater::LLDrawPoolWater() :
LLFacePool(POOL_WATER) LLFacePool(POOL_WATER)
{ {
mHBTex[0] = gImageList.getImage(gSunTextureID, TRUE, TRUE); mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, TRUE, LLViewerTexture::BOOST_UI);
gGL.getTexUnit(0)->bind(mHBTex[0].get()); gGL.getTexUnit(0)->bind(mHBTex[0]) ;
mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP); mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP);
mHBTex[1] = gImageList.getImage(gMoonTextureID, TRUE, TRUE); mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLViewerTexture::BOOST_UI);
gGL.getTexUnit(0)->bind(mHBTex[1].get()); gGL.getTexUnit(0)->bind(mHBTex[1]);
mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP); mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
mWaterImagep = gImageList.getImage(WATER_TEST);
mWaterImagep = LLViewerTextureManager::getFetchedTexture(WATER_TEST);
llassert(mWaterImagep);
mWaterImagep->setNoDelete() ; mWaterImagep->setNoDelete() ;
mWaterNormp = gImageList.getImage(DEFAULT_WATER_NORMAL); mWaterNormp = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL);
mWaterNormp->setNoDelete() ; mWaterNormp->setNoDelete();
restoreGL(); restoreGL();
} }
@@ -198,7 +200,7 @@ void LLDrawPoolWater::render(S32 pass)
mWaterImagep->addTextureStats(1024.f*1024.f); mWaterImagep->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(1)->activate(); gGL.getTexUnit(1)->activate();
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->bind(mWaterImagep.get()); gGL.getTexUnit(1)->bind(mWaterImagep) ;
LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis();
F32 up_dot = camera_up * LLVector3::z_axis; F32 up_dot = camera_up * LLVector3::z_axis;
@@ -343,7 +345,7 @@ void LLDrawPoolWater::renderReflection(LLFace* face)
LLGLSNoFog noFog; LLGLSNoFog noFog;
gGL.getTexUnit(0)->bind(mHBTex[dr].get()); gGL.getTexUnit(0)->bind(mHBTex[dr]);
LLOverrideFaceColor override(this, face->getFaceColor().mV); LLOverrideFaceColor override(this, face->getFaceColor().mV);
face->renderIndexed(); face->renderIndexed();
@@ -445,11 +447,11 @@ void LLDrawPoolWater::shade()
// change mWaterNormp if needed // change mWaterNormp if needed
if (mWaterNormp->getID() != param_mgr->getNormalMapID()) if (mWaterNormp->getID() != param_mgr->getNormalMapID())
{ {
mWaterNormp = gImageList.getImage(param_mgr->getNormalMapID()); mWaterNormp = LLViewerTextureManager::getFetchedTexture(param_mgr->getNormalMapID());
} }
mWaterNormp->addTextureStats(1024.f*1024.f); mWaterNormp->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(bumpTex)->bind(mWaterNormp.get()); gGL.getTexUnit(bumpTex)->bind(mWaterNormp) ;
if (gSavedSettings.getBOOL("RenderWaterMipNormal")) if (gSavedSettings.getBOOL("RenderWaterMipNormal"))
{ {
mWaterNormp->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); mWaterNormp->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
@@ -606,7 +608,7 @@ void LLDrawPoolWater::renderForSelect()
void LLDrawPoolWater::renderFaceSelected(LLFace *facep, void LLDrawPoolWater::renderFaceSelected(LLFace *facep,
LLImageGL *image, LLViewerTexture *image,
const LLColor4 &color, const LLColor4 &color,
const S32 index_offset, const S32 index_count) const S32 index_offset, const S32 index_count)
{ {
@@ -615,9 +617,9 @@ void LLDrawPoolWater::renderFaceSelected(LLFace *facep,
} }
LLViewerImage *LLDrawPoolWater::getDebugTexture() LLViewerTexture *LLDrawPoolWater::getDebugTexture()
{ {
return LLViewerImage::sSmokeImagep; return LLViewerFetchedTexture::sSmokeImagep;
} }
LLColor3 LLDrawPoolWater::getDebugColor() const LLColor3 LLDrawPoolWater::getDebugColor() const

View File

@@ -43,11 +43,10 @@ class LLWaterSurface;
class LLDrawPoolWater: public LLFacePool class LLDrawPoolWater: public LLFacePool
{ {
protected: protected:
LLPointer<LLViewerImage> mHBTex[2]; LLPointer<LLViewerTexture> mHBTex[2];
LLPointer<LLViewerImage> mWaterImagep; LLPointer<LLViewerTexture> mWaterImagep;
LLPointer<LLViewerImage> mWaterNormp; LLPointer<LLViewerTexture> mWaterNormp;
const LLWaterSurface *mWaterSurface;
public: public:
static BOOL sSkipScreenCopy; static BOOL sSkipScreenCopy;
static BOOL sNeedsReflectionUpdate; static BOOL sNeedsReflectionUpdate;
@@ -80,12 +79,12 @@ public:
/*virtual*/ S32 getNumPasses(); /*virtual*/ S32 getNumPasses();
/*virtual*/ void render(S32 pass = 0); /*virtual*/ void render(S32 pass = 0);
/*virtual*/ void renderFaceSelected(LLFace *facep, LLImageGL *image, const LLColor4 &color, /*virtual*/ void renderFaceSelected(LLFace *facep, LLViewerTexture *image, const LLColor4 &color,
const S32 index_offset = 0, const S32 index_count = 0); const S32 index_offset = 0, const S32 index_count = 0);
/*virtual*/ void prerender(); /*virtual*/ void prerender();
/*virtual*/ void renderForSelect(); /*virtual*/ void renderForSelect();
/*virtual*/ LLViewerImage *getDebugTexture(); /*virtual*/ LLViewerTexture *getDebugTexture();
/*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
void renderReflection(LLFace* face); void renderReflection(LLFace* face);

View File

@@ -47,7 +47,7 @@
#include "llface.h" #include "llface.h"
#include "llrender.h" #include "llrender.h"
LLPointer<LLImageGL> LLDrawPoolWLSky::sCloudNoiseTexture = NULL; LLPointer<LLViewerTexture> LLDrawPoolWLSky::sCloudNoiseTexture = NULL;
LLPointer<LLImageRaw> LLDrawPoolWLSky::sCloudNoiseRawImage = NULL; LLPointer<LLImageRaw> LLDrawPoolWLSky::sCloudNoiseRawImage = NULL;
@@ -71,7 +71,7 @@ LLDrawPoolWLSky::LLDrawPoolWLSky(void) :
cloudNoiseFile->decode(sCloudNoiseRawImage, 0.0f); cloudNoiseFile->decode(sCloudNoiseRawImage, 0.0f);
LLImageGL::create(sCloudNoiseTexture, sCloudNoiseRawImage, TRUE); sCloudNoiseTexture = LLViewerTextureManager::getLocalTexture(sCloudNoiseRawImage.get(), TRUE);
LLWLParamManager::instance()->propagateParameters(); LLWLParamManager::instance()->propagateParameters();
} }
@@ -83,7 +83,7 @@ LLDrawPoolWLSky::~LLDrawPoolWLSky()
sCloudNoiseRawImage = NULL; sCloudNoiseRawImage = NULL;
} }
LLViewerImage *LLDrawPoolWLSky::getDebugTexture() LLViewerTexture *LLDrawPoolWLSky::getDebugTexture()
{ {
return NULL; return NULL;
} }
@@ -233,7 +233,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
LLFace * face = gSky.mVOSkyp->mFace[LLVOSky::FACE_SUN]; LLFace * face = gSky.mVOSkyp->mFace[LLVOSky::FACE_SUN];
if (gSky.mVOSkyp->getSun().getDraw() && face->getGeomCount()) if (gSky.mVOSkyp->getSun().getDraw() && face->getGeomCount())
{ {
LLImageGL * tex = face->getTexture(); LLViewerTexture * tex = face->getTexture();
gGL.getTexUnit(0)->bind(tex); gGL.getTexUnit(0)->bind(tex);
LLColor4 color(gSky.mVOSkyp->getSun().getInterpColor()); LLColor4 color(gSky.mVOSkyp->getSun().getInterpColor());
LLFacePool::LLOverrideFaceColor color_override(this, color); LLFacePool::LLOverrideFaceColor color_override(this, color);
@@ -248,8 +248,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
// *NOTE: even though we already bound this texture above for the // *NOTE: even though we already bound this texture above for the
// stars register combiners, we bind again here for defensive reasons, // stars register combiners, we bind again here for defensive reasons,
// since LLImageGL::bind detects that it's a noop, and optimizes it out. // since LLImageGL::bind detects that it's a noop, and optimizes it out.
LLImageGL * tex = face->getTexture(); gGL.getTexUnit(0)->bind(face->getTexture());
gGL.getTexUnit(0)->bind(tex);
LLColor4 color(gSky.mVOSkyp->getMoon().getInterpColor()); LLColor4 color(gSky.mVOSkyp->getMoon().getInterpColor());
F32 a = gSky.mVOSkyp->getMoon().getDirection().mV[2]; F32 a = gSky.mVOSkyp->getMoon().getDirection().mV[2];
if (a > 0.f) if (a > 0.f)
@@ -289,14 +288,12 @@ void LLDrawPoolWLSky::render(S32 pass)
// *NOTE: have to bind a texture here since register combiners blending in // *NOTE: have to bind a texture here since register combiners blending in
// renderStars() requires something to be bound and we might as well only // renderStars() requires something to be bound and we might as well only
// bind the moon's texture once. // bind the moon's texture once.
LLImageGL * tex = gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture(); gGL.getTexUnit(0)->bind(gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture());
gGL.getTexUnit(0)->bind(tex);
renderHeavenlyBodies(); renderHeavenlyBodies();
renderStars();
renderStars();
glPopMatrix(); glPopMatrix();
@@ -316,7 +313,7 @@ LLDrawPoolWLSky *LLDrawPoolWLSky::instancePool()
return new LLDrawPoolWLSky(); return new LLDrawPoolWLSky();
} }
LLViewerImage* LLDrawPoolWLSky::getTexture() LLViewerTexture* LLDrawPoolWLSky::getTexture()
{ {
return NULL; return NULL;
} }
@@ -334,5 +331,5 @@ void LLDrawPoolWLSky::cleanupGL()
//static //static
void LLDrawPoolWLSky::restoreGL() void LLDrawPoolWLSky::restoreGL()
{ {
LLImageGL::create(sCloudNoiseTexture, sCloudNoiseRawImage, TRUE); sCloudNoiseTexture = LLViewerTextureManager::getLocalTexture(sCloudNoiseRawImage.get(), TRUE);
} }

View File

@@ -55,7 +55,7 @@ public:
/*virtual*/ void endPostDeferredPass(S32 pass) { endRenderPass(pass); } /*virtual*/ void endPostDeferredPass(S32 pass) { endRenderPass(pass); }
/*virtual*/ void renderPostDeferred(S32 pass) { render(pass); } /*virtual*/ void renderPostDeferred(S32 pass) { render(pass); }
/*virtual*/ LLViewerImage *getDebugTexture(); /*virtual*/ LLViewerTexture *getDebugTexture();
/*virtual*/ void beginRenderPass( S32 pass ); /*virtual*/ void beginRenderPass( S32 pass );
/*virtual*/ void endRenderPass( S32 pass ); /*virtual*/ void endRenderPass( S32 pass );
/*virtual*/ S32 getNumPasses() { return 1; } /*virtual*/ S32 getNumPasses() { return 1; }
@@ -65,11 +65,11 @@ public:
/*virtual*/ BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct! /*virtual*/ BOOL verify() const { return TRUE; } // Verify that all data in the draw pool is correct!
/*virtual*/ S32 getVertexShaderLevel() const { return mVertexShaderLevel; } /*virtual*/ S32 getVertexShaderLevel() const { return mVertexShaderLevel; }
//static LLDrawPool* createPool(const U32 type, LLViewerImage *tex0 = NULL); //static LLDrawPool* createPool(const U32 type, LLViewerTexture *tex0 = NULL);
// Create an empty new instance of the pool. // Create an empty new instance of the pool.
/*virtual*/ LLDrawPoolWLSky *instancePool(); ///< covariant override /*virtual*/ LLDrawPoolWLSky *instancePool(); ///< covariant override
/*virtual*/ LLViewerImage* getTexture(); /*virtual*/ LLViewerTexture* getTexture();
/*virtual*/ BOOL isFacePool() { return FALSE; } /*virtual*/ BOOL isFacePool() { return FALSE; }
/*virtual*/ void resetDrawOrders(); /*virtual*/ void resetDrawOrders();
@@ -83,7 +83,7 @@ private:
void renderHeavenlyBodies(); void renderHeavenlyBodies();
private: private:
static LLPointer<LLImageGL> sCloudNoiseTexture; static LLPointer<LLViewerTexture> sCloudNoiseTexture;
static LLPointer<LLImageRaw> sCloudNoiseRawImage; static LLPointer<LLImageRaw> sCloudNoiseRawImage;
}; };

View File

@@ -37,24 +37,20 @@
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llviewercamera.h" #include "llviewercamera.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llviewerimage.h" #include "llviewertexture.h"
#include "llvertexbuffer.h" #include "llvertexbuffer.h"
#include "llviewerdisplay.h" #include "llviewerdisplay.h"
#include "llrender.h" #include "llrender.h"
// static // static
LLDynamicTexture::instance_list_t LLDynamicTexture::sInstances[ LLDynamicTexture::ORDER_COUNT ]; LLViewerDynamicTexture::instance_list_t LLViewerDynamicTexture::sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
S32 LLDynamicTexture::sNumRenders = 0; S32 LLViewerDynamicTexture::sNumRenders = 0;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// LLDynamicTexture() // LLViewerDynamicTexture()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLDynamicTexture::LLDynamicTexture(S32 width, S32 height, S32 components, EOrder order, BOOL clamp) : LLViewerDynamicTexture::LLViewerDynamicTexture(S32 width, S32 height, S32 components, EOrder order, BOOL clamp) :
mWidth(width), LLViewerTexture(width, height, components, FALSE),
mHeight(height),
mComponents(components),
mTexture(NULL),
mLastBindTime(0),
mClamp(clamp) mClamp(clamp)
{ {
llassert((1 <= components) && (components <= 4)); llassert((1 <= components) && (components <= 4));
@@ -62,66 +58,58 @@ LLDynamicTexture::LLDynamicTexture(S32 width, S32 height, S32 components, EOrder
generateGLTexture(); generateGLTexture();
llassert( 0 <= order && order < ORDER_COUNT ); llassert( 0 <= order && order < ORDER_COUNT );
LLDynamicTexture::sInstances[ order ].insert(this); LLViewerDynamicTexture::sInstances[ order ].insert(this);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// LLDynamicTexture() // LLViewerDynamicTexture()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLDynamicTexture::~LLDynamicTexture() LLViewerDynamicTexture::~LLViewerDynamicTexture()
{ {
releaseGLTexture();
for( S32 order = 0; order < ORDER_COUNT; order++ ) for( S32 order = 0; order < ORDER_COUNT; order++ )
{ {
LLDynamicTexture::sInstances[order].erase(this); // will fail in all but one case. LLViewerDynamicTexture::sInstances[order].erase(this); // will fail in all but one case.
} }
} }
//----------------------------------------------------------------------------- //virtual
// releaseGLTexture() S8 LLViewerDynamicTexture::getType() const
//-----------------------------------------------------------------------------
void LLDynamicTexture::releaseGLTexture()
{ {
if (mTexture.notNull()) return LLViewerTexture::DYNAMIC_TEXTURE ;
{
// llinfos << "RELEASING " << (mWidth*mHeight*mComponents)/1024 << "K" << llendl;
mTexture = NULL;
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// generateGLTexture() // generateGLTexture()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLDynamicTexture::generateGLTexture() void LLViewerDynamicTexture::generateGLTexture()
{ {
LLViewerTexture::generateGLTexture() ;
generateGLTexture(-1, 0, 0, FALSE); generateGLTexture(-1, 0, 0, FALSE);
} }
void LLDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes, const LLColor4U *fill_color/* = NULL*/) void LLViewerDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes, const LLColor4U *fill_color/*=NULL*/)
{ {
if (mComponents < 1 || mComponents > 4) if (mComponents < 1 || mComponents > 4)
{ {
llerrs << "Bad number of components in dynamic texture: " << mComponents << llendl; llerrs << "Bad number of components in dynamic texture: " << mComponents << llendl;
} }
releaseGLTexture();
LLPointer<LLImageRaw> raw_image = new LLImageRaw(mWidth, mHeight, mComponents); LLPointer<LLImageRaw> raw_image = new LLImageRaw(mFullWidth, mFullHeight, mComponents);
if(fill_color)
raw_image->fill(*fill_color);
mTexture = new LLViewerImage(mWidth, mHeight, mComponents, FALSE);
if (internal_format >= 0) if (internal_format >= 0)
{ {
mTexture->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes); setExplicitFormat(internal_format, primary_format, type_format, swap_bytes);
} }
// llinfos << "ALLOCATING " << (mWidth*mHeight*mComponents)/1024 << "K" << llendl; if(fill_color)
mTexture->createGLTexture(0, raw_image, 0, TRUE, LLViewerImageBoostLevel::DYNAMIC_TEX); raw_image->fill(*fill_color);
mTexture->setAddressMode((mClamp) ? LLTexUnit::TAM_CLAMP : LLTexUnit::TAM_WRAP); createGLTexture(0, raw_image, 0, TRUE, LLViewerTexture::DYNAMIC_TEX);
mTexture->setGLTextureCreated(false); setAddressMode((mClamp) ? LLTexUnit::TAM_CLAMP : LLTexUnit::TAM_WRAP);
mGLTexturep->setGLTextureCreated(false);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// render() // render()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BOOL LLDynamicTexture::render() BOOL LLViewerDynamicTexture::render()
{ {
return FALSE; return FALSE;
} }
@@ -129,13 +117,13 @@ BOOL LLDynamicTexture::render()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// preRender() // preRender()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLDynamicTexture::preRender(BOOL clear_depth) void LLViewerDynamicTexture::preRender(BOOL clear_depth)
{ {
{ {
// force rendering to on-screen portion of frame buffer // force rendering to on-screen portion of frame buffer
LLCoordScreen window_pos; LLCoordScreen window_pos;
gViewerWindow->getWindow()->getPosition( &window_pos ); gViewerWindow->getWindow()->getPosition( &window_pos );
mOrigin.set(0, gViewerWindow->getWindowDisplayHeight() - mHeight); // top left corner mOrigin.set(0, gViewerWindow->getWindowDisplayHeight() - mFullHeight); // top left corner
if (window_pos.mX < 0) if (window_pos.mX < 0)
{ {
@@ -150,13 +138,14 @@ void LLDynamicTexture::preRender(BOOL clear_depth)
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
} }
// Set up camera // Set up camera
mCamera.setOrigin(*LLViewerCamera::getInstance()); LLViewerCamera* camera = LLViewerCamera::getInstance();
mCamera.setAxes(*LLViewerCamera::getInstance()); mCamera.setOrigin(*camera);
mCamera.setAspect(LLViewerCamera::getInstance()->getAspect()); mCamera.setAxes(*camera);
mCamera.setView(LLViewerCamera::getInstance()->getView()); mCamera.setAspect(camera->getAspect());
mCamera.setNear(LLViewerCamera::getInstance()->getNear()); mCamera.setView(camera->getView());
mCamera.setNear(camera->getNear());
glViewport(mOrigin.mX, mOrigin.mY, mWidth, mHeight); glViewport(mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight);
if (clear_depth) if (clear_depth)
{ {
glClear(GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT);
@@ -166,12 +155,25 @@ void LLDynamicTexture::preRender(BOOL clear_depth)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// postRender() // postRender()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLDynamicTexture::postRender(BOOL success) void LLViewerDynamicTexture::postRender(BOOL success)
{ {
{ {
if (success) if (success)
{ {
success = mTexture->setSubImageFromFrameBuffer(0, 0, mOrigin.mX, mOrigin.mY, mWidth, mHeight); if(mGLTexturep.isNull())
{
generateGLTexture() ;
}
else if(!mGLTexturep->getHasGLTexture())
{
generateGLTexture() ;
}
else if(mGLTexturep->getDiscardLevel() != 0)//do not know how it happens, but regenerate one if it does.
{
generateGLTexture() ;
}
success = mGLTexturep->setSubImageFromFrameBuffer(0, 0, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight);
} }
} }
@@ -179,11 +181,12 @@ void LLDynamicTexture::postRender(BOOL success)
gViewerWindow->setupViewport(); gViewerWindow->setupViewport();
// restore camera // restore camera
LLViewerCamera::getInstance()->setOrigin(mCamera); LLViewerCamera* camera = LLViewerCamera::getInstance();
LLViewerCamera::getInstance()->setAxes(mCamera); camera->setOrigin(mCamera);
LLViewerCamera::getInstance()->setAspect(mCamera.getAspect()); camera->setAxes(mCamera);
LLViewerCamera::getInstance()->setView(mCamera.getView()); camera->setAspect(mCamera.getAspect());
LLViewerCamera::getInstance()->setNear(mCamera.getNear()); camera->setView(mCamera.getView());
camera->setNear(mCamera.getNear());
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -191,7 +194,7 @@ void LLDynamicTexture::postRender(BOOL success)
// updateDynamicTextures() // updateDynamicTextures()
// Calls update on each dynamic texture. Calls each group in order: "first," then "middle," then "last." // Calls update on each dynamic texture. Calls each group in order: "first," then "middle," then "last."
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BOOL LLDynamicTexture::updateAllInstances() BOOL LLViewerDynamicTexture::updateAllInstances()
{ {
sNumRenders = 0; sNumRenders = 0;
if (gGLManager.mIsDisabled) if (gGLManager.mIsDisabled)
@@ -203,16 +206,15 @@ BOOL LLDynamicTexture::updateAllInstances()
BOOL ret = FALSE ; BOOL ret = FALSE ;
for( S32 order = 0; order < ORDER_COUNT; order++ ) for( S32 order = 0; order < ORDER_COUNT; order++ )
{ {
for (instance_list_t::iterator iter = LLDynamicTexture::sInstances[order].begin(); for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin();
iter != LLDynamicTexture::sInstances[order].end(); ++iter) iter != LLViewerDynamicTexture::sInstances[order].end(); ++iter)
{ {
LLDynamicTexture *dynamicTexture = *iter; LLViewerDynamicTexture *dynamicTexture = *iter;
if (dynamicTexture->needsRender()) if (dynamicTexture->needsRender())
{ {
glClear(GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT);
gDepthDirty = TRUE; gDepthDirty = TRUE;
gGL.color4f(1,1,1,1); gGL.color4f(1,1,1,1);
dynamicTexture->preRender(); // Must be called outside of startRender() dynamicTexture->preRender(); // Must be called outside of startRender()
result = FALSE; result = FALSE;
@@ -233,30 +235,18 @@ BOOL LLDynamicTexture::updateAllInstances()
return ret; return ret;
} }
//virtual
void LLDynamicTexture::restoreGLTexture()
{
generateGLTexture() ;
}
//virtual
void LLDynamicTexture::destroyGLTexture()
{
releaseGLTexture() ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// static // static
// destroyGL() // destroyGL()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLDynamicTexture::destroyGL() void LLViewerDynamicTexture::destroyGL()
{ {
for( S32 order = 0; order < ORDER_COUNT; order++ ) for( S32 order = 0; order < ORDER_COUNT; order++ )
{ {
for (instance_list_t::iterator iter = LLDynamicTexture::sInstances[order].begin(); for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin();
iter != LLDynamicTexture::sInstances[order].end(); ++iter) iter != LLViewerDynamicTexture::sInstances[order].end(); ++iter)
{ {
LLDynamicTexture *dynamicTexture = *iter; LLViewerDynamicTexture *dynamicTexture = *iter;
dynamicTexture->destroyGLTexture() ; dynamicTexture->destroyGLTexture() ;
} }
} }
@@ -266,7 +256,7 @@ void LLDynamicTexture::destroyGL()
// static // static
// restoreGL() // restoreGL()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLDynamicTexture::restoreGL() void LLViewerDynamicTexture::restoreGL()
{ {
if (gGLManager.mIsDisabled) if (gGLManager.mIsDisabled)
{ {
@@ -275,10 +265,10 @@ void LLDynamicTexture::restoreGL()
for( S32 order = 0; order < ORDER_COUNT; order++ ) for( S32 order = 0; order < ORDER_COUNT; order++ )
{ {
for (instance_list_t::iterator iter = LLDynamicTexture::sInstances[order].begin(); for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin();
iter != LLDynamicTexture::sInstances[order].end(); ++iter) iter != LLViewerDynamicTexture::sInstances[order].end(); ++iter)
{ {
LLDynamicTexture *dynamicTexture = *iter; LLViewerDynamicTexture *dynamicTexture = *iter;
dynamicTexture->restoreGLTexture() ; dynamicTexture->restoreGLTexture() ;
} }
} }

View File

@@ -35,59 +35,64 @@
#include "llgl.h" #include "llgl.h"
#include "llcoord.h" #include "llcoord.h"
#include "llimagegl.h" #include "llviewertexture.h"
class LLDynamicTexture class LLViewerDynamicTexture : public LLViewerTexture
{ {
public:
enum
{
LL_VIEWER_DYNAMIC_TEXTURE = LLViewerTexture::DYNAMIC_TEXTURE,
LL_TEX_LAYER_SET_BUFFER = LLViewerTexture::INVALID_TEXTURE_TYPE + 1,
LL_VISUAL_PARAM_HINT,
LL_VISUAL_PARAM_RESET,
LL_PREVIEW_ANIMATION,
LL_IMAGE_PREVIEW_SCULPTED,
LL_IMAGE_PREVIEW_AVATAR,
INVALID_DYNAMIC_TEXTURE
};
protected:
/*virtual*/ ~LLViewerDynamicTexture();
public: public:
enum EOrder { ORDER_FIRST = 0, ORDER_MIDDLE = 1, ORDER_LAST = 2, ORDER_RESET = 3, ORDER_COUNT = 4 }; enum EOrder { ORDER_FIRST = 0, ORDER_MIDDLE = 1, ORDER_LAST = 2, ORDER_RESET = 3, ORDER_COUNT = 4 };
LLDynamicTexture(S32 width, LLViewerDynamicTexture(S32 width,
S32 height, S32 height,
S32 components, // = 4, S32 components, // = 4,
EOrder order, // = ORDER_MIDDLE, EOrder order, // = ORDER_MIDDLE,
BOOL clamp); BOOL clamp);
virtual ~LLDynamicTexture();
/*virtual*/ S8 getType() const ;
S32 getOriginX() { return mOrigin.mX; } S32 getOriginX() { return mOrigin.mX; }
S32 getOriginY() { return mOrigin.mY; } S32 getOriginY() { return mOrigin.mY; }
S32 getWidth() { return mWidth; }
S32 getHeight() { return mHeight; } S32 getSize() { return mFullWidth * mFullHeight * mComponents; }
S32 getComponents() { return mComponents; }
S32 getSize() { return mWidth * mHeight * mComponents; }
virtual BOOL needsRender() { return TRUE; } virtual BOOL needsRender() { return TRUE; }
virtual void preRender(BOOL clear_depth = TRUE); virtual void preRender(BOOL clear_depth = TRUE);
virtual BOOL render(); virtual BOOL render();
virtual void postRender(BOOL success); virtual void postRender(BOOL success);
virtual void restoreGLTexture() ; virtual void restoreGLTexture() {}
virtual void destroyGLTexture() ; virtual void destroyGLTexture() {}
LLImageGL* getTexture(void) const { return mTexture; }
static BOOL updateAllInstances(); static BOOL updateAllInstances();
static void destroyGL() ;
static void destroyGL(); static void restoreGL() ;
static void restoreGL();
protected: protected:
void releaseGLTexture();
void generateGLTexture(); void generateGLTexture();
void generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes = FALSE, const LLColor4U *fill_color = NULL); void generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes = FALSE, const LLColor4U *fill_color=NULL);
protected: protected:
S32 mWidth;
S32 mHeight;
S32 mComponents;
LLPointer<LLImageGL> mTexture;
F32 mLastBindTime;
BOOL mClamp; BOOL mClamp;
LLCoordGL mOrigin; LLCoordGL mOrigin;
LLCamera mCamera; LLCamera mCamera;
typedef std::set<LLDynamicTexture*> instance_list_t;
static instance_list_t sInstances[ LLDynamicTexture::ORDER_COUNT ]; typedef std::set<LLViewerDynamicTexture*> instance_list_t;
static instance_list_t sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
static S32 sNumRenders; static S32 sNumRenders;
}; };

View File

@@ -47,7 +47,7 @@
#include "lllightconstants.h" #include "lllightconstants.h"
#include "llsky.h" #include "llsky.h"
#include "llviewercamera.h" #include "llviewercamera.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llvosky.h" #include "llvosky.h"
#include "llvovolume.h" #include "llvovolume.h"
#include "pipeline.h" #include "pipeline.h"
@@ -228,7 +228,7 @@ void LLFace::setWorldMatrix(const LLMatrix4 &mat)
llerrs << "Faces on this drawable are not independently modifiable\n" << llendl; llerrs << "Faces on this drawable are not independently modifiable\n" << llendl;
} }
void LLFace::setPool(LLFacePool* new_pool, LLViewerImage *texturep) void LLFace::setPool(LLFacePool* new_pool, LLViewerTexture *texturep)
{ {
LLMemType mt1(LLMemType::MTYPE_DRAWABLE); LLMemType mt1(LLMemType::MTYPE_DRAWABLE);
@@ -262,7 +262,7 @@ void LLFace::setPool(LLFacePool* new_pool, LLViewerImage *texturep)
setTexture(texturep) ; setTexture(texturep) ;
} }
void LLFace::setTexture(LLViewerImage* tex) void LLFace::setTexture(LLViewerTexture* tex)
{ {
if(mTexture == tex) if(mTexture == tex)
{ {
@@ -287,7 +287,7 @@ void LLFace::dirtyTexture()
gPipeline.markTextured(getDrawable()); gPipeline.markTextured(getDrawable());
} }
void LLFace::switchTexture(LLViewerImage* new_texture) void LLFace::switchTexture(LLViewerTexture* new_texture)
{ {
if(mTexture == new_texture) if(mTexture == new_texture)
{ {
@@ -299,7 +299,7 @@ void LLFace::switchTexture(LLViewerImage* new_texture)
llerrs << "Can not switch to a null texture." << llendl; llerrs << "Can not switch to a null texture." << llendl;
return; return;
} }
new_texture->addTextureStats(mTexture->mMaxVirtualSize) ; new_texture->addTextureStats(mTexture->getMaxVirtualSize()) ;
getViewerObject()->changeTEImage(mTEOffset, new_texture) ; getViewerObject()->changeTEImage(mTEOffset, new_texture) ;
setTexture(new_texture) ; setTexture(new_texture) ;
@@ -476,8 +476,7 @@ void LLFace::renderForSelect(U32 data_mask)
} }
} }
} }
void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color)
{ {
if (mDrawablep->getSpatialGroup() == NULL) if (mDrawablep->getSpatialGroup() == NULL)
{ {
@@ -521,8 +520,8 @@ void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color)
/* removed in lieu of raycast uv detection /* removed in lieu of raycast uv detection
void LLFace::renderSelectedUV() void LLFace::renderSelectedUV()
{ {
LLViewerImage* red_blue_imagep = gImageList.getImageFromFile("uv_test1.j2c", TRUE, TRUE); LLViewerTexture* red_blue_imagep = gTextureList.getImageFromFile("uv_test1.j2c", TRUE, TRUE);
LLViewerImage* green_imagep = gImageList.getImageFromFile("uv_test2.tga", TRUE, TRUE); LLViewerTexture* green_imagep = gTextureList.getImageFromFile("uv_test2.tga", TRUE, TRUE);
LLGLSUVSelect object_select; LLGLSUVSelect object_select;
@@ -958,7 +957,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
{ {
if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices()) if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices())
{ {
llwarns << "Index buffer overflow!" << llendl; llwarns << "Index buffer overflow!" << llendl;
llwarns << "Indices Count: " << mIndicesCount
<< " VF Num Indices: " << num_indices
<< " Indices Index: " << mIndicesIndex
<< " VB Num Indices: " << mVertexBuffer->getNumIndices() << llendl;
llwarns << "Last Indices Count: " << mLastIndicesCount
<< " Last Indices Index: " << mLastIndicesIndex
<< " Face Index: " << f
<< " Pool Type: " << mPoolType << llendl;
return FALSE; return FALSE;
} }
@@ -1148,7 +1155,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
break; break;
case BE_BRIGHTNESS: case BE_BRIGHTNESS:
case BE_DARKNESS: case BE_DARKNESS:
if( mTexture.notNull() && mTexture->getHasGLTexture()) if( mTexture.notNull() && mTexture->hasGLTexture())
{ {
// Offset by approximately one texel // Offset by approximately one texel
S32 cur_discard = mTexture->getDiscardLevel(); S32 cur_discard = mTexture->getDiscardLevel();
@@ -1342,7 +1349,7 @@ F32 LLFace::getTextureVirtualSize()
} }
face_area = LLFace::adjustPixelArea(mImportanceToCamera, face_area); face_area = LLFace::adjustPixelArea(mImportanceToCamera, face_area);
if (/*mImportanceToCamera < 1.0f && */face_area > LLViewerImage::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping. if (/*mImportanceToCamera < 1.0f && */face_area > LLViewerTexture::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping.
{ {
if (mImportanceToCamera > LEAST_IMPORTANCE_FOR_LARGE_IMAGE && mTexture.notNull() && mTexture->isLargeImage()) if (mImportanceToCamera > LEAST_IMPORTANCE_FOR_LARGE_IMAGE && mTexture.notNull() && mTexture->isLargeImage())
{ {
@@ -1355,28 +1362,6 @@ F32 LLFace::getTextureVirtualSize()
return face_area; return face_area;
} }
//static
F32 LLFace::adjustPixelArea(F32 importance, F32 pixel_area)
{
if (pixel_area > LLViewerImage::sMaxSmallImageSize)
{
if (importance < LEAST_IMPORTANCE) //if the face is not important, do not load hi-res.
{
static const F32 MAX_LEAST_IMPORTANCE_IMAGE_SIZE = 128.0f * 128.0f;
pixel_area = llmin(pixel_area * 0.5f, MAX_LEAST_IMPORTANCE_IMAGE_SIZE);
}
else if (pixel_area > LLViewerImage::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping.
{
if (importance < LEAST_IMPORTANCE_FOR_LARGE_IMAGE) //if the face is not important, do not load hi-res.
{
pixel_area = LLViewerImage::sMinLargeImageSize;
}
}
}
return pixel_area ;
}
BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
{ {
//get area of circle around face //get area of circle around face
@@ -1394,7 +1379,7 @@ BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
mPixelArea = radius*radius * 3.14159f; mPixelArea = radius*radius * 3.14159f;
cos_angle_to_view_dir = lookAt * camera->getXAxis(); cos_angle_to_view_dir = lookAt * camera->getXAxis();
if (dist < mBoundingSphereRadius || dist < 10.0f) //camera is very close if(dist < mBoundingSphereRadius) //camera is very close
{ {
cos_angle_to_view_dir = 1.0f; cos_angle_to_view_dir = 1.0f;
mImportanceToCamera = 1.0f; mImportanceToCamera = 1.0f;
@@ -1475,6 +1460,28 @@ F32 LLFace::calcImportanceToCamera(F32 cos_angle_to_view_dir, F32 dist)
return importance ; return importance ;
} }
//static
F32 LLFace::adjustPixelArea(F32 importance, F32 pixel_area)
{
if(pixel_area > LLViewerTexture::sMaxSmallImageSize)
{
if(importance < LEAST_IMPORTANCE) //if the face is not important, do not load hi-res.
{
static const F32 MAX_LEAST_IMPORTANCE_IMAGE_SIZE = 128.0f * 128.0f ;
pixel_area = llmin(pixel_area * 0.5f, MAX_LEAST_IMPORTANCE_IMAGE_SIZE) ;
}
else if(pixel_area > LLViewerTexture::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping.
{
if(importance < LEAST_IMPORTANCE_FOR_LARGE_IMAGE)//if the face is not important, do not load hi-res.
{
pixel_area = LLViewerTexture::sMinLargeImageSize ;
}
}
}
return pixel_area ;
}
BOOL LLFace::verify(const U32* indices_array) const BOOL LLFace::verify(const U32* indices_array) const
{ {
BOOL ok = TRUE; BOOL ok = TRUE;
@@ -1663,3 +1670,7 @@ LLVector3 LLFace::getPositionAgent() const
return mCenterLocal * getRenderMatrix(); return mCenterLocal * getRenderMatrix();
} }
} }
LLViewerTexture* LLFace::getTexture() const
{
return mTexture ;
}

View File

@@ -45,16 +45,16 @@
#include "xform.h" #include "xform.h"
#include "lldarrayptr.h" #include "lldarrayptr.h"
#include "llvertexbuffer.h" #include "llvertexbuffer.h"
#include "llviewerimage.h" #include "llviewertexture.h"
#include "llstat.h" #include "llstat.h"
#include "lldrawable.h" #include "lldrawable.h"
class LLFacePool; class LLFacePool;
class LLVolume; class LLVolume;
class LLViewerImage; class LLViewerTexture;
class LLTextureEntry; class LLTextureEntry;
class LLVertexProgram; class LLVertexProgram;
class LLViewerImage; class LLViewerTexture;
class LLGeometryManager; class LLGeometryManager;
const F32 MIN_ALPHA_SIZE = 1024.f; const F32 MIN_ALPHA_SIZE = 1024.f;
@@ -87,8 +87,8 @@ public:
U16 getGeomCount() const { return mGeomCount; } // vertex count for this face U16 getGeomCount() const { return mGeomCount; } // vertex count for this face
U16 getGeomIndex() const { return mGeomIndex; } // index into draw pool U16 getGeomIndex() const { return mGeomIndex; } // index into draw pool
U16 getGeomStart() const { return mGeomIndex; } // index into draw pool U16 getGeomStart() const { return mGeomIndex; } // index into draw pool
void setTexture(LLViewerImage* tex) ; void setTexture(LLViewerTexture* tex) ;
void switchTexture(LLViewerImage* new_texture); void switchTexture(LLViewerTexture* new_texture);
void dirtyTexture(); void dirtyTexture();
LLXformMatrix* getXform() const { return mXform; } LLXformMatrix* getXform() const { return mXform; }
BOOL hasGeometry() const { return mGeomCount > 0; } BOOL hasGeometry() const { return mGeomCount > 0; }
@@ -127,10 +127,10 @@ public:
LLVertexBuffer* getVertexBuffer() const { return mVertexBuffer; } LLVertexBuffer* getVertexBuffer() const { return mVertexBuffer; }
void setPoolType(U32 type) { mPoolType = type; } void setPoolType(U32 type) { mPoolType = type; }
S32 getTEOffset() { return mTEOffset; } S32 getTEOffset() { return mTEOffset; }
LLViewerImage* getTexture() const { return mTexture; } LLViewerTexture* getTexture() const;
void setViewerObject(LLViewerObject* object); void setViewerObject(LLViewerObject* object);
void setPool(LLFacePool *pool, LLViewerImage *texturep); void setPool(LLFacePool *pool, LLViewerTexture *texturep);
void setDrawable(LLDrawable *drawable); void setDrawable(LLDrawable *drawable);
void setTEOffset(const S32 te_offset); void setTEOffset(const S32 te_offset);
@@ -180,7 +180,7 @@ public:
void renderSelectedUV(); void renderSelectedUV();
void renderForSelect(U32 data_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); void renderForSelect(U32 data_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0);
void renderSelected(LLImageGL *image, const LLColor4 &color); void renderSelected(LLViewerTexture *image, const LLColor4 &color);
F32 getKey() const { return mDistance; } F32 getKey() const { return mDistance; }
@@ -240,7 +240,7 @@ private:
U32 mLastIndicesIndex; U32 mLastIndicesIndex;
LLXformMatrix* mXform; LLXformMatrix* mXform;
LLPointer<LLViewerImage> mTexture; LLPointer<LLViewerTexture> mTexture;
LLPointer<LLDrawable> mDrawablep; LLPointer<LLDrawable> mDrawablep;
LLPointer<LLViewerObject> mVObjp; LLPointer<LLViewerObject> mVObjp;
S32 mTEOffset; S32 mTEOffset;

View File

@@ -43,7 +43,7 @@
#include "llfontgl.h" #include "llfontgl.h"
#include "llappviewer.h" #include "llappviewer.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llui.h" #include "llui.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llstat.h" #include "llstat.h"

View File

@@ -50,7 +50,7 @@
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llworld.h" #include "llworld.h"
#include "lldrawpoolterrain.h" #include "lldrawpoolterrain.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llwindow.h" #include "llwindow.h"
#include "llui.h" #include "llui.h"
#include "llcontrol.h" #include "llcontrol.h"

View File

@@ -43,7 +43,7 @@
#include "llagent.h" #include "llagent.h"
#include "llsky.h" #include "llsky.h"
#include "llviewercamera.h" #include "llviewercamera.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llviewerobjectlist.h" #include "llviewerobjectlist.h"
#include "llviewerregion.h" #include "llviewerregion.h"

View File

@@ -497,7 +497,6 @@ BOOL LLFloaterAnimPreview::postBuild()
} }
else else
{ {
delete mAnimPreview;
mAnimPreview = NULL; mAnimPreview = NULL;
mMotionID.setNull(); mMotionID.setNull();
childSetValue("bad_animation_text", getString("failed_to_initialize")); childSetValue("bad_animation_text", getString("failed_to_initialize"));
@@ -536,7 +535,6 @@ LLFloaterAnimPreview::~LLFloaterAnimPreview()
avatarp->startMotion(ANIM_AGENT_STAND, BASE_ANIM_TIME_OFFSET); avatarp->startMotion(ANIM_AGENT_STAND, BASE_ANIM_TIME_OFFSET);
} }
} }
delete mAnimPreview;
mAnimPreview = NULL; mAnimPreview = NULL;
setEnabled(FALSE); setEnabled(FALSE);
@@ -556,7 +554,7 @@ void LLFloaterAnimPreview::draw()
{ {
gGL.color3f(1.f, 1.f, 1.f); gGL.color3f(1.f, 1.f, 1.f);
gGL.getTexUnit(0)->bind(mAnimPreview->getTexture()); gGL.getTexUnit(0)->bind(mAnimPreview);
gGL.begin( LLRender::QUADS ); gGL.begin( LLRender::QUADS );
{ {
@@ -1469,7 +1467,7 @@ void LLFloaterAnimPreview::onBtnOK(void* userdata)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// LLPreviewAnimation // LLPreviewAnimation
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE) LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE)
{ {
mNeedsUpdate = TRUE; mNeedsUpdate = TRUE;
mCameraDistance = PREVIEW_CAMERA_DISTANCE; mCameraDistance = PREVIEW_CAMERA_DISTANCE;
@@ -1504,6 +1502,12 @@ LLPreviewAnimation::~LLPreviewAnimation()
mDummyAvatar->markDead(); mDummyAvatar->markDead();
} }
//virtual
S8 LLPreviewAnimation::getType() const
{
return LLViewerDynamicTexture::LL_PREVIEW_ANIMATION ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// update() // update()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -1515,7 +1519,7 @@ BOOL LLPreviewAnimation::render()
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
gGL.pushMatrix(); gGL.pushMatrix();
glLoadIdentity(); glLoadIdentity();
glOrtho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f); glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
gGL.pushMatrix(); gGL.pushMatrix();
@@ -1525,7 +1529,7 @@ BOOL LLPreviewAnimation::render()
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4f(0.15f, 0.2f, 0.3f, 1.f); gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
gl_rect_2d_simple( mWidth, mHeight ); gl_rect_2d_simple( mFullWidth, mFullHeight );
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
gGL.popMatrix(); gGL.popMatrix();
@@ -1547,7 +1551,7 @@ BOOL LLPreviewAnimation::render()
target_pos + (mCameraOffset * av_rot) ); // point of interest target_pos + (mCameraOffset * av_rot) ); // point of interest
LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
mCameraRelPos = LLViewerCamera::getInstance()->getOrigin() - avatarp->mHeadp->getWorldPosition(); mCameraRelPos = LLViewerCamera::getInstance()->getOrigin() - avatarp->mHeadp->getWorldPosition();

View File

@@ -41,12 +41,16 @@
class LLVOAvatar; class LLVOAvatar;
class LLViewerJointMesh; class LLViewerJointMesh;
class LLPreviewAnimation : public LLDynamicTexture class LLPreviewAnimation : public LLViewerDynamicTexture
{ {
public: protected:
LLPreviewAnimation(S32 width, S32 height);
virtual ~LLPreviewAnimation(); virtual ~LLPreviewAnimation();
public:
LLPreviewAnimation(S32 width, S32 height);
/*virtual*/ S8 getType() const ;
BOOL render(); BOOL render();
void requestUpdate(); void requestUpdate();
void rotate(F32 yaw_radians, F32 pitch_radians); void rotate(F32 yaw_radians, F32 pitch_radians);
@@ -116,7 +120,7 @@ protected:
void draw(); void draw();
void resetMotion(); void resetMotion();
LLPreviewAnimation* mAnimPreview; LLPointer< LLPreviewAnimation> mAnimPreview;
S32 mLastMouseX; S32 mLastMouseX;
S32 mLastMouseY; S32 mLastMouseY;
LLButton* mPlayButton; LLButton* mPlayButton;

View File

@@ -45,7 +45,7 @@
#include "llagent.h" #include "llagent.h"
#include "llcombobox.h" #include "llcombobox.h"
#include "llnotify.h" #include "llnotify.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llviewerparcelmgr.h" #include "llviewerparcelmgr.h"
#include "llviewerregion.h" #include "llviewerregion.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
@@ -196,7 +196,7 @@ void LLFloaterAuction::onClickSnapshot(void* data)
tga->encode(raw); tga->encode(raw);
LLVFile::writeFile(tga->getData(), tga->getDataSize(), gVFS, self->mImageID, LLAssetType::AT_IMAGE_TGA); LLVFile::writeFile(tga->getData(), tga->getDataSize(), gVFS, self->mImageID, LLAssetType::AT_IMAGE_TGA);
raw->biasedScaleToPowerOfTwo(LLViewerImage::MAX_IMAGE_SIZE_DEFAULT); raw->biasedScaleToPowerOfTwo(LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT);
llinfos << "Writing J2C..." << llendl; llinfos << "Writing J2C..." << llendl;
@@ -204,7 +204,7 @@ void LLFloaterAuction::onClickSnapshot(void* data)
j2c->encode(raw, 0.0f); j2c->encode(raw, 0.0f);
LLVFile::writeFile(j2c->getData(), j2c->getDataSize(), gVFS, self->mImageID, LLAssetType::AT_TEXTURE); LLVFile::writeFile(j2c->getData(), j2c->getDataSize(), gVFS, self->mImageID, LLAssetType::AT_TEXTURE);
self->mImage = new LLImageGL((LLImageRaw*)raw, FALSE); self->mImage = LLViewerTextureManager::getLocalTexture((LLImageRaw*)raw, FALSE);
gGL.getTexUnit(0)->bind(self->mImage); gGL.getTexUnit(0)->bind(self->mImage);
self->mImage->setAddressMode(LLTexUnit::TAM_CLAMP); self->mImage->setAddressMode(LLTexUnit::TAM_CLAMP);
} }

View File

@@ -37,7 +37,7 @@
#include "llfloater.h" #include "llfloater.h"
#include "lluuid.h" #include "lluuid.h"
#include "llmemory.h" #include "llmemory.h"
#include "llviewerimage.h" #include "llviewertexture.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLFloaterAuction // Class LLFloaterAuction
@@ -69,7 +69,7 @@ private:
private: private:
LLTransactionID mTransactionID; LLTransactionID mTransactionID;
LLAssetID mImageID; LLAssetID mImageID;
LLPointer<LLImageGL> mImage; LLPointer<LLViewerTexture> mImage;
LLSafeHandle<LLParcelSelection> mParcelp; LLSafeHandle<LLParcelSelection> mParcelp;
S32 mParcelID; S32 mParcelID;
LLHost mParcelHost; LLHost mParcelHost;

View File

@@ -57,7 +57,7 @@ class LLTextBox;
class LLTextEditor; class LLTextEditor;
class LLTextureCtrl; class LLTextureCtrl;
class LLUICtrl; class LLUICtrl;
class LLViewerImage; class LLViewerTexture;
class LLViewerObject; class LLViewerObject;
class LLFloaterAvatarInfo class LLFloaterAvatarInfo

View File

@@ -165,7 +165,7 @@ createUI ()
* ( bits + x + y * linesize + 2 ) = ( U8 )( bVal * 255.0f ); * ( bits + x + y * linesize + 2 ) = ( U8 )( bVal * 255.0f );
} }
} }
mRGBImage = new LLImageGL ( (LLImageRaw*)raw, FALSE ); mRGBImage = LLViewerTextureManager::getLocalTexture( (LLImageRaw*)raw, FALSE );
gGL.getTexUnit(0)->bind(mRGBImage); gGL.getTexUnit(0)->bind(mRGBImage);
mRGBImage->setAddressMode(LLTexUnit::TAM_CLAMP); mRGBImage->setAddressMode(LLTexUnit::TAM_CLAMP);

View File

@@ -180,7 +180,7 @@ class LLFloaterColorPicker
const S32 mPaletteRegionHeight; const S32 mPaletteRegionHeight;
// image used to compose color grid // image used to compose color grid
LLPointer<LLImageGL> mRGBImage; LLPointer<LLViewerTexture> mRGBImage;
// current swatch in use // current swatch in use
LLColorSwatchCtrl* mSwatch; LLColorSwatchCtrl* mSwatch;

View File

@@ -55,7 +55,7 @@
#include "llinventoryview.h" #include "llinventoryview.h"
#include "lltextbox.h" #include "lltextbox.h"
#include "lllineeditor.h" #include "lllineeditor.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llfocusmgr.h" #include "llfocusmgr.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llviewercamera.h" #include "llviewercamera.h"
@@ -746,7 +746,7 @@ void LLPanelEditWearable::onInvisibilityCommit(LLUICtrl* ctrl, void* userdata)
bool new_invis_state = checkbox_ctrl->get(); bool new_invis_state = checkbox_ctrl->get();
if (new_invis_state) if (new_invis_state)
{ {
LLViewerImage* image = gImageList.getImage(IMG_INVISIBLE); LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(IMG_INVISIBLE);
const LLTextureEntry* current_te = avatar->getTE(te); const LLTextureEntry* current_te = avatar->getTE(te);
if (current_te) if (current_te)
{ {
@@ -765,7 +765,7 @@ void LLPanelEditWearable::onInvisibilityCommit(LLUICtrl* ctrl, void* userdata)
} }
if (prev_id.notNull()) if (prev_id.notNull())
{ {
LLViewerImage* image = gImageList.getImage(prev_id); LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(prev_id);
avatar->setLocTexTE(te, image, TRUE); avatar->setLocTexTE(te, image, TRUE);
avatar->wearableUpdated(self->mType, FALSE); avatar->wearableUpdated(self->mType, FALSE);
} }
@@ -871,10 +871,10 @@ void LLPanelEditWearable::onTextureCommit( LLUICtrl* ctrl, void* userdata )
ETextureIndex te = (ETextureIndex)(self->mTextureList[ctrl->getName()]); ETextureIndex te = (ETextureIndex)(self->mTextureList[ctrl->getName()]);
// Set the new version // Set the new version
LLViewerImage* image = gImageList.getImage( texture_ctrl->getImageAssetID() ); LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( texture_ctrl->getImageAssetID() );
if (image->getID().isNull()) if (image->getID().isNull())
{ {
image = gImageList.getImage(IMG_DEFAULT_AVATAR); image = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
} }
self->mTextureList[ctrl->getName()] = te; self->mTextureList[ctrl->getName()] = te;
if (gAgent.getWearable(self->mType)) if (gAgent.getWearable(self->mType))
@@ -1280,8 +1280,8 @@ public:
public: public:
LLViewerVisualParam* mParam; LLViewerVisualParam* mParam;
LLVisualParamHint* mHintMin; LLPointer<LLVisualParamHint> mHintMin;
LLVisualParamHint* mHintMax; LLPointer<LLVisualParamHint> mHintMax;
static S32 sUpdateDelayFrames; static S32 sUpdateDelayFrames;
protected: protected:
@@ -1355,8 +1355,8 @@ LLScrollingPanelParam::LLScrollingPanelParam( const std::string& name,
LLScrollingPanelParam::~LLScrollingPanelParam() LLScrollingPanelParam::~LLScrollingPanelParam()
{ {
delete mHintMin; mHintMin = NULL;
delete mHintMax; mHintMax = NULL;
} }
void LLScrollingPanelParam::updatePanel(BOOL allow_modify) void LLScrollingPanelParam::updatePanel(BOOL allow_modify)
@@ -2338,7 +2338,7 @@ void LLFloaterCustomize::initWearablePanels()
LLFloaterCustomize::~LLFloaterCustomize() LLFloaterCustomize::~LLFloaterCustomize()
{ {
llinfos << "Destroying LLFloaterCustomize" << llendl; llinfos << "Destroying LLFloaterCustomize" << llendl;
delete mResetParams; mResetParams = NULL;
gInventory.removeObserver(mInventoryObserver); gInventory.removeObserver(mInventoryObserver);
delete mInventoryObserver; delete mInventoryObserver;
} }

View File

@@ -44,7 +44,7 @@ void LLFloaterExploreAnimations::close(bool app_quitting)
LLFloaterExploreAnimations::~LLFloaterExploreAnimations() LLFloaterExploreAnimations::~LLFloaterExploreAnimations()
{ {
delete mAnimPreview; mAnimPreview = NULL;
LLFloaterExploreAnimations::sInstance = NULL; LLFloaterExploreAnimations::sInstance = NULL;
} }
@@ -99,7 +99,7 @@ void LLFloaterExploreAnimations::draw()
gGL.color3f(1.f, 1.f, 1.f); gGL.color3f(1.f, 1.f, 1.f);
gGL.getTexUnit(0)->bind(mAnimPreview->getTexture()); gGL.getTexUnit(0)->bind(mAnimPreview);
gGL.begin( LLRender::QUADS ); gGL.begin( LLRender::QUADS );
{ {

View File

@@ -29,7 +29,7 @@ public:
void update(); void update();
LLUUID mAvatarID; LLUUID mAvatarID;
LLPreviewAnimation* mAnimPreview; LLPointer<LLPreviewAnimation> mAnimPreview;
private: private:
virtual ~LLFloaterExploreAnimations(); virtual ~LLFloaterExploreAnimations();

View File

@@ -18,7 +18,7 @@
#include "llviewerobjectlist.h" #include "llviewerobjectlist.h"
#include "llviewerregion.h" #include "llviewerregion.h"
#include "llwindow.h" #include "llwindow.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "lltexturecache.h" #include "lltexturecache.h"
#include "llimage.h" #include "llimage.h"
#include "llappviewer.h" #include "llappviewer.h"
@@ -240,7 +240,7 @@ LLSD LLExportable::asLLSD()
{ {
if( LLVOAvatar::getTEWearableType( (LLVOAvatarDefines::ETextureIndex)te ) == mWearableType ) if( LLVOAvatar::getTEWearableType( (LLVOAvatarDefines::ETextureIndex)te ) == mWearableType )
{ {
LLViewerImage* te_image = mAvatar->getTEImage( te ); LLViewerTexture* te_image = mAvatar->getTEImage( te );
if( te_image ) if( te_image )
{ {
textures_map[llformat("%d", te)] = te_image->getID(); textures_map[llformat("%d", te)] = te_image->getID();
@@ -427,7 +427,7 @@ void LLFloaterExport::addAvatarStuff(LLVOAvatar* avatarp)
{ {
if( (S32)LLVOAvatar::getTEWearableType( (LLVOAvatarDefines::ETextureIndex)te ) == type ) if( (S32)LLVOAvatar::getTEWearableType( (LLVOAvatarDefines::ETextureIndex)te ) == type )
{ {
LLViewerImage* te_image = avatarp->getTEImage( te ); LLViewerTexture* te_image = avatarp->getTEImage( te );
if( te_image->getID() != IMG_DEFAULT_AVATAR) if( te_image->getID() != IMG_DEFAULT_AVATAR)
{ {
exists = true; exists = true;
@@ -792,8 +792,8 @@ void LLFloaterExport::onClickSaveAs(void* user_data)
while(!textures.empty()) while(!textures.empty())
{ {
llinfos << "Requesting texture " << textures.front().asString() << llendl; llinfos << "Requesting texture " << textures.front().asString() << llendl;
LLViewerImage* img = gImageList.getImage(textures.front(), MIPMAP_TRUE, FALSE); LLViewerTexture* img = LLViewerTextureManager::getFetchedTexture(textures.front());
img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAX_LEVEL); img->setBoostLevel(LLViewerTexture::BOOST_MAX_LEVEL);
CacheReadResponder* responder = new CacheReadResponder(textures.front(), std::string(path + textures.front().asString() + ".j2c")); CacheReadResponder* responder = new CacheReadResponder(textures.front(), std::string(path + textures.front().asString() + ".j2c"));
LLAppViewer::getTextureCache()->readFromCache(textures.front(),LLWorkerThread::PRIORITY_HIGH,0,999999,responder); LLAppViewer::getTextureCache()->readFromCache(textures.front(),LLWorkerThread::PRIORITY_HIGH,0,999999,responder);

View File

@@ -55,7 +55,7 @@
#include "lltextbox.h" #include "lltextbox.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llviewergesture.h" #include "llviewergesture.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llviewerinventory.h" #include "llviewerinventory.h"
#include "llvoavatar.h" #include "llvoavatar.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"

View File

@@ -36,7 +36,7 @@
#include "llfloaterpreference.h" #include "llfloaterpreference.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llfeaturemanager.h" #include "llfeaturemanager.h"
#include "llstartup.h" #include "llstartup.h"
@@ -90,8 +90,8 @@ void LLFloaterHardwareSettings::refresh()
void LLFloaterHardwareSettings::refreshEnabledState() void LLFloaterHardwareSettings::refreshEnabledState()
{ {
S32 min_tex_mem = LLViewerImageList::getMinVideoRamSetting(); S32 min_tex_mem = LLViewerTextureList::getMinVideoRamSetting();
S32 max_tex_mem = LLViewerImageList::getMaxVideoRamSetting(); S32 max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting();
childSetMinValue("GrapicsCardTextureMemory", min_tex_mem); childSetMinValue("GrapicsCardTextureMemory", min_tex_mem);
childSetMaxValue("GrapicsCardTextureMemory", max_tex_mem); childSetMaxValue("GrapicsCardTextureMemory", max_tex_mem);

View File

@@ -56,7 +56,7 @@
#include "llvoavatar.h" #include "llvoavatar.h"
#include "pipeline.h" #include "pipeline.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llstring.h" #include "llstring.h"
// <edit> // <edit>
#include "llviewercontrol.h" #include "llviewercontrol.h"
@@ -162,8 +162,8 @@ LLFloaterImagePreview::~LLFloaterImagePreview()
clearAllPreviewTextures(); clearAllPreviewTextures();
mRawImagep = NULL; mRawImagep = NULL;
delete mAvatarPreview; mAvatarPreview = NULL;
delete mSculptedPreview; mSculptedPreview = NULL;
mImagep = NULL ; mImagep = NULL ;
} }
@@ -272,7 +272,7 @@ void LLFloaterImagePreview::draw()
} }
else else
{ {
mImagep = new LLImageGL(mRawImagep, FALSE) ; mImagep = LLViewerTextureManager::getLocalTexture(mRawImagep.get(), FALSE) ;
gGL.getTexUnit(0)->unbind(mImagep->getTarget()) ; gGL.getTexUnit(0)->unbind(mImagep->getTarget()) ;
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName()); gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName());
@@ -314,11 +314,11 @@ void LLFloaterImagePreview::draw()
if (selected == 9) if (selected == 9)
{ {
gGL.getTexUnit(0)->bind(mSculptedPreview->getTexture()); gGL.getTexUnit(0)->bind(mSculptedPreview);
} }
else else
{ {
gGL.getTexUnit(0)->bind(mAvatarPreview->getTexture()); gGL.getTexUnit(0)->bind(mAvatarPreview);
} }
gGL.begin( LLRender::QUADS ); gGL.begin( LLRender::QUADS );
@@ -626,7 +626,7 @@ void LLFloaterImagePreview::onMouseCaptureLostImagePreview(LLMouseHandler* handl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// LLImagePreviewAvatar // LLImagePreviewAvatar
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE) LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE)
{ {
mNeedsUpdate = TRUE; mNeedsUpdate = TRUE;
mTargetJoint = NULL; mTargetJoint = NULL;
@@ -655,6 +655,11 @@ LLImagePreviewAvatar::~LLImagePreviewAvatar()
mDummyAvatar->markDead(); mDummyAvatar->markDead();
} }
//virtual
S8 LLImagePreviewAvatar::getType() const
{
return LLViewerDynamicTexture::LL_IMAGE_PREVIEW_AVATAR ;
}
void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male) void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male)
{ {
@@ -716,7 +721,7 @@ BOOL LLImagePreviewAvatar::render()
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
gGL.pushMatrix(); gGL.pushMatrix();
glLoadIdentity(); glLoadIdentity();
glOrtho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f); glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
gGL.pushMatrix(); gGL.pushMatrix();
@@ -725,7 +730,7 @@ BOOL LLImagePreviewAvatar::render()
LLGLSUIDefault def; LLGLSUIDefault def;
gGL.color4f(0.15f, 0.2f, 0.3f, 1.f); gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
gl_rect_2d_simple( mWidth, mHeight ); gl_rect_2d_simple( mFullWidth, mFullHeight );
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
gGL.popMatrix(); gGL.popMatrix();
@@ -747,9 +752,9 @@ BOOL LLImagePreviewAvatar::render()
stop_glerror(); stop_glerror();
LLViewerCamera::getInstance()->setAspect((F32)mWidth / mHeight); LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / mFullHeight);
LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
LLVertexBuffer::unbind(); LLVertexBuffer::unbind();
avatarp->updateLOD(); avatarp->updateLOD();
@@ -807,7 +812,7 @@ void LLImagePreviewAvatar::pan(F32 right, F32 up)
// LLImagePreviewSculpted // LLImagePreviewSculpted
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE) LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE)
{ {
mNeedsUpdate = TRUE; mNeedsUpdate = TRUE;
mCameraDistance = 0.f; mCameraDistance = 0.f;
@@ -829,6 +834,11 @@ LLImagePreviewSculpted::~LLImagePreviewSculpted()
{ {
} }
//virtual
S8 LLImagePreviewSculpted::getType() const
{
return LLViewerDynamicTexture::LL_IMAGE_PREVIEW_SCULPTED ;
}
void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
{ {
@@ -890,7 +900,7 @@ BOOL LLImagePreviewSculpted::render()
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
gGL.pushMatrix(); gGL.pushMatrix();
glLoadIdentity(); glLoadIdentity();
glOrtho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f); glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
gGL.pushMatrix(); gGL.pushMatrix();
@@ -898,7 +908,7 @@ BOOL LLImagePreviewSculpted::render()
gGL.color4f(0.15f, 0.2f, 0.3f, 1.f); gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
gl_rect_2d_simple( mWidth, mHeight ); gl_rect_2d_simple( mFullWidth, mFullHeight );
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
gGL.popMatrix(); gGL.popMatrix();
@@ -921,9 +931,9 @@ BOOL LLImagePreviewSculpted::render()
stop_glerror(); stop_glerror();
LLViewerCamera::getInstance()->setAspect((F32) mWidth / mHeight); LLViewerCamera::getInstance()->setAspect((F32) mFullWidth / mFullHeight);
LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
const LLVolumeFace &vf = mVolume->getVolumeFace(0); const LLVolumeFace &vf = mVolume->getVolumeFace(0);
U32 num_indices = vf.mIndices.size(); U32 num_indices = vf.mIndices.size();

View File

@@ -43,13 +43,18 @@ class LLViewerJointMesh;
class LLVOAvatar; class LLVOAvatar;
class LLTextBox; class LLTextBox;
class LLVertexBuffer; class LLVertexBuffer;
class LLVolume;
class LLImagePreviewSculpted : public LLDynamicTexture class LLImagePreviewSculpted : public LLViewerDynamicTexture
{ {
public: protected:
LLImagePreviewSculpted(S32 width, S32 height);
virtual ~LLImagePreviewSculpted(); virtual ~LLImagePreviewSculpted();
public:
LLImagePreviewSculpted(S32 width, S32 height);
/*virtual*/ S8 getType() const ;
void setPreviewTarget(LLImageRaw *imagep, F32 distance); void setPreviewTarget(LLImageRaw *imagep, F32 distance);
void setTexture(U32 name) { mTextureName = name; } void setTexture(U32 name) { mTextureName = name; }
@@ -73,12 +78,16 @@ class LLImagePreviewSculpted : public LLDynamicTexture
}; };
class LLImagePreviewAvatar : public LLDynamicTexture class LLImagePreviewAvatar : public LLViewerDynamicTexture
{ {
public: protected:
LLImagePreviewAvatar(S32 width, S32 height);
virtual ~LLImagePreviewAvatar(); virtual ~LLImagePreviewAvatar();
public:
LLImagePreviewAvatar(S32 width, S32 height);
/*virtual*/ S8 getType() const ;
void setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male); void setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male);
void setTexture(U32 name) { mTextureName = name; } void setTexture(U32 name) { mTextureName = name; }
void clearPreviewTexture(const std::string& mesh_name); void clearPreviewTexture(const std::string& mesh_name);
@@ -130,13 +139,13 @@ protected:
bool loadImage(const std::string& filename); bool loadImage(const std::string& filename);
LLPointer<LLImageRaw> mRawImagep; LLPointer<LLImageRaw> mRawImagep;
LLImagePreviewAvatar* mAvatarPreview; LLPointer<LLImagePreviewAvatar> mAvatarPreview;
LLImagePreviewSculpted* mSculptedPreview; LLPointer<LLImagePreviewSculpted> mSculptedPreview;
S32 mLastMouseX; S32 mLastMouseX;
S32 mLastMouseY; S32 mLastMouseY;
LLRect mPreviewRect; LLRect mPreviewRect;
LLRectf mPreviewImageRect; LLRectf mPreviewImageRect;
LLPointer<LLImageGL> mImagep ; LLPointer<LLViewerTexture> mImagep ;
static S32 sUploadAmount; static S32 sUploadAmount;
}; };

View File

@@ -36,7 +36,7 @@
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llviewerstats.h" #include "llviewerstats.h"
#include "llviewerimage.h" #include "llviewertexture.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llappviewer.h" #include "llappviewer.h"
@@ -180,7 +180,7 @@ void LLFloaterLagMeter::determineClient()
{ {
mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) ); mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) );
} }
else if((BYTES_TO_MEGA_BYTES(LLViewerImage::sBoundTextureMemoryInBytes)) > LLViewerImage::sMaxBoundTextureMemInMegaBytes) else if((BYTES_TO_MEGA_BYTES(LLViewerTexture::sBoundTextureMemoryInBytes)) > LLViewerTexture::sMaxBoundTextureMemInMegaBytes)
{ {
mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) ); mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) );
} }

View File

@@ -68,7 +68,7 @@
#include "lltexturectrl.h" #include "lltexturectrl.h"
#include "lluiconstants.h" #include "lluiconstants.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llviewerimagelist.h" // LLUIImageList #include "llviewertexturelist.h" // LLUIImageList
#include "llviewermessage.h" #include "llviewermessage.h"
#include "llviewerparcelmgr.h" #include "llviewerparcelmgr.h"
#include "llviewerregion.h" #include "llviewerregion.h"
@@ -1072,10 +1072,10 @@ BOOL LLPanelLandObjects::postBuild()
mBtnReturnOwnerList = getChild<LLButton>("Return objects..."); mBtnReturnOwnerList = getChild<LLButton>("Return objects...");
mBtnReturnOwnerList->setClickedCallback(onClickReturnOwnerList, this); mBtnReturnOwnerList->setClickedCallback(onClickReturnOwnerList, this);
mIconAvatarOnline = LLUIImageList::getInstance()->getUIImage("icon_avatar_online.tga"); mIconAvatarOnline = LLUI::getUIImage("icon_avatar_online.tga");
mIconAvatarInSim = LLUIImageList::getInstance()->getUIImage("ff_visible_map.tga"); mIconAvatarInSim = LLUI::getUIImage("ff_visible_map.tga");
mIconAvatarOffline = LLUIImageList::getInstance()->getUIImage("icon_avatar_offline.tga"); mIconAvatarOffline = LLUI::getUIImage("icon_avatar_offline.tga");
mIconGroup = LLUIImageList::getInstance()->getUIImage("icon_group.tga"); mIconGroup = LLUI::getUIImage("icon_group.tga");
mOwnerList = getChild<LLNameListCtrl>("owner list"); mOwnerList = getChild<LLNameListCtrl>("owner list");
mOwnerList->sortByColumnIndex(3, FALSE); mOwnerList->sortByColumnIndex(3, FALSE);

View File

@@ -38,7 +38,7 @@
#include <vector> #include <vector>
#include "llfloater.h" #include "llfloater.h"
//#include "llviewerimagelist.h" //#include "llviewertexturelist.h"
#include "llmemory.h" // LLPointer<> #include "llmemory.h" // LLPointer<>
typedef std::set<LLUUID, lluuid_less> uuid_list_t; typedef std::set<LLUUID, lluuid_less> uuid_list_t;

View File

@@ -46,7 +46,7 @@ class LLFolderViewItem;
class LLSearchEditor; class LLSearchEditor;
class LLInventoryPanel; class LLInventoryPanel;
class LLSaveFolderState; class LLSaveFolderState;
class LLViewerImage; class LLViewerTexture;
// used for setting drag & drop callbacks. // used for setting drag & drop callbacks.
typedef BOOL (*drag_n_drop_callback)(LLUICtrl*, LLInventoryItem*, void*); typedef BOOL (*drag_n_drop_callback)(LLUICtrl*, LLInventoryItem*, void*);
@@ -89,7 +89,7 @@ public:
static void onSearchEdit(const std::string& search_string, void* user_data ); static void onSearchEdit(const std::string& search_string, void* user_data );
protected: protected:
LLPointer<LLViewerImage> mLandmarkp; LLPointer<LLViewerTexture> mLandmarkp;
LLUUID mImageAssetID; // Currently selected texture LLUUID mImageAssetID; // Currently selected texture

View File

@@ -82,7 +82,7 @@ LLFloaterPostcard::instance_list_t LLFloaterPostcard::sInstances;
/// Class LLFloaterPostcard /// Class LLFloaterPostcard
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
LLFloaterPostcard::LLFloaterPostcard(LLImageJPEG* jpeg, LLImageGL *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global) LLFloaterPostcard::LLFloaterPostcard(LLImageJPEG* jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global)
: LLFloater(std::string("Postcard Floater")), : LLFloater(std::string("Postcard Floater")),
mJPEGImage(jpeg), mJPEGImage(jpeg),
mViewerImage(img), mViewerImage(img),
@@ -144,7 +144,7 @@ BOOL LLFloaterPostcard::postBuild()
// static // static
LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLImageGL *img, const LLVector2 &image_scale, const LLVector3d& pos_taken_global) LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLViewerTexture *img, const LLVector2 &image_scale, const LLVector3d& pos_taken_global)
{ {
// Take the images from the caller // Take the images from the caller
// It's now our job to clean them up // It's now our job to clean them up

View File

@@ -37,25 +37,27 @@
#include "llimagejpeg.h" #include "llimagejpeg.h"
#include "llfloater.h" #include "llfloater.h"
#include "llcheckboxctrl.h" #include "llcheckboxctrl.h"
#include "llviewertexture.h"
#include "llmemory.h" #include "llmemory.h"
class LLTextEditor; class LLTextEditor;
class LLLineEditor; class LLLineEditor;
class LLButton; class LLButton;
class LLImageJPEG;
class LLFloaterPostcard class LLFloaterPostcard
: public LLFloater : public LLFloater
{ {
public: public:
LLFloaterPostcard(LLImageJPEG* jpeg, LLImageGL *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global); LLFloaterPostcard(LLImageJPEG* jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global);
virtual ~LLFloaterPostcard(); virtual ~LLFloaterPostcard();
virtual void init(); virtual void init();
virtual BOOL postBuild(); virtual BOOL postBuild();
virtual void draw(); virtual void draw();
static LLFloaterPostcard* showFromSnapshot(LLImageJPEG *jpeg, LLImageGL *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global); static LLFloaterPostcard* showFromSnapshot(LLImageJPEG *jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global);
static void onClickCancel(void* data); static void onClickCancel(void* data);
static void onClickSend(void* data); static void onClickSend(void* data);
@@ -74,12 +76,12 @@ public:
protected: protected:
LLPointer<LLImageJPEG> mJPEGImage; LLPointer<LLImageJPEG> mJPEGImage;
LLPointer<LLImageGL> mViewerImage; LLPointer<LLViewerTexture> mViewerImage;
LLTransactionID mTransactionID; LLTransactionID mTransactionID;
LLAssetID mAssetID; LLAssetID mAssetID;
LLVector2 mImageScale; LLVector2 mImageScale;
LLVector3d mPosTakenGlobal; LLVector3d mPosTakenGlobal;
boolean mHasFirstMsgFocus; bool mHasFirstMsgFocus;
typedef std::set<LLFloaterPostcard*> instance_list_t; typedef std::set<LLFloaterPostcard*> instance_list_t;
static instance_list_t sInstances; static instance_list_t sInstances;

View File

@@ -73,8 +73,7 @@
#include "lltrans.h" #include "lltrans.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llviewerimage.h" #include "llviewertexturelist.h"
#include "llviewerimagelist.h"
#include "llviewerregion.h" #include "llviewerregion.h"
#include "llviewerstats.h" #include "llviewerstats.h"
#include "llviewertexteditor.h" #include "llviewertexteditor.h"
@@ -1140,11 +1139,11 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes()
if (!texture_ctrl) continue; if (!texture_ctrl) continue;
LLUUID image_asset_id = texture_ctrl->getImageAssetID(); LLUUID image_asset_id = texture_ctrl->getImageAssetID();
LLViewerImage* img = gImageList.getImage(image_asset_id); LLViewerTexture* img = LLViewerTextureManager::getFetchedTexture(image_asset_id);
S32 components = img->getComponents(); S32 components = img->getComponents();
// Must ask for highest resolution version's width. JC // Must ask for highest resolution version's width. JC
S32 width = img->getWidth(0); S32 width = img->getFullWidth();
S32 height = img->getHeight(0); S32 height = img->getFullHeight();
//llinfos << "texture detail " << i << " is " << width << "x" << height << "x" << components << llendl; //llinfos << "texture detail " << i << " is " << width << "x" << height << "x" << components << llendl;

View File

@@ -74,7 +74,7 @@
#include "lltoolmgr.h" #include "lltoolmgr.h"
#include "llresourcedata.h" // for LLResourceData #include "llresourcedata.h" // for LLResourceData
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llworldmap.h" #include "llworldmap.h"
#include "llfilepicker.h" #include "llfilepicker.h"
#include "llfloateravatarpicker.h" #include "llfloateravatarpicker.h"
@@ -927,7 +927,7 @@ void LLFloaterReporter::takeScreenshot()
llwarns << "Unable to take screenshot" << llendl; llwarns << "Unable to take screenshot" << llendl;
return; return;
} }
LLPointer<LLImageJ2C> upload_data = LLViewerImageList::convertToUploadFile(raw); LLPointer<LLImageJ2C> upload_data = LLViewerTextureList::convertToUploadFile(raw);
// create a resource data // create a resource data
mResourceDatap->mInventoryType = LLInventoryType::IT_NONE; mResourceDatap->mInventoryType = LLInventoryType::IT_NONE;
@@ -961,9 +961,9 @@ void LLFloaterReporter::takeScreenshot()
mResourceDatap->mAssetInfo.mType); mResourceDatap->mAssetInfo.mType);
// store in the image list so it doesn't try to fetch from the server // store in the image list so it doesn't try to fetch from the server
LLPointer<LLViewerImage> image_in_list = new LLViewerImage(mResourceDatap->mAssetInfo.mUuid); LLPointer<LLViewerFetchedTexture> image_in_list =
image_in_list->createGLTexture(0, raw, 0, TRUE, LLViewerImageBoostLevel::OTHER); LLViewerTextureManager::getFetchedTexture(mResourceDatap->mAssetInfo.mUuid, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE);
gImageList.addImage(image_in_list); image_in_list->createGLTexture(0, raw, 0, TRUE, LLViewerTexture::OTHER);
// the texture picker then uses that texture // the texture picker then uses that texture
LLTexturePicker* texture = getChild<LLTextureCtrl>("screenshot"); LLTexturePicker* texture = getChild<LLTextureCtrl>("screenshot");

View File

@@ -39,7 +39,7 @@
#include "v3math.h" #include "v3math.h"
class LLMessageSystem; class LLMessageSystem;
class LLViewerImage; class LLViewerTexture;
class LLInventoryItem; class LLInventoryItem;
class LLViewerObject; class LLViewerObject;
class LLAgent; class LLAgent;

View File

@@ -45,7 +45,7 @@
#include "llviewertexteditor.h" #include "llviewertexteditor.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llviewerobjectlist.h" #include "llviewerobjectlist.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
// //
// Statics // Statics
@@ -129,7 +129,7 @@ void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std:
if (objectp) if (objectp)
{ {
objectp->setIcon(gImageList.getImageFromFile("script_error.j2c", TRUE, TRUE)); objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", TRUE, LLViewerTexture::BOOST_UI));
floater_label = llformat("%s(%.2f, %.2f)", user_name.c_str(), objectp->getPositionRegion().mV[VX], objectp->getPositionRegion().mV[VY]); floater_label = llformat("%s(%.2f, %.2f)", user_name.c_str(), objectp->getPositionRegion().mV[VX], objectp->getPositionRegion().mV[VY]);
} }
else else

View File

@@ -131,12 +131,12 @@ public:
LLFloaterSnapshot::ESnapshotFormat getSnapshotFormat() const { return mSnapshotFormat; } LLFloaterSnapshot::ESnapshotFormat getSnapshotFormat() const { return mSnapshotFormat; }
BOOL getSnapshotUpToDate() const { return mSnapshotUpToDate; } BOOL getSnapshotUpToDate() const { return mSnapshotUpToDate; }
BOOL isSnapshotActive() { return mSnapshotActive; } BOOL isSnapshotActive() { return mSnapshotActive; }
LLImageGL* getThumbnailImage() const { return mThumbnailImage ; } LLViewerTexture* getThumbnailImage() const { return mThumbnailImage ; }
S32 getThumbnailWidth() const { return mThumbnailWidth ; } S32 getThumbnailWidth() const { return mThumbnailWidth ; }
S32 getThumbnailHeight() const { return mThumbnailHeight ; } S32 getThumbnailHeight() const { return mThumbnailHeight ; }
BOOL getThumbnailLock() const { return mThumbnailUpdateLock ; } BOOL getThumbnailLock() const { return mThumbnailUpdateLock ; }
BOOL getThumbnailUpToDate() const { return mThumbnailUpToDate ;} BOOL getThumbnailUpToDate() const { return mThumbnailUpToDate ;}
LLImageGL* getCurrentImage(); LLViewerTexture* getCurrentImage();
F32 getImageAspect(); F32 getImageAspect();
F32 getAspect() ; F32 getAspect() ;
LLRect getImageRect(); LLRect getImageRect();
@@ -161,7 +161,7 @@ public:
private: private:
LLColor4 mColor; LLColor4 mColor;
LLPointer<LLImageGL> mViewerImage[2]; //used to represent the scene when the frame is frozen. LLPointer<LLViewerTexture> mViewerImage[2]; //used to represent the scene when the frame is frozen.
LLRect mImageRect[2]; LLRect mImageRect[2];
S32 mWidth[2]; S32 mWidth[2];
S32 mHeight[2]; S32 mHeight[2];
@@ -169,7 +169,7 @@ private:
S32 mMaxImageSize ; S32 mMaxImageSize ;
//thumbnail image //thumbnail image
LLPointer<LLImageGL> mThumbnailImage ; LLPointer<LLViewerTexture> mThumbnailImage ;
S32 mThumbnailWidth ; S32 mThumbnailWidth ;
S32 mThumbnailHeight ; S32 mThumbnailHeight ;
LLRect mPreviewRect ; LLRect mPreviewRect ;
@@ -269,7 +269,7 @@ void LLSnapshotLivePreview::setMaxImageSize(S32 size)
} }
} }
LLImageGL* LLSnapshotLivePreview::getCurrentImage() LLViewerTexture* LLSnapshotLivePreview::getCurrentImage()
{ {
return mViewerImage[mCurImageIndex]; return mViewerImage[mCurImageIndex];
} }
@@ -718,7 +718,7 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update)
if(raw) if(raw)
{ {
mThumbnailImage = new LLImageGL(raw, FALSE); mThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
mThumbnailUpToDate = TRUE ; mThumbnailUpToDate = TRUE ;
} }
@@ -867,8 +867,8 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
scaled->expandToPowerOfTwo(1024, FALSE); scaled->expandToPowerOfTwo(1024, FALSE);
} }
previewp->mViewerImage[previewp->mCurImageIndex] = new LLImageGL(scaled, FALSE); previewp->mViewerImage[previewp->mCurImageIndex] = LLViewerTextureManager::getLocalTexture(scaled.get(), FALSE);
LLPointer<LLImageGL> curr_preview_image = previewp->mViewerImage[previewp->mCurImageIndex]; LLPointer<LLViewerTexture> curr_preview_image = previewp->mViewerImage[previewp->mCurImageIndex];
gGL.getTexUnit(0)->bind(curr_preview_image); gGL.getTexUnit(0)->bind(curr_preview_image);
if (previewp->getSnapshotType() != SNAPSHOT_TEXTURE) if (previewp->getSnapshotType() != SNAPSHOT_TEXTURE)
{ {
@@ -888,7 +888,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
S32 w = get_lower_power_two(scaled->getWidth(), 512) * 2 ; S32 w = get_lower_power_two(scaled->getWidth(), 512) * 2 ;
S32 h = get_lower_power_two(scaled->getHeight(), 512) * 2 ; S32 h = get_lower_power_two(scaled->getHeight(), 512) * 2 ;
scaled->scale(w,h); scaled->scale(w,h);
previewp->mThumbnailImage = new LLImageGL(scaled, FALSE); previewp->mThumbnailImage = LLViewerTextureManager::getLocalTexture(scaled.get(), FALSE);
previewp->mThumbnailUpdateLock = FALSE ; previewp->mThumbnailUpdateLock = FALSE ;
previewp->setThumbnailImageSize(); previewp->setThumbnailImageSize();
} }

View File

@@ -44,7 +44,7 @@
#include "llviewerstats.h" #include "llviewerstats.h"
#include "pipeline.h" #include "pipeline.h"
#include "llviewerobjectlist.h" #include "llviewerobjectlist.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
const S32 LL_SCROLL_BORDER = 1; const S32 LL_SCROLL_BORDER = 1;
@@ -144,7 +144,7 @@ void LLFloaterStats::buildStats()
// Texture statistics // Texture statistics
LLStatView *texture_statviewp = render_statviewp->addStatView("texture stat view", "Texture", "OpenDebugStatTexture", rect); LLStatView *texture_statviewp = render_statviewp->addStatView("texture stat view", "Texture", "OpenDebugStatTexture", rect);
stat_barp = texture_statviewp->addStat("Count", &(gImageList.sNumImagesStat), "DebugStatModeTextureCount"); stat_barp = texture_statviewp->addStat("Count", &(gTextureList.sNumImagesStat), "DebugStatModeTextureCount");
stat_barp->setUnitLabel(""); stat_barp->setUnitLabel("");
stat_barp->mMinBar = 0.f; stat_barp->mMinBar = 0.f;
stat_barp->mMaxBar = 8000.f; stat_barp->mMaxBar = 8000.f;
@@ -152,7 +152,7 @@ void LLFloaterStats::buildStats()
stat_barp->mLabelSpacing = 4000.f; stat_barp->mLabelSpacing = 4000.f;
stat_barp->mPerSec = FALSE; stat_barp->mPerSec = FALSE;
stat_barp = texture_statviewp->addStat("Raw Count", &(gImageList.sNumRawImagesStat), "DebugStatModeRawCount"); stat_barp = texture_statviewp->addStat("Raw Count", &(gTextureList.sNumRawImagesStat), "DebugStatModeRawCount");
stat_barp->setUnitLabel(""); stat_barp->setUnitLabel("");
stat_barp->mMinBar = 0.f; stat_barp->mMinBar = 0.f;
stat_barp->mMaxBar = 8000.f; stat_barp->mMaxBar = 8000.f;
@@ -160,7 +160,7 @@ void LLFloaterStats::buildStats()
stat_barp->mLabelSpacing = 4000.f; stat_barp->mLabelSpacing = 4000.f;
stat_barp->mPerSec = FALSE; stat_barp->mPerSec = FALSE;
stat_barp = texture_statviewp->addStat("GL Mem", &(gImageList.sGLTexMemStat), "DebugStatModeGLMem"); stat_barp = texture_statviewp->addStat("GL Mem", &(gTextureList.sGLTexMemStat), "DebugStatModeGLMem");
stat_barp->setUnitLabel(""); stat_barp->setUnitLabel("");
stat_barp->mMinBar = 0.f; stat_barp->mMinBar = 0.f;
stat_barp->mMaxBar = 400.f; stat_barp->mMaxBar = 400.f;
@@ -169,7 +169,7 @@ void LLFloaterStats::buildStats()
stat_barp->mPrecision = 1; stat_barp->mPrecision = 1;
stat_barp->mPerSec = FALSE; stat_barp->mPerSec = FALSE;
stat_barp = texture_statviewp->addStat("Formatted Mem", &(gImageList.sFormattedMemStat), "DebugStatModeFormattedMem"); stat_barp = texture_statviewp->addStat("Formatted Mem", &(gTextureList.sFormattedMemStat), "DebugStatModeFormattedMem");
stat_barp->setUnitLabel(""); stat_barp->setUnitLabel("");
stat_barp->mMinBar = 0.f; stat_barp->mMinBar = 0.f;
stat_barp->mMaxBar = 400.f; stat_barp->mMaxBar = 400.f;
@@ -178,7 +178,7 @@ void LLFloaterStats::buildStats()
stat_barp->mPrecision = 1; stat_barp->mPrecision = 1;
stat_barp->mPerSec = FALSE; stat_barp->mPerSec = FALSE;
stat_barp = texture_statviewp->addStat("Raw Mem", &(gImageList.sRawMemStat), "DebugStatModeRawMem"); stat_barp = texture_statviewp->addStat("Raw Mem", &(gTextureList.sRawMemStat), "DebugStatModeRawMem");
stat_barp->setUnitLabel(""); stat_barp->setUnitLabel("");
stat_barp->mMinBar = 0.f; stat_barp->mMinBar = 0.f;
stat_barp->mMaxBar = 400.f; stat_barp->mMaxBar = 400.f;
@@ -187,7 +187,7 @@ void LLFloaterStats::buildStats()
stat_barp->mPrecision = 1; stat_barp->mPrecision = 1;
stat_barp->mPerSec = FALSE; stat_barp->mPerSec = FALSE;
stat_barp = texture_statviewp->addStat("Bound Mem", &(gImageList.sGLBoundMemStat), "DebugStatModeBoundMem"); stat_barp = texture_statviewp->addStat("Bound Mem", &(gTextureList.sGLBoundMemStat), "DebugStatModeBoundMem");
stat_barp->setUnitLabel(""); stat_barp->setUnitLabel("");
stat_barp->mMinBar = 0.f; stat_barp->mMinBar = 0.f;
stat_barp->mMaxBar = 400.f; stat_barp->mMaxBar = 400.f;

View File

@@ -8,8 +8,7 @@
#include "lllocalinventory.h" #include "lllocalinventory.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llassetconverter.h" #include "llassetconverter.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llviewerimage.h"
#include "llimagej2c.h" #include "llimagej2c.h"
LLFloaterVFS* LLFloaterVFS::sInstance; LLFloaterVFS* LLFloaterVFS::sInstance;
@@ -206,7 +205,7 @@ void LLFloaterVFS::removeEntry()
if((*iter).mID == mEditID) if((*iter).mID == mEditID)
{ {
if((*iter).mType == LLAssetType::AT_TEXTURE) if((*iter).mType == LLAssetType::AT_TEXTURE)
gImageList.deleteImage(gImageList.hasImage( (*iter).mID )); gTextureList.deleteImage(gTextureList.findImage( (*iter).mID ));
else else
gVFS->removeFile((*iter).mID, (*iter).mType); gVFS->removeFile((*iter).mID, (*iter).mType);
iter = mFiles.erase(iter); iter = mFiles.erase(iter);
@@ -270,9 +269,9 @@ void LLFloaterVFS::onClickAdd(void* user_data)
llinfos << "Image: " << file_name << " is corrupt." << llendl; llinfos << "Image: " << file_name << " is corrupt." << llendl;
return; return;
} }
LLPointer<LLViewerImage> imagep = new LLViewerImage(asset_id); LLPointer<LLViewerFetchedTexture> imagep = new LLViewerFetchedTexture(asset_id);
imagep->createGLTexture(0, image_raw, 0, TRUE, LLViewerImageBoostLevel::BOOST_NONE); imagep->createGLTexture(0, image_raw, 0, TRUE, LLViewerTexture::BOOST_NONE);
gImageList.addImage(imagep); gTextureList.addImage(imagep);
} }
else else
{ {

View File

@@ -55,8 +55,7 @@
#include "llscrollcontainer.h" // hack to allow scrolling #include "llscrollcontainer.h" // hack to allow scrolling
#include "lltooldraganddrop.h" #include "lltooldraganddrop.h"
#include "llui.h" #include "llui.h"
#include "llviewerimage.h" #include "llviewertexturelist.h"
#include "llviewerimagelist.h"
#include "llviewerjointattachment.h" #include "llviewerjointattachment.h"
#include "llviewermenu.h" #include "llviewermenu.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"

View File

@@ -52,7 +52,7 @@
#include "stdenums.h" #include "stdenums.h"
#include "llfontgl.h" #include "llfontgl.h"
#include "lleditmenuhandler.h" #include "lleditmenuhandler.h"
#include "llviewerimage.h" #include "llviewertexture.h"
#include "lldepthstack.h" #include "lldepthstack.h"
#include "lltooldraganddrop.h" #include "lltooldraganddrop.h"

View File

@@ -66,7 +66,7 @@
#include "llviewerregion.h" #include "llviewerregion.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llglheaders.h" #include "llglheaders.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
//#include "lltoolobjpicker.h" //#include "lltoolobjpicker.h"
#include "llhudmanager.h" // HACK for creating flex obj's #include "llhudmanager.h" // HACK for creating flex obj's

View File

@@ -42,7 +42,7 @@
#include "llbox.h" #include "llbox.h"
#include "lldrawable.h" #include "lldrawable.h"
#include "llhudrender.h" #include "llhudrender.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llviewerobjectlist.h" #include "llviewerobjectlist.h"
#include "llviewerpartsim.h" #include "llviewerpartsim.h"
#include "llviewerpartsource.h" #include "llviewerpartsource.h"

View File

@@ -40,7 +40,7 @@
#include "llviewerobject.h" #include "llviewerobject.h"
#include "lldrawable.h" #include "lldrawable.h"
#include "llviewercamera.h" #include "llviewercamera.h"
#include "llviewerimage.h" #include "llviewertexture.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -145,7 +145,7 @@ void LLHUDIcon::renderIcon(BOOL for_select)
alpha_factor *= clamp_rescale(time_elapsed, MAX_VISIBLE_TIME - FADE_OUT_TIME, MAX_VISIBLE_TIME, 1.f, 0.f); alpha_factor *= clamp_rescale(time_elapsed, MAX_VISIBLE_TIME - FADE_OUT_TIME, MAX_VISIBLE_TIME, 1.f, 0.f);
} }
F32 image_aspect = (F32)mImagep->mFullWidth / (F32)mImagep->mFullHeight; F32 image_aspect = (F32)mImagep->getFullWidth() / (F32)mImagep->getFullHeight();
LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * x_pixel_vec; LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * x_pixel_vec;
LLVector3 y_scale = (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * y_pixel_vec; LLVector3 y_scale = (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * y_pixel_vec;
@@ -165,7 +165,7 @@ void LLHUDIcon::renderIcon(BOOL for_select)
LLColor4 icon_color = LLColor4::white; LLColor4 icon_color = LLColor4::white;
icon_color.mV[VALPHA] = alpha_factor; icon_color.mV[VALPHA] = alpha_factor;
gGL.color4fv(icon_color.mV); gGL.color4fv(icon_color.mV);
gGL.getTexUnit(0)->bind(mImagep.get()); gGL.getTexUnit(0)->bind(mImagep);
} }
gGL.begin(LLRender::QUADS); gGL.begin(LLRender::QUADS);
@@ -182,7 +182,7 @@ void LLHUDIcon::renderIcon(BOOL for_select)
gGL.end(); gGL.end();
} }
void LLHUDIcon::setImage(LLViewerImage* imagep) void LLHUDIcon::setImage(LLViewerTexture* imagep)
{ {
mImagep = imagep; mImagep = imagep;
mImagep->setAddressMode(LLTexUnit::TAM_CLAMP); mImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
@@ -262,7 +262,7 @@ BOOL LLHUDIcon::lineSegmentIntersect(const LLVector3& start, const LLVector3& en
return FALSE; return FALSE;
} }
F32 image_aspect = (F32)mImagep->mFullWidth / (F32)mImagep->mFullHeight; F32 image_aspect = (F32)mImagep->getFullWidth() / (F32)mImagep->getFullHeight();
LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * x_pixel_vec; LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * x_pixel_vec;
LLVector3 y_scale = (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * y_pixel_vec; LLVector3 y_scale = (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * y_pixel_vec;

View File

@@ -50,6 +50,7 @@
// Renders a 2D icon billboard floating at the location specified. // Renders a 2D icon billboard floating at the location specified.
class LLDrawable; class LLDrawable;
class LLViewerObject; class LLViewerObject;
class LLViewerTexture;
class LLHUDIcon : public LLHUDObject class LLHUDIcon : public LLHUDObject
{ {
@@ -61,7 +62,7 @@ public:
/*virtual*/ void markDead(); /*virtual*/ void markDead();
/*virtual*/ F32 getDistance() const { return mDistance; } /*virtual*/ F32 getDistance() const { return mDistance; }
void setImage(LLViewerImage* imagep); void setImage(LLViewerTexture* imagep);
void setScale(F32 fraction_of_fov); void setScale(F32 fraction_of_fov);
void restartLifeTimer() { mLifeTimer.reset(); } void restartLifeTimer() { mLifeTimer.reset(); }
@@ -88,7 +89,7 @@ protected:
void renderIcon(BOOL for_select); // common render code void renderIcon(BOOL for_select); // common render code
private: private:
LLPointer<LLViewerImage> mImagep; LLPointer<LLViewerTexture> mImagep;
LLFrameTimer mAnimTimer; LLFrameTimer mAnimTimer;
LLFrameTimer mLifeTimer; LLFrameTimer mLifeTimer;
F32 mDistance; F32 mDistance;

View File

@@ -48,7 +48,7 @@
#include "llimagegl.h" #include "llimagegl.h"
#include "llui.h" #include "llui.h"
#include "llviewercamera.h" #include "llviewercamera.h"
#include "llviewerimagelist.h" #include "llviewertexturelist.h"
#include "llviewerobject.h" #include "llviewerobject.h"
#include "llvovolume.h" #include "llvovolume.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"

Some files were not shown because too many files have changed in this diff Show More