Finished LLGLTexture. Migrated opengl related code from llui.h/cpp to llrender2dutils.h/cpp. Moved lluiimage to llrender library.
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
//#include "llviewercontrol.h"
|
||||
//#include "llxmltree.h"
|
||||
//#include "llvoavatar.h"
|
||||
//#include "llwearable.h"
|
||||
#include "llwearable.h"
|
||||
//#include "lldir.h"
|
||||
//#include "llvolume.h"
|
||||
//#include "llendianswizzle.h"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "llvfs.h"
|
||||
#include "lltexlayerparams.h"
|
||||
#include "lltexturemanagerbridge.h"
|
||||
//#include "llrender2dutils.h"
|
||||
#include "llrender2dutils.h"
|
||||
#include "llwearable.h"
|
||||
#include "llwearabledata.h"
|
||||
#include "llvertexbuffer.h"
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "llquantize.h"
|
||||
#include "lltexlayer.h"
|
||||
#include "lltexturemanagerbridge.h"
|
||||
#include "llrender2dutils.h"
|
||||
#include "llwearable.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -39,10 +39,6 @@ class LLTexLayerInterface;
|
||||
class LLGLTexture;
|
||||
class LLWearable;
|
||||
|
||||
//Temporary externs
|
||||
void gl_rect_2d_simple_tex( S32 width, S32 height );
|
||||
void gl_rect_2d_simple( S32 width, S32 height );
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLTexLayerParam
|
||||
//
|
||||
|
||||
@@ -31,11 +31,14 @@ set(llrender_SOURCE_FILES
|
||||
llfontregistry.cpp
|
||||
llgldbg.cpp
|
||||
llglslshader.cpp
|
||||
llgltexture.cpp
|
||||
llimagegl.cpp
|
||||
llpostprocess.cpp
|
||||
llrender2dutils.cpp
|
||||
llrendersphere.cpp
|
||||
llshadermgr.cpp
|
||||
lltexture.cpp
|
||||
lluiimage.cpp
|
||||
llvertexbuffer.cpp
|
||||
)
|
||||
|
||||
@@ -57,9 +60,11 @@ set(llrender_HEADER_FILES
|
||||
llimagegl.h
|
||||
llpostprocess.h
|
||||
llrender.h
|
||||
llrender2dutils.h
|
||||
llrendersphere.h
|
||||
llshadermgr.h
|
||||
lltexture.h
|
||||
lluiimage.h
|
||||
llvertexbuffer.h
|
||||
)
|
||||
|
||||
|
||||
398
indra/llrender/llgltexture.cpp
Normal file
398
indra/llrender/llgltexture.cpp
Normal file
@@ -0,0 +1,398 @@
|
||||
/**
|
||||
* @file llgltexture.cpp
|
||||
* @brief Opengl texture implementation
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#include "linden_common.h"
|
||||
#include "llgltexture.h"
|
||||
|
||||
|
||||
// static
|
||||
S32 LLGLTexture::getTotalNumOfCategories()
|
||||
{
|
||||
return MAX_GL_IMAGE_CATEGORY - (BOOST_HIGH - BOOST_SCULPTED) + 2 ;
|
||||
}
|
||||
|
||||
// static
|
||||
//index starts from zero.
|
||||
S32 LLGLTexture::getIndexFromCategory(S32 category)
|
||||
{
|
||||
return (category < BOOST_HIGH) ? category : category - (BOOST_HIGH - BOOST_SCULPTED) + 1 ;
|
||||
}
|
||||
|
||||
//static
|
||||
S32 LLGLTexture::getCategoryFromIndex(S32 index)
|
||||
{
|
||||
return (index < BOOST_HIGH) ? index : index + (BOOST_HIGH - BOOST_SCULPTED) - 1 ;
|
||||
}
|
||||
|
||||
LLGLTexture::LLGLTexture(BOOL usemipmaps)
|
||||
{
|
||||
init();
|
||||
mUseMipMaps = usemipmaps;
|
||||
}
|
||||
|
||||
LLGLTexture::LLGLTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps)
|
||||
{
|
||||
init();
|
||||
mFullWidth = width ;
|
||||
mFullHeight = height ;
|
||||
mUseMipMaps = usemipmaps ;
|
||||
mComponents = components ;
|
||||
setTexelsPerImage();
|
||||
}
|
||||
|
||||
LLGLTexture::LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps)
|
||||
{
|
||||
init();
|
||||
mUseMipMaps = usemipmaps ;
|
||||
// Create an empty image of the specified size and width
|
||||
mGLTexturep = new LLImageGL(raw, usemipmaps) ;
|
||||
}
|
||||
|
||||
LLGLTexture::~LLGLTexture()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void LLGLTexture::init()
|
||||
{
|
||||
mBoostLevel = LLGLTexture::BOOST_NONE;
|
||||
|
||||
mFullWidth = 0;
|
||||
mFullHeight = 0;
|
||||
mTexelsPerImage = 0 ;
|
||||
mUseMipMaps = FALSE ;
|
||||
mComponents = 0 ;
|
||||
|
||||
mTextureState = NO_DELETE ;
|
||||
mDontDiscard = FALSE;
|
||||
mNeedsGLTexture = FALSE ;
|
||||
}
|
||||
|
||||
void LLGLTexture::cleanup()
|
||||
{
|
||||
if(mGLTexturep)
|
||||
{
|
||||
mGLTexturep->cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLGLTexture::dump()
|
||||
{
|
||||
if(mGLTexturep)
|
||||
{
|
||||
mGLTexturep->dump();
|
||||
}
|
||||
}
|
||||
|
||||
void LLGLTexture::setBoostLevel(S32 level)
|
||||
{
|
||||
if(mBoostLevel != level)
|
||||
{
|
||||
mBoostLevel = level ;
|
||||
if(mBoostLevel != LLGLTexture::BOOST_NONE)
|
||||
{
|
||||
setNoDelete() ;
|
||||
}
|
||||
if(gAuditTexture)
|
||||
{
|
||||
setCategory(mBoostLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLGLTexture::forceActive()
|
||||
{
|
||||
mTextureState = ACTIVE ;
|
||||
}
|
||||
|
||||
void LLGLTexture::setActive()
|
||||
{
|
||||
if(mTextureState != NO_DELETE)
|
||||
{
|
||||
mTextureState = ACTIVE ;
|
||||
}
|
||||
}
|
||||
|
||||
//set the texture to stay in memory
|
||||
void LLGLTexture::setNoDelete()
|
||||
{
|
||||
mTextureState = NO_DELETE ;
|
||||
}
|
||||
|
||||
void LLGLTexture::generateGLTexture()
|
||||
{
|
||||
if(mGLTexturep.isNull())
|
||||
{
|
||||
mGLTexturep = new LLImageGL(mFullWidth, mFullHeight, mComponents, mUseMipMaps) ;
|
||||
}
|
||||
}
|
||||
|
||||
LLImageGL* LLGLTexture::getGLTexture() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep ;
|
||||
}
|
||||
|
||||
BOOL LLGLTexture::createGLTexture()
|
||||
{
|
||||
if(mGLTexturep.isNull())
|
||||
{
|
||||
generateGLTexture() ;
|
||||
}
|
||||
|
||||
return mGLTexturep->createGLTexture() ;
|
||||
}
|
||||
|
||||
BOOL LLGLTexture::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename, BOOL to_create, S32 category)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category) ;
|
||||
|
||||
if(ret)
|
||||
{
|
||||
mFullWidth = mGLTexturep->getCurrentWidth() ;
|
||||
mFullHeight = mGLTexturep->getCurrentHeight() ;
|
||||
mComponents = mGLTexturep->getComponents() ;
|
||||
setTexelsPerImage();
|
||||
}
|
||||
|
||||
return ret ;
|
||||
}
|
||||
|
||||
void LLGLTexture::setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
mGLTexturep->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes) ;
|
||||
}
|
||||
void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode mode)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
mGLTexturep->setAddressMode(mode) ;
|
||||
}
|
||||
void LLGLTexture::setFilteringOption(LLTexUnit::eTextureFilterOptions option)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
mGLTexturep->setFilteringOption(option) ;
|
||||
}
|
||||
|
||||
//virtual
|
||||
S32 LLGLTexture::getWidth(S32 discard_level) const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
return mGLTexturep->getWidth(discard_level) ;
|
||||
}
|
||||
|
||||
//virtual
|
||||
S32 LLGLTexture::getHeight(S32 discard_level) const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
return mGLTexturep->getHeight(discard_level) ;
|
||||
}
|
||||
|
||||
S32 LLGLTexture::getMaxDiscardLevel() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
return mGLTexturep->getMaxDiscardLevel() ;
|
||||
}
|
||||
S32 LLGLTexture::getDiscardLevel() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
return mGLTexturep->getDiscardLevel() ;
|
||||
}
|
||||
S8 LLGLTexture::getComponents() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getComponents() ;
|
||||
}
|
||||
|
||||
LLGLuint LLGLTexture::getTexName() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getTexName() ;
|
||||
}
|
||||
|
||||
BOOL LLGLTexture::hasGLTexture() const
|
||||
{
|
||||
if(mGLTexturep.notNull())
|
||||
{
|
||||
return mGLTexturep->getHasGLTexture() ;
|
||||
}
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
BOOL LLGLTexture::getBoundRecently() const
|
||||
{
|
||||
if(mGLTexturep.notNull())
|
||||
{
|
||||
return mGLTexturep->getBoundRecently() ;
|
||||
}
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
LLTexUnit::eTextureType LLGLTexture::getTarget(void) const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
return mGLTexturep->getTarget() ;
|
||||
}
|
||||
|
||||
BOOL LLGLTexture::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->setSubImage(imageraw, x_pos, y_pos, width, height, fast_update) ;
|
||||
}
|
||||
|
||||
BOOL LLGLTexture::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->setSubImage(datap, data_width, data_height, x_pos, y_pos, width, height, fast_update) ;
|
||||
}
|
||||
|
||||
void LLGLTexture::setGLTextureCreated (bool initialized)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
mGLTexturep->setGLTextureCreated (initialized) ;
|
||||
}
|
||||
|
||||
void LLGLTexture::setCategory(S32 category)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
mGLTexturep->setCategory(category) ;
|
||||
}
|
||||
|
||||
LLTexUnit::eTextureAddressMode LLGLTexture::getAddressMode(void) const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getAddressMode() ;
|
||||
}
|
||||
|
||||
S32 LLGLTexture::getTextureMemory() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->mTextureMemory ;
|
||||
}
|
||||
|
||||
LLGLenum LLGLTexture::getPrimaryFormat() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getPrimaryFormat() ;
|
||||
}
|
||||
|
||||
BOOL LLGLTexture::getIsAlphaMask() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getIsAlphaMask() ;
|
||||
}
|
||||
|
||||
BOOL LLGLTexture::getMask(const LLVector2 &tc)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getMask(tc) ;
|
||||
}
|
||||
|
||||
F32 LLGLTexture::getTimePassedSinceLastBound()
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getTimePassedSinceLastBound() ;
|
||||
}
|
||||
BOOL LLGLTexture::getMissed() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getMissed() ;
|
||||
}
|
||||
|
||||
BOOL LLGLTexture::isJustBound() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->isJustBound() ;
|
||||
}
|
||||
|
||||
void LLGLTexture::forceUpdateBindStats(void) const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->forceUpdateBindStats() ;
|
||||
}
|
||||
|
||||
/*U32 LLGLTexture::getTexelsInAtlas() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getTexelsInAtlas() ;
|
||||
}
|
||||
|
||||
U32 LLGLTexture::getTexelsInGLTexture() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getTexelsInGLTexture() ;
|
||||
}
|
||||
|
||||
BOOL LLGLTexture::isGLTextureCreated() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->isGLTextureCreated() ;
|
||||
}
|
||||
|
||||
S32 LLGLTexture::getDiscardLevelInAtlas() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getDiscardLevelInAtlas() ;
|
||||
}*/
|
||||
|
||||
void LLGLTexture::destroyGLTexture()
|
||||
{
|
||||
if(mGLTexturep.notNull() && mGLTexturep->getHasGLTexture())
|
||||
{
|
||||
mGLTexturep->destroyGLTexture() ;
|
||||
mTextureState = DELETED ;
|
||||
}
|
||||
}
|
||||
|
||||
void LLGLTexture::setTexelsPerImage()
|
||||
{
|
||||
S32 fullwidth = llmin(mFullWidth,(S32)MAX_IMAGE_SIZE_DEFAULT);
|
||||
S32 fullheight = llmin(mFullHeight,(S32)MAX_IMAGE_SIZE_DEFAULT);
|
||||
mTexelsPerImage = (F32)fullwidth * fullheight;
|
||||
}
|
||||
@@ -79,92 +79,104 @@ public:
|
||||
MAX_GL_IMAGE_CATEGORY
|
||||
};
|
||||
|
||||
//static S32 getTotalNumOfCategories() ;
|
||||
//static S32 getIndexFromCategory(S32 category) ;
|
||||
//static S32 getCategoryFromIndex(S32 index) ;
|
||||
static S32 getTotalNumOfCategories() ;
|
||||
static S32 getIndexFromCategory(S32 category) ;
|
||||
static S32 getCategoryFromIndex(S32 index) ;
|
||||
|
||||
protected:
|
||||
virtual ~LLGLTexture() {};
|
||||
virtual ~LLGLTexture();
|
||||
LOG_CLASS(LLGLTexture);
|
||||
|
||||
public:
|
||||
//LLGLTexture(BOOL usemipmaps = TRUE);
|
||||
//LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps) ;
|
||||
//LLGLTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) ;
|
||||
LLGLTexture(BOOL usemipmaps = TRUE);
|
||||
LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps) ;
|
||||
LLGLTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) ;
|
||||
|
||||
virtual void dump() = 0; // debug info to llinfos
|
||||
virtual void dump(); // debug info to llinfos
|
||||
|
||||
virtual const LLUUID& getID() const = 0;
|
||||
|
||||
virtual void setBoostLevel(S32 level) = 0;
|
||||
virtual S32 getBoostLevel() = 0;
|
||||
void setBoostLevel(S32 level);
|
||||
S32 getBoostLevel() { return mBoostLevel; }
|
||||
|
||||
virtual S32 getFullWidth() const = 0;
|
||||
virtual S32 getFullHeight() const = 0;
|
||||
S32 getFullWidth() const { return mFullWidth; }
|
||||
S32 getFullHeight() const { return mFullHeight; }
|
||||
|
||||
virtual void generateGLTexture() = 0;
|
||||
virtual void destroyGLTexture() = 0;
|
||||
void generateGLTexture() ;
|
||||
void destroyGLTexture() ;
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
//functions to access LLImageGL
|
||||
//---------------------------------------------------------------------------------------------
|
||||
//*virtual*/S32 getWidth(S32 discard_level = -1) const;
|
||||
//*virtual*/S32 getHeight(S32 discard_level = -1) const;
|
||||
/*virtual*/S32 getWidth(S32 discard_level = -1) const;
|
||||
/*virtual*/S32 getHeight(S32 discard_level = -1) const;
|
||||
|
||||
virtual BOOL hasGLTexture() const = 0;
|
||||
virtual LLGLuint getTexName() const = 0;
|
||||
virtual BOOL createGLTexture() = 0;
|
||||
virtual BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLGLTexture::OTHER) = 0;
|
||||
BOOL hasGLTexture() const ;
|
||||
LLGLuint getTexName() const ;
|
||||
BOOL createGLTexture() ;
|
||||
BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLGLTexture::OTHER);
|
||||
|
||||
virtual void setFilteringOption(LLTexUnit::eTextureFilterOptions option) = 0;
|
||||
virtual void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE) = 0;
|
||||
virtual void setAddressMode(LLTexUnit::eTextureAddressMode mode) = 0;
|
||||
virtual BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update = false) = 0;
|
||||
virtual BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update = false) = 0;
|
||||
virtual void setGLTextureCreated (bool initialized) = 0;
|
||||
virtual void setCategory(S32 category) = 0;
|
||||
void setFilteringOption(LLTexUnit::eTextureFilterOptions option);
|
||||
void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE);
|
||||
void setAddressMode(LLTexUnit::eTextureAddressMode mode);
|
||||
BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update = false);
|
||||
BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update = false);
|
||||
void setGLTextureCreated (bool initialized);
|
||||
void setCategory(S32 category) ;
|
||||
|
||||
virtual LLTexUnit::eTextureAddressMode getAddressMode(void) const = 0;
|
||||
virtual S32 getMaxDiscardLevel() const = 0;
|
||||
virtual S32 getDiscardLevel() const = 0;
|
||||
virtual S8 getComponents() const = 0;
|
||||
virtual BOOL getBoundRecently() const = 0;
|
||||
virtual S32 getTextureMemory() const = 0;
|
||||
virtual LLGLenum getPrimaryFormat() const = 0;
|
||||
virtual BOOL getIsAlphaMask() const = 0;
|
||||
virtual LLTexUnit::eTextureType getTarget(void) const = 0;
|
||||
virtual BOOL getMask(const LLVector2 &tc) = 0;
|
||||
virtual F32 getTimePassedSinceLastBound() = 0;
|
||||
virtual BOOL getMissed() const = 0;
|
||||
virtual BOOL isJustBound()const = 0;
|
||||
virtual void forceUpdateBindStats(void) const = 0;
|
||||
LLTexUnit::eTextureAddressMode getAddressMode(void) const ;
|
||||
S32 getMaxDiscardLevel() const;
|
||||
S32 getDiscardLevel() const;
|
||||
S8 getComponents() const;
|
||||
BOOL getBoundRecently() const;
|
||||
S32 getTextureMemory() const ;
|
||||
LLGLenum getPrimaryFormat() const;
|
||||
BOOL getIsAlphaMask() const ;
|
||||
LLTexUnit::eTextureType getTarget(void) const ;
|
||||
BOOL getMask(const LLVector2 &tc);
|
||||
F32 getTimePassedSinceLastBound();
|
||||
BOOL getMissed() const ;
|
||||
BOOL isJustBound()const ;
|
||||
void forceUpdateBindStats(void) const;
|
||||
|
||||
//virtual U32 getTexelsInAtlas() const = 0;
|
||||
//virtual U32 getTexelsInGLTexture() const = 0;
|
||||
//virtual BOOL isGLTextureCreated() const = 0;
|
||||
//virtual S32 getDiscardLevelInAtlas() const = 0;
|
||||
/*U32 getTexelsInAtlas() const ;
|
||||
U32 getTexelsInGLTexture() const ;
|
||||
BOOL isGLTextureCreated() const ;
|
||||
S32 getDiscardLevelInAtlas() const ;*/
|
||||
//---------------------------------------------------------------------------------------------
|
||||
//end of functions to access LLImageGL
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
//-----------------
|
||||
//*virtual*/ void setActive() = 0;
|
||||
virtual void forceActive() = 0;
|
||||
virtual void setNoDelete() = 0;
|
||||
virtual void dontDiscard() = 0;
|
||||
virtual BOOL getDontDiscard() const = 0;
|
||||
/*virtual*/ void setActive() ;
|
||||
void forceActive() ;
|
||||
void setNoDelete() ;
|
||||
void dontDiscard() { mDontDiscard = 1; mTextureState = NO_DELETE; }
|
||||
BOOL getDontDiscard() const { return mDontDiscard; }
|
||||
//-----------------
|
||||
|
||||
private:
|
||||
virtual void cleanup() = 0;
|
||||
virtual void init(bool firstinit) = 0;
|
||||
void cleanup();
|
||||
void init();
|
||||
|
||||
protected:
|
||||
|
||||
virtual void setTexelsPerImage() = 0;
|
||||
void setTexelsPerImage();
|
||||
|
||||
//note: do not make this function public.
|
||||
//*virtual*/ LLImageGL* getGLTexture() const = 0;
|
||||
/*virtual*/ LLImageGL* getGLTexture() const ;
|
||||
|
||||
protected:
|
||||
S32 mBoostLevel; // enum describing priority level
|
||||
S32 mFullWidth;
|
||||
S32 mFullHeight;
|
||||
BOOL mUseMipMaps ;
|
||||
S8 mComponents;
|
||||
F32 mTexelsPerImage; // Texels per image.
|
||||
mutable S8 mNeedsGLTexture;
|
||||
|
||||
//GL texture
|
||||
LLPointer<LLImageGL> mGLTexturep ;
|
||||
S8 mDontDiscard; // Keep full res version of this image (for UI, etc)
|
||||
|
||||
protected:
|
||||
typedef enum
|
||||
@@ -175,6 +187,8 @@ protected:
|
||||
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.
|
||||
} LLGLTextureState;
|
||||
LLGLTextureState mTextureState ;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
1624
indra/llrender/llrender2dutils.cpp
Normal file
1624
indra/llrender/llrender2dutils.cpp
Normal file
File diff suppressed because it is too large
Load Diff
164
indra/llrender/llrender2dutils.h
Normal file
164
indra/llrender/llrender2dutils.h
Normal file
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
* @file llrender2dutils.h
|
||||
* @brief GL function declarations for immediate-mode gl drawing.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
// All immediate-mode gl drawing should happen here.
|
||||
|
||||
|
||||
#ifndef LL_RENDER2DUTILS_H
|
||||
#define LL_RENDER2DUTILS_H
|
||||
|
||||
#include "llpointer.h" // LLPointer<>
|
||||
#include "llrect.h"
|
||||
#include "llglslshader.h"
|
||||
|
||||
class LLColor4;
|
||||
class LLVector3;
|
||||
class LLVector2;
|
||||
class LLUIImage;
|
||||
class LLUUID;
|
||||
|
||||
extern const LLColor4 UI_VERTEX_COLOR;
|
||||
|
||||
BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom);
|
||||
void gl_state_for_2d(S32 width, S32 height);
|
||||
|
||||
void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2);
|
||||
void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color );
|
||||
void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled);
|
||||
void gl_rect_2d_simple( S32 width, S32 height );
|
||||
|
||||
void gl_draw_x(const LLRect& rect, const LLColor4& color);
|
||||
|
||||
void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled = TRUE );
|
||||
void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled = TRUE );
|
||||
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset = 0, BOOL filled = TRUE );
|
||||
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE );
|
||||
void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE );
|
||||
void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE );
|
||||
void gl_rect_2d_checkerboard(const LLRect& parent_screen_rect, const LLRect& rect, GLfloat alpha = 1.0f);
|
||||
|
||||
void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines);
|
||||
|
||||
void gl_circle_2d(F32 x, F32 y, F32 radius, S32 steps, BOOL filled);
|
||||
void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle);
|
||||
void gl_deep_circle( F32 radius, F32 depth );
|
||||
void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center );
|
||||
void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac);
|
||||
void gl_washer_2d(F32 outer_radius, F32 inner_radius, 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_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, 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, 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,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, 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, 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));
|
||||
|
||||
void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f );
|
||||
|
||||
void gl_rect_2d_simple_tex( S32 width, S32 height );
|
||||
|
||||
// segmented rectangles
|
||||
|
||||
/*
|
||||
TL |______TOP_________| TR
|
||||
/| |\
|
||||
_/_|__________________|_\_
|
||||
L| | MIDDLE | |R
|
||||
_|_|__________________|_|_
|
||||
\ | BOTTOM | /
|
||||
BL\|__________________|/ BR
|
||||
| |
|
||||
*/
|
||||
|
||||
typedef enum e_rounded_edge
|
||||
{
|
||||
ROUNDED_RECT_LEFT = 0x1,
|
||||
ROUNDED_RECT_TOP = 0x2,
|
||||
ROUNDED_RECT_RIGHT = 0x4,
|
||||
ROUNDED_RECT_BOTTOM = 0x8,
|
||||
ROUNDED_RECT_ALL = 0xf
|
||||
}ERoundedEdge;
|
||||
|
||||
|
||||
void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const U32 edges = ROUNDED_RECT_ALL);
|
||||
void gl_segmented_rect_2d_fragment_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL);
|
||||
void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec, U32 edges = ROUNDED_RECT_ALL);
|
||||
void gl_segmented_rect_3d_tex_top(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec);
|
||||
|
||||
inline void gl_rect_2d( const LLRect& rect, BOOL filled )
|
||||
{
|
||||
gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled );
|
||||
}
|
||||
|
||||
inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL filled)
|
||||
{
|
||||
gl_rect_2d_offset_local( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, pixel_offset, filled );
|
||||
}
|
||||
|
||||
class LLImageProviderInterface;
|
||||
|
||||
class LLRender2D
|
||||
{
|
||||
LOG_CLASS(LLRender2D);
|
||||
public:
|
||||
static void initClass(LLImageProviderInterface* image_provider,
|
||||
const LLVector2* scale_factor);
|
||||
static void cleanupClass();
|
||||
|
||||
static void pushMatrix();
|
||||
static void popMatrix();
|
||||
static void loadIdentity();
|
||||
static void translate(F32 x, F32 y, F32 z = 0.0f);
|
||||
|
||||
static void setLineWidth(F32 width);
|
||||
static void setScaleFactor(const LLVector2& scale_factor);
|
||||
|
||||
static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0);
|
||||
static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0);
|
||||
|
||||
static LLVector2 sGLScaleFactor;
|
||||
private:
|
||||
static LLImageProviderInterface* sImageProvider;
|
||||
};
|
||||
|
||||
class LLImageProviderInterface
|
||||
{
|
||||
protected:
|
||||
LLImageProviderInterface() {};
|
||||
virtual ~LLImageProviderInterface() {};
|
||||
public:
|
||||
virtual LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority) = 0;
|
||||
virtual LLPointer<LLUIImage> getUIImageByID(const LLUUID& id, S32 priority) = 0;
|
||||
virtual void cleanUp() = 0;
|
||||
};
|
||||
|
||||
|
||||
extern LLGLSLShader gSolidColorProgram;
|
||||
extern LLGLSLShader gUIProgram;
|
||||
|
||||
#endif // LL_RENDER2DUTILS_H
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
// Project includes
|
||||
#include "lluiimage.h"
|
||||
#include "llui.h"
|
||||
#include "llrender2dutils.h"
|
||||
|
||||
LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image)
|
||||
: mName(name),
|
||||
@@ -72,7 +72,6 @@ set(llui_SOURCE_FILES
|
||||
lluicolor.cpp
|
||||
lluictrl.cpp
|
||||
lluictrlfactory.cpp
|
||||
lluiimage.cpp
|
||||
lluistring.cpp
|
||||
llundo.cpp
|
||||
llviewborder.cpp
|
||||
@@ -139,7 +138,6 @@ set(llui_HEADER_FILES
|
||||
lluifwd.h
|
||||
llui.h
|
||||
lluicolor.h
|
||||
lluiimage.h
|
||||
lluistring.h
|
||||
lluixmltags.h
|
||||
llundo.h
|
||||
|
||||
@@ -603,7 +603,7 @@ void LLComboBox::showList()
|
||||
LLCoordWindow window_size;
|
||||
getWindow()->getSize(&window_size);
|
||||
//HACK: shouldn't have to know about scale here
|
||||
mList->fitContents( 192, llfloor((F32)window_size.mY / LLUI::sGLScaleFactor.mV[VY]) - 50 );
|
||||
mList->fitContents( 192, llfloor((F32)window_size.mY / LLUI::getScaleFactor().mV[VY]) - 50 );
|
||||
|
||||
// Make sure that we can see the whole list
|
||||
LLRect root_view_local;
|
||||
|
||||
@@ -1973,8 +1973,8 @@ void LLLineEditor::draw()
|
||||
LLRect screen_pos = calcScreenRect();
|
||||
LLCoordGL ime_pos( screen_pos.mLeft + pixels_after_scroll, screen_pos.mTop - UI_LINEEDITOR_V_PAD );
|
||||
|
||||
ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]);
|
||||
ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]);
|
||||
ime_pos.mX = (S32) (ime_pos.mX * LLUI::getScaleFactor().mV[VX]);
|
||||
ime_pos.mY = (S32) (ime_pos.mY * LLUI::getScaleFactor().mV[VY]);
|
||||
getWindow()->setLanguageTextInput( ime_pos );
|
||||
}
|
||||
}
|
||||
@@ -2959,7 +2959,7 @@ void LLLineEditor::markAsPreedit(S32 position, S32 length)
|
||||
|
||||
S32 LLLineEditor::getPreeditFontSize() const
|
||||
{
|
||||
return llround(mGLFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]);
|
||||
return llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
|
||||
}
|
||||
|
||||
void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace)
|
||||
|
||||
@@ -88,10 +88,10 @@ void LLScreenClipRect::updateScissorRegion()
|
||||
LLRect rect = sClipRectStack.top();
|
||||
stop_glerror();
|
||||
S32 x,y,w,h;
|
||||
x = llfloor(rect.mLeft * LLUI::sGLScaleFactor.mV[VX]);
|
||||
y = llfloor(rect.mBottom * LLUI::sGLScaleFactor.mV[VY]);
|
||||
w = llmax(0, llceil(rect.getWidth() * LLUI::sGLScaleFactor.mV[VX])) + 1;
|
||||
h = llmax(0, llceil(rect.getHeight() * LLUI::sGLScaleFactor.mV[VY])) + 1;
|
||||
x = llfloor(rect.mLeft * LLUI::getScaleFactor().mV[VX]);
|
||||
y = llfloor(rect.mBottom * LLUI::getScaleFactor().mV[VY]);
|
||||
w = llmax(0, llceil(rect.getWidth() * LLUI::getScaleFactor().mV[VX])) + 1;
|
||||
h = llmax(0, llceil(rect.getHeight() * LLUI::getScaleFactor().mV[VY])) + 1;
|
||||
glScissor( x,y,w,h );
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#define LLLOCALCLIPRECT_H
|
||||
|
||||
#include "llgl.h"
|
||||
#include "lllocalcliprect.h"
|
||||
#include "llrect.h" // can't forward declare, it's templated
|
||||
#include <stack>
|
||||
|
||||
|
||||
@@ -3244,8 +3244,8 @@ void LLTextEditor::drawCursor()
|
||||
LLRect screen_pos = calcScreenRect();
|
||||
LLCoordGL ime_pos( screen_pos.mLeft + llfloor(cursor_left), screen_pos.mBottom + llfloor(cursor_top) );
|
||||
|
||||
ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]);
|
||||
ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]);
|
||||
ime_pos.mX = (S32) (ime_pos.mX * LLUI::getScaleFactor().mV[VX]);
|
||||
ime_pos.mY = (S32) (ime_pos.mY * LLUI::getScaleFactor().mV[VY]);
|
||||
getWindow()->setLanguageTextInput( ime_pos );
|
||||
}
|
||||
}
|
||||
@@ -5224,5 +5224,5 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length)
|
||||
|
||||
S32 LLTextEditor::getPreeditFontSize() const
|
||||
{
|
||||
return llround(mGLFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]);
|
||||
return llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
|
||||
}
|
||||
|
||||
1620
indra/llui/llui.cpp
1620
indra/llui/llui.cpp
File diff suppressed because it is too large
Load Diff
@@ -1,145 +1,52 @@
|
||||
/**
|
||||
* @file llui.h
|
||||
* @brief GL function declarations and other general static UI services.
|
||||
* @brief General static UI services.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* 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://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* 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.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
// All immediate-mode gl drawing should happen here.
|
||||
|
||||
#ifndef LL_LLUI_H
|
||||
#define LL_LLUI_H
|
||||
|
||||
#include "llpointer.h" // LLPointer<>
|
||||
#include "llrect.h"
|
||||
#include "llcontrol.h"
|
||||
#include "llcoord.h"
|
||||
#include "llglslshader.h"
|
||||
//#include "llhtmlhelp.h"
|
||||
#include "llgl.h" // *TODO: break this dependency
|
||||
#include <stack>
|
||||
#include "lltexture.h"
|
||||
#include "v2math.h"
|
||||
#include "llrender2dutils.h"
|
||||
#include "llpointer.h"
|
||||
#include "lluiimage.h"
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
// LLUIFactory
|
||||
#include "llsd.h"
|
||||
|
||||
class LLColor4;
|
||||
class LLHtmlHelp;
|
||||
class LLVector3;
|
||||
class LLVector2;
|
||||
class LLUIImage;
|
||||
class LLUUID;
|
||||
class LLWindow;
|
||||
class LLView;
|
||||
|
||||
// UI colors
|
||||
extern const LLColor4 UI_VERTEX_COLOR;
|
||||
void make_ui_sound(const char* name);
|
||||
|
||||
BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom);
|
||||
void gl_state_for_2d(S32 width, S32 height);
|
||||
|
||||
void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2);
|
||||
void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color );
|
||||
void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled);
|
||||
void gl_rect_2d_simple( S32 width, S32 height );
|
||||
|
||||
void gl_draw_x(const LLRect& rect, const LLColor4& color);
|
||||
|
||||
void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled = TRUE );
|
||||
void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled = TRUE );
|
||||
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset = 0, BOOL filled = TRUE );
|
||||
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE );
|
||||
void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE );
|
||||
void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE );
|
||||
void gl_rect_2d_checkerboard(const LLRect& parent_screen_rect, const LLRect& rect, GLfloat alpha = 1.0f);
|
||||
|
||||
void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines);
|
||||
|
||||
void gl_circle_2d(F32 x, F32 y, F32 radius, S32 steps, BOOL filled);
|
||||
void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle);
|
||||
void gl_deep_circle( F32 radius, F32 depth );
|
||||
void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center );
|
||||
void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac);
|
||||
void gl_washer_2d(F32 outer_radius, F32 inner_radius, 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_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, 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, 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,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, 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, 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));
|
||||
|
||||
void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f );
|
||||
|
||||
void gl_rect_2d_simple_tex( S32 width, S32 height );
|
||||
|
||||
// segmented rectangles
|
||||
|
||||
/*
|
||||
TL |______TOP_________| TR
|
||||
/| |\
|
||||
_/_|__________________|_\_
|
||||
L| | MIDDLE | |R
|
||||
_|_|__________________|_|_
|
||||
\ | BOTTOM | /
|
||||
BL\|__________________|/ BR
|
||||
| |
|
||||
*/
|
||||
|
||||
typedef enum e_rounded_edge
|
||||
{
|
||||
ROUNDED_RECT_LEFT = 0x1,
|
||||
ROUNDED_RECT_TOP = 0x2,
|
||||
ROUNDED_RECT_RIGHT = 0x4,
|
||||
ROUNDED_RECT_BOTTOM = 0x8,
|
||||
ROUNDED_RECT_ALL = 0xf
|
||||
}ERoundedEdge;
|
||||
|
||||
|
||||
void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const U32 edges = ROUNDED_RECT_ALL);
|
||||
void gl_segmented_rect_2d_fragment_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL);
|
||||
void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec, U32 edges = ROUNDED_RECT_ALL);
|
||||
void gl_segmented_rect_3d_tex_top(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec);
|
||||
|
||||
inline void gl_rect_2d( const LLRect& rect, BOOL filled )
|
||||
{
|
||||
gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled );
|
||||
}
|
||||
|
||||
inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL filled)
|
||||
{
|
||||
gl_rect_2d_offset_local( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, pixel_offset, filled );
|
||||
}
|
||||
|
||||
// Used to hide the flashing text cursor when window doesn't have focus.
|
||||
extern BOOL gShowTextEditCursor;
|
||||
|
||||
@@ -163,10 +70,10 @@ public:
|
||||
const std::string& language = LLStringUtil::null);
|
||||
static void cleanupClass();
|
||||
|
||||
static void pushMatrix();
|
||||
static void popMatrix();
|
||||
static void loadIdentity();
|
||||
static void translate(F32 x, F32 y, F32 z = 0.0f);
|
||||
static void pushMatrix() { LLRender2D::pushMatrix(); }
|
||||
static void popMatrix() { LLRender2D::popMatrix(); }
|
||||
static void loadIdentity() { LLRender2D::loadIdentity(); }
|
||||
static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::translate(x, y, z); }
|
||||
|
||||
// Return the ISO639 language name ("en", "ko", etc.) for the viewer UI.
|
||||
// http://www.loc.gov/standards/iso639-2/php/code_list.php
|
||||
@@ -178,10 +85,13 @@ public:
|
||||
static void getMousePositionScreen(S32 *x, S32 *y);
|
||||
static void setMousePositionLocal(const LLView* viewp, S32 x, S32 y);
|
||||
static void getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y);
|
||||
static void setScaleFactor(const LLVector2& scale_factor);
|
||||
static void setLineWidth(F32 width);
|
||||
static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0);
|
||||
static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0);
|
||||
static LLVector2& getScaleFactor() { return LLRender2D::sGLScaleFactor; }
|
||||
static void setScaleFactor(const LLVector2& scale_factor) { LLRender2D::setScaleFactor(scale_factor); }
|
||||
static void setLineWidth(F32 width) { LLRender2D::setLineWidth(width); }
|
||||
static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0)
|
||||
{ return LLRender2D::getUIImageByID(image_id, priority); }
|
||||
static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0)
|
||||
{ return LLRender2D::getUIImage(name, priority); }
|
||||
static LLVector2 getWindowSize();
|
||||
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);
|
||||
@@ -195,9 +105,7 @@ public:
|
||||
static LLControlGroup* sConfigGroup;
|
||||
static LLControlGroup* sIgnoresGroup;
|
||||
static LLControlGroup* sColorsGroup;
|
||||
static LLImageProviderInterface* sImageProvider;
|
||||
static LLUIAudioCallback sAudioCallback;
|
||||
static LLVector2 sGLScaleFactor;
|
||||
static LLWindow* sWindow;
|
||||
static BOOL sShowXUINames;
|
||||
static LLHtmlHelp* sHtmlHelp;
|
||||
@@ -388,18 +296,7 @@ private:
|
||||
|
||||
template <class T, class U> T* LLUISingleton<T,U>::sInstance = NULL;
|
||||
|
||||
|
||||
//RN: maybe this needs to moved elsewhere?
|
||||
class LLImageProviderInterface
|
||||
{
|
||||
protected:
|
||||
LLImageProviderInterface() {};
|
||||
virtual ~LLImageProviderInterface() {};
|
||||
public:
|
||||
virtual LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority) = 0;
|
||||
virtual LLPointer<LLUIImage> getUIImageByID(const LLUUID& id, S32 priority) = 0;
|
||||
virtual void cleanUp() = 0;
|
||||
};
|
||||
// Moved LLLocalClipRect to lllocalcliprect.h
|
||||
|
||||
class LLCallbackRegistry
|
||||
{
|
||||
|
||||
@@ -744,7 +744,7 @@ bool LLAppViewer::init()
|
||||
&gColors,
|
||||
LLUIImageList::getInstance(),
|
||||
ui_audio_callback,
|
||||
&LLUI::sGLScaleFactor
|
||||
&LLUI::getScaleFactor()
|
||||
);
|
||||
LLWeb::initClass(); // do this after LLUI
|
||||
|
||||
|
||||
@@ -100,10 +100,10 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
|
||||
S32 top = llmax(y, mDragStartY);
|
||||
S32 bottom =llmin(y, mDragStartY);
|
||||
|
||||
left = llround((F32) left * LLUI::sGLScaleFactor.mV[VX]);
|
||||
right = llround((F32) right * LLUI::sGLScaleFactor.mV[VX]);
|
||||
top = llround((F32) top * LLUI::sGLScaleFactor.mV[VY]);
|
||||
bottom = llround((F32) bottom * LLUI::sGLScaleFactor.mV[VY]);
|
||||
left = llround((F32) left * LLUI::getScaleFactor().mV[VX]);
|
||||
right = llround((F32) right * LLUI::getScaleFactor().mV[VX]);
|
||||
top = llround((F32) top * LLUI::getScaleFactor().mV[VY]);
|
||||
bottom = llround((F32) bottom * LLUI::getScaleFactor().mV[VY]);
|
||||
|
||||
F32 old_far_plane = LLViewerCamera::getInstance()->getFar();
|
||||
F32 old_near_plane = LLViewerCamera::getInstance()->getNear();
|
||||
|
||||
@@ -91,9 +91,9 @@ LLMediaCtrl::LLMediaCtrl( const std::string& name, const LLRect& rect ) :
|
||||
if(!getDecoupleTextureSize())
|
||||
{
|
||||
S32 screen_width = mIgnoreUIScale ?
|
||||
llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]) : getRect().getWidth();
|
||||
llround((F32)getRect().getWidth() * LLUI::getScaleFactor().mV[VX]) : getRect().getWidth();
|
||||
S32 screen_height = mIgnoreUIScale ?
|
||||
llround((F32)getRect().getHeight() * LLUI::sGLScaleFactor.mV[VY]) : getRect().getHeight();
|
||||
llround((F32)getRect().getHeight() * LLUI::getScaleFactor().mV[VY]) : getRect().getHeight();
|
||||
|
||||
setTextureSize(screen_width, screen_height);
|
||||
}
|
||||
@@ -444,8 +444,8 @@ void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent )
|
||||
{
|
||||
if(!getDecoupleTextureSize())
|
||||
{
|
||||
S32 screen_width = mIgnoreUIScale ? llround((F32)width * LLUI::sGLScaleFactor.mV[VX]) : width;
|
||||
S32 screen_height = mIgnoreUIScale ? llround((F32)height * LLUI::sGLScaleFactor.mV[VY]) : height;
|
||||
S32 screen_width = mIgnoreUIScale ? llround((F32)width * LLUI::getScaleFactor().mV[VX]) : width;
|
||||
S32 screen_height = mIgnoreUIScale ? llround((F32)height * LLUI::getScaleFactor().mV[VY]) : height;
|
||||
|
||||
// when floater is minimized, these sizes are negative
|
||||
if ( screen_height > 0 && screen_width > 0 )
|
||||
@@ -725,8 +725,8 @@ void LLMediaCtrl::draw()
|
||||
gGL.loadIdentity();
|
||||
// font system stores true screen origin, need to scale this by UI scale factor
|
||||
// to get render origin for this view (with unit scale)
|
||||
gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]),
|
||||
floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]),
|
||||
gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::getScaleFactor().mV[VX]),
|
||||
floorf(LLFontGL::sCurOrigin.mY * LLUI::getScaleFactor().mV[VY]),
|
||||
LLFontGL::sCurDepth);
|
||||
}
|
||||
|
||||
@@ -778,10 +778,10 @@ void LLMediaCtrl::draw()
|
||||
|
||||
if (mIgnoreUIScale)
|
||||
{
|
||||
x_offset = llround((F32)x_offset * LLUI::sGLScaleFactor.mV[VX]);
|
||||
y_offset = llround((F32)y_offset * LLUI::sGLScaleFactor.mV[VY]);
|
||||
width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]);
|
||||
height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]);
|
||||
x_offset = llround((F32)x_offset * LLUI::getScaleFactor().mV[VX]);
|
||||
y_offset = llround((F32)y_offset * LLUI::getScaleFactor().mV[VY]);
|
||||
width = llround((F32)width * LLUI::getScaleFactor().mV[VX]);
|
||||
height = llround((F32)height * LLUI::getScaleFactor().mV[VY]);
|
||||
}
|
||||
|
||||
// draw the browser
|
||||
@@ -841,14 +841,14 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y)
|
||||
coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL();
|
||||
}
|
||||
|
||||
x = mIgnoreUIScale ? llround((F32)x * LLUI::sGLScaleFactor.mV[VX]) : x;
|
||||
x = mIgnoreUIScale ? llround((F32)x * LLUI::getScaleFactor().mV[VX]) : x;
|
||||
if ( ! coords_opengl )
|
||||
{
|
||||
y = mIgnoreUIScale ? llround((F32)(y) * LLUI::sGLScaleFactor.mV[VY]) : y;
|
||||
y = mIgnoreUIScale ? llround((F32)(y) * LLUI::getScaleFactor().mV[VY]) : y;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = mIgnoreUIScale ? llround((F32)(getRect().getHeight() - y) * LLUI::sGLScaleFactor.mV[VY]) : getRect().getHeight() - y;
|
||||
y = mIgnoreUIScale ? llround((F32)(getRect().getHeight() - y) * LLUI::getScaleFactor().mV[VY]) : getRect().getHeight() - y;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1543,7 +1543,7 @@ void render_ui_2d()
|
||||
gGL.pushMatrix();
|
||||
S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2);
|
||||
S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2);
|
||||
gGL.scalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f);
|
||||
gGL.scalef(LLUI::getScaleFactor().mV[0], LLUI::getScaleFactor().mV[1], 1.f);
|
||||
gGL.translatef((F32)half_width, (F32)half_height, 0.f);
|
||||
F32 zoom = gAgentCamera.mHUDCurZoom;
|
||||
gGL.scalef(zoom,zoom,1.f);
|
||||
|
||||
@@ -243,7 +243,7 @@ LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(BOOL usemipma
|
||||
if(generate_gl_tex)
|
||||
{
|
||||
tex->generateGLTexture() ;
|
||||
tex->setCategory(LLViewerTexture::LOCAL) ;
|
||||
tex->setCategory(LLGLTexture::LOCAL) ;
|
||||
}
|
||||
return tex ;
|
||||
}
|
||||
@@ -253,14 +253,14 @@ LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLUUID&
|
||||
if(generate_gl_tex)
|
||||
{
|
||||
tex->generateGLTexture() ;
|
||||
tex->setCategory(LLViewerTexture::LOCAL) ;
|
||||
tex->setCategory(LLGLTexture::LOCAL) ;
|
||||
}
|
||||
return tex ;
|
||||
}
|
||||
LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLImageRaw* raw, BOOL usemipmaps)
|
||||
{
|
||||
LLPointer<LLViewerTexture> tex = new LLViewerTexture(raw, usemipmaps) ;
|
||||
tex->setCategory(LLViewerTexture::LOCAL) ;
|
||||
tex->setCategory(LLGLTexture::LOCAL) ;
|
||||
return tex ;
|
||||
}
|
||||
LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex)
|
||||
@@ -269,7 +269,7 @@ LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const U32 wid
|
||||
if(generate_gl_tex)
|
||||
{
|
||||
tex->generateGLTexture() ;
|
||||
tex->setCategory(LLViewerTexture::LOCAL) ;
|
||||
tex->setCategory(LLGLTexture::LOCAL) ;
|
||||
}
|
||||
return tex ;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const U32 wid
|
||||
LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(
|
||||
const LLUUID &image_id,
|
||||
BOOL usemipmaps,
|
||||
LLGLTexture::EBoostLevel boost_priority,
|
||||
LLViewerTexture::EBoostLevel boost_priority,
|
||||
S8 texture_type,
|
||||
LLGLint internal_format,
|
||||
LLGLenum primary_format,
|
||||
@@ -289,7 +289,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(
|
||||
LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile(
|
||||
const std::string& filename,
|
||||
BOOL usemipmaps,
|
||||
LLGLTexture::EBoostLevel boost_priority,
|
||||
LLViewerTexture::EBoostLevel boost_priority,
|
||||
S8 texture_type,
|
||||
LLGLint internal_format,
|
||||
LLGLenum primary_format,
|
||||
@@ -301,7 +301,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile(
|
||||
//static
|
||||
LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string& url,
|
||||
BOOL usemipmaps,
|
||||
LLGLTexture::EBoostLevel boost_priority,
|
||||
LLViewerTexture::EBoostLevel boost_priority,
|
||||
S8 texture_type,
|
||||
LLGLint internal_format,
|
||||
LLGLenum primary_format,
|
||||
@@ -384,7 +384,7 @@ void LLViewerTextureManager::init()
|
||||
LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
|
||||
#endif
|
||||
LLViewerFetchedTexture::sDefaultImagep->dontDiscard();
|
||||
LLViewerFetchedTexture::sDefaultImagep->setCategory(LLViewerTexture::OTHER) ;
|
||||
LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ;
|
||||
|
||||
LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, TRUE, LLGLTexture::BOOST_UI);
|
||||
LLViewerFetchedTexture::sSmokeImagep->setNoDelete() ;
|
||||
@@ -440,25 +440,6 @@ void LLViewerTexture::initClass()
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
S32 LLViewerTexture::getTotalNumOfCategories()
|
||||
{
|
||||
return MAX_GL_IMAGE_CATEGORY - (BOOST_HIGH - BOOST_SCULPTED) + 2 ;
|
||||
}
|
||||
|
||||
// static
|
||||
//index starts from zero.
|
||||
S32 LLViewerTexture::getIndexFromCategory(S32 category)
|
||||
{
|
||||
return (category < BOOST_HIGH) ? category : category - (BOOST_HIGH - BOOST_SCULPTED) + 1 ;
|
||||
}
|
||||
|
||||
//static
|
||||
S32 LLViewerTexture::getCategoryFromIndex(S32 index)
|
||||
{
|
||||
return (index < BOOST_HIGH) ? index : index + (BOOST_HIGH - BOOST_SCULPTED) - 1 ;
|
||||
}
|
||||
|
||||
// tuning params
|
||||
const F32 discard_bias_delta = .25f;
|
||||
const F32 discard_delta_time = 0.5f;
|
||||
@@ -599,45 +580,38 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const U32 LLViewerTexture::sCurrentFileVersion = 1;
|
||||
|
||||
LLViewerTexture::LLViewerTexture(BOOL usemipmaps)
|
||||
LLViewerTexture::LLViewerTexture(BOOL usemipmaps) :
|
||||
LLGLTexture(usemipmaps)
|
||||
{
|
||||
init(true);
|
||||
mUseMipMaps = usemipmaps ;
|
||||
|
||||
mID.generate();
|
||||
sImageCount++;
|
||||
}
|
||||
|
||||
LLViewerTexture::LLViewerTexture(const LLUUID& id, BOOL usemipmaps)
|
||||
: mID(id)
|
||||
LLViewerTexture::LLViewerTexture(const LLUUID& id, BOOL usemipmaps) :
|
||||
LLGLTexture(usemipmaps),
|
||||
mID(id)
|
||||
{
|
||||
init(true);
|
||||
mUseMipMaps = usemipmaps ;
|
||||
|
||||
sImageCount++;
|
||||
}
|
||||
|
||||
LLViewerTexture::LLViewerTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps)
|
||||
LLViewerTexture::LLViewerTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) :
|
||||
LLGLTexture(width, height, components, usemipmaps)
|
||||
{
|
||||
init(true);
|
||||
|
||||
mFullWidth = width ;
|
||||
mFullHeight = height ;
|
||||
mUseMipMaps = usemipmaps ;
|
||||
mComponents = components ;
|
||||
setTexelsPerImage();
|
||||
|
||||
mID.generate();
|
||||
sImageCount++;
|
||||
}
|
||||
|
||||
LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps)
|
||||
LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) :
|
||||
LLGLTexture(raw, usemipmaps)
|
||||
{
|
||||
init(true);
|
||||
mUseMipMaps = usemipmaps ;
|
||||
mGLTexturep = new LLImageGL(raw, usemipmaps) ;
|
||||
|
||||
// Create an empty image of the specified size and width
|
||||
mID.generate();
|
||||
sImageCount++;
|
||||
}
|
||||
@@ -648,18 +622,9 @@ LLViewerTexture::~LLViewerTexture()
|
||||
sImageCount--;
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLViewerTexture::init(bool firstinit)
|
||||
{
|
||||
mBoostLevel = LLGLTexture::BOOST_NONE;
|
||||
|
||||
mFullWidth = 0;
|
||||
mFullHeight = 0;
|
||||
mTexelsPerImage = 0 ;
|
||||
mUseMipMaps = FALSE ;
|
||||
mComponents = 0 ;
|
||||
|
||||
mTextureState = NO_DELETE ;
|
||||
mDontDiscard = FALSE;
|
||||
mMaxVirtualSize = 0.f;
|
||||
mNeedsGLTexture = FALSE ;
|
||||
mMaxVirtualSizeResetInterval = 1;
|
||||
@@ -670,7 +635,6 @@ void LLViewerTexture::init(bool firstinit)
|
||||
mNumVolumes = 0;
|
||||
mFaceList.clear() ;
|
||||
mVolumeList.clear();
|
||||
|
||||
#if !NEW_MEDIA_TEXTURE
|
||||
mIsMediaTexture = false;
|
||||
#endif //!NEW_MEDIA_TEXTURE
|
||||
@@ -686,42 +650,17 @@ void LLViewerTexture::cleanup()
|
||||
{
|
||||
mFaceList.clear() ;
|
||||
mVolumeList.clear();
|
||||
if(mGLTexturep)
|
||||
{
|
||||
mGLTexturep->cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLViewerTexture::dump()
|
||||
{
|
||||
if(mGLTexturep)
|
||||
{
|
||||
mGLTexturep->dump();
|
||||
}
|
||||
LLGLTexture::dump();
|
||||
|
||||
llinfos << "LLViewerTexture"
|
||||
<< " mID " << mID
|
||||
<< llendl;
|
||||
}
|
||||
|
||||
void LLViewerTexture::setBoostLevel(S32 level)
|
||||
{
|
||||
if(mBoostLevel != level)
|
||||
{
|
||||
mBoostLevel = level ;
|
||||
if(mBoostLevel != LLGLTexture::BOOST_NONE)
|
||||
{
|
||||
setNoDelete() ;
|
||||
}
|
||||
if(gAuditTexture)
|
||||
{
|
||||
setCategory(mBoostLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool LLViewerTexture::bindDefaultImage(S32 stage)
|
||||
{
|
||||
if (stage < 0) return false;
|
||||
@@ -924,66 +863,6 @@ void LLViewerTexture::switchToCachedImage()
|
||||
//nothing here.
|
||||
}
|
||||
|
||||
void LLViewerTexture::forceActive()
|
||||
{
|
||||
mTextureState = ACTIVE ;
|
||||
}
|
||||
|
||||
void LLViewerTexture::setActive()
|
||||
{
|
||||
if(mTextureState != NO_DELETE)
|
||||
{
|
||||
mTextureState = ACTIVE ;
|
||||
}
|
||||
}
|
||||
|
||||
//set the texture to stay in memory
|
||||
void LLViewerTexture::setNoDelete()
|
||||
{
|
||||
mTextureState = NO_DELETE ;
|
||||
}
|
||||
|
||||
void LLViewerTexture::generateGLTexture()
|
||||
{
|
||||
if(mGLTexturep.isNull())
|
||||
{
|
||||
mGLTexturep = new LLImageGL(mFullWidth, mFullHeight, mComponents, mUseMipMaps) ;
|
||||
}
|
||||
}
|
||||
|
||||
LLImageGL* LLViewerTexture::getGLTexture() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep ;
|
||||
}
|
||||
|
||||
BOOL LLViewerTexture::createGLTexture()
|
||||
{
|
||||
if(mGLTexturep.isNull())
|
||||
{
|
||||
generateGLTexture() ;
|
||||
}
|
||||
|
||||
return mGLTexturep->createGLTexture() ;
|
||||
}
|
||||
|
||||
BOOL LLViewerTexture::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename, BOOL to_create, S32 category)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category) ;
|
||||
|
||||
if(ret)
|
||||
{
|
||||
mFullWidth = mGLTexturep->getCurrentWidth() ;
|
||||
mFullHeight = mGLTexturep->getCurrentHeight() ;
|
||||
mComponents = mGLTexturep->getComponents() ;
|
||||
setTexelsPerImage();
|
||||
}
|
||||
|
||||
return ret ;
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLViewerTexture::setCachedRawImage(S32 discard_level, LLImageRaw* imageraw)
|
||||
@@ -991,219 +870,6 @@ void LLViewerTexture::setCachedRawImage(S32 discard_level, LLImageRaw* imageraw)
|
||||
//nothing here.
|
||||
}
|
||||
|
||||
void LLViewerTexture::setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
mGLTexturep->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes) ;
|
||||
}
|
||||
void LLViewerTexture::setAddressMode(LLTexUnit::eTextureAddressMode mode)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
mGLTexturep->setAddressMode(mode) ;
|
||||
}
|
||||
void LLViewerTexture::setFilteringOption(LLTexUnit::eTextureFilterOptions option)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
mGLTexturep->setFilteringOption(option) ;
|
||||
}
|
||||
|
||||
//virtual
|
||||
S32 LLViewerTexture::getWidth(S32 discard_level) const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
return mGLTexturep->getWidth(discard_level) ;
|
||||
}
|
||||
|
||||
//virtual
|
||||
S32 LLViewerTexture::getHeight(S32 discard_level) const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
return mGLTexturep->getHeight(discard_level) ;
|
||||
}
|
||||
|
||||
S32 LLViewerTexture::getMaxDiscardLevel() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
return mGLTexturep->getMaxDiscardLevel() ;
|
||||
}
|
||||
S32 LLViewerTexture::getDiscardLevel() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
return mGLTexturep->getDiscardLevel() ;
|
||||
}
|
||||
S8 LLViewerTexture::getComponents() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getComponents() ;
|
||||
}
|
||||
|
||||
LLGLuint LLViewerTexture::getTexName() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getTexName() ;
|
||||
}
|
||||
|
||||
BOOL LLViewerTexture::hasGLTexture() const
|
||||
{
|
||||
if(mGLTexturep.notNull())
|
||||
{
|
||||
return mGLTexturep->getHasGLTexture() ;
|
||||
}
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
BOOL LLViewerTexture::getBoundRecently() const
|
||||
{
|
||||
if(mGLTexturep.notNull())
|
||||
{
|
||||
return mGLTexturep->getBoundRecently() ;
|
||||
}
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
LLTexUnit::eTextureType LLViewerTexture::getTarget(void) const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
return mGLTexturep->getTarget() ;
|
||||
}
|
||||
|
||||
BOOL LLViewerTexture::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->setSubImage(imageraw, x_pos, y_pos, width, height, fast_update) ;
|
||||
}
|
||||
|
||||
BOOL LLViewerTexture::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->setSubImage(datap, data_width, data_height, x_pos, y_pos, width, height, fast_update) ;
|
||||
}
|
||||
|
||||
void LLViewerTexture::setGLTextureCreated (bool initialized)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
mGLTexturep->setGLTextureCreated (initialized) ;
|
||||
}
|
||||
|
||||
void LLViewerTexture::setCategory(S32 category)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
mGLTexturep->setCategory(category) ;
|
||||
}
|
||||
|
||||
LLTexUnit::eTextureAddressMode LLViewerTexture::getAddressMode(void) const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getAddressMode() ;
|
||||
}
|
||||
|
||||
S32 LLViewerTexture::getTextureMemory() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->mTextureMemory ;
|
||||
}
|
||||
|
||||
LLGLenum LLViewerTexture::getPrimaryFormat() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getPrimaryFormat() ;
|
||||
}
|
||||
|
||||
BOOL LLViewerTexture::getIsAlphaMask() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getIsAlphaMask() ;
|
||||
}
|
||||
|
||||
BOOL LLViewerTexture::getMask(const LLVector2 &tc)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getMask(tc) ;
|
||||
}
|
||||
|
||||
F32 LLViewerTexture::getTimePassedSinceLastBound()
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getTimePassedSinceLastBound() ;
|
||||
}
|
||||
BOOL LLViewerTexture::getMissed() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getMissed() ;
|
||||
}
|
||||
|
||||
BOOL LLViewerTexture::isJustBound() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->isJustBound() ;
|
||||
}
|
||||
|
||||
void LLViewerTexture::forceUpdateBindStats(void) const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->forceUpdateBindStats() ;
|
||||
}
|
||||
|
||||
/*U32 LLViewerTexture::getTexelsInAtlas() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getTexelsInAtlas() ;
|
||||
}
|
||||
|
||||
U32 LLViewerTexture::getTexelsInGLTexture() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getTexelsInGLTexture() ;
|
||||
}
|
||||
|
||||
BOOL LLViewerTexture::isGLTextureCreated() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->isGLTextureCreated() ;
|
||||
}
|
||||
|
||||
S32 LLViewerTexture::getDiscardLevelInAtlas() const
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
|
||||
return mGLTexturep->getDiscardLevelInAtlas() ;
|
||||
}*/
|
||||
|
||||
void LLViewerTexture::destroyGLTexture()
|
||||
{
|
||||
if(mGLTexturep.notNull() && mGLTexturep->getHasGLTexture())
|
||||
{
|
||||
mGLTexturep->destroyGLTexture() ;
|
||||
mTextureState = DELETED ;
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerTexture::setTexelsPerImage()
|
||||
{
|
||||
S32 fullwidth = llmin(mFullWidth,(S32)MAX_IMAGE_SIZE_DEFAULT);
|
||||
S32 fullheight = llmin(mFullHeight,(S32)MAX_IMAGE_SIZE_DEFAULT);
|
||||
mTexelsPerImage = (F32)fullwidth * fullheight;
|
||||
}
|
||||
|
||||
BOOL LLViewerTexture::isLargeImage()
|
||||
{
|
||||
return (S32)mTexelsPerImage > LLViewerTexture::sMinLargeImageSize ;
|
||||
|
||||
@@ -104,10 +104,6 @@ public:
|
||||
INVALID_TEXTURE_TYPE
|
||||
};
|
||||
|
||||
static S32 getTotalNumOfCategories() ;
|
||||
static S32 getIndexFromCategory(S32 category) ;
|
||||
static S32 getCategoryFromIndex(S32 index) ;
|
||||
|
||||
typedef std::vector<LLFace*> ll_face_list_t;
|
||||
typedef std::vector<LLVOVolume*> ll_volume_list_t;
|
||||
|
||||
@@ -133,9 +129,8 @@ public:
|
||||
/*virtual*/ bool bindDefaultImage(const S32 stage = 0) ;
|
||||
/*virtual*/ void forceImmediateUpdate() ;
|
||||
|
||||
const LLUUID& getID() const { return mID; }
|
||||
|
||||
void setBoostLevel(S32 level);
|
||||
/*virtual*/ const LLUUID& getID() const { return mID; }
|
||||
//void setBoostLevel(S32 level);
|
||||
S32 getBoostLevel() { return mBoostLevel; }
|
||||
|
||||
void addTextureStats(F32 virtual_size, BOOL needs_gltexture = TRUE) const;
|
||||
@@ -147,8 +142,6 @@ public:
|
||||
|
||||
LLFrameTimer* getLastReferencedTimer() {return &mLastReferencedTimer ;}
|
||||
|
||||
S32 getFullWidth() const { return mFullWidth; }
|
||||
S32 getFullHeight() const { return mFullHeight; }
|
||||
/*virtual*/ void setKnownDrawSize(S32 width, S32 height);
|
||||
|
||||
virtual void addFace(LLFace* facep) ;
|
||||
@@ -161,60 +154,8 @@ public:
|
||||
S32 getNumVolumes() const;
|
||||
const ll_volume_list_t* getVolumeList() const { return &mVolumeList; }
|
||||
|
||||
void generateGLTexture() ;
|
||||
void destroyGLTexture() ;
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
//functions to access LLImageGL
|
||||
//---------------------------------------------------------------------------------------------
|
||||
/*virtual*/S32 getWidth(S32 discard_level = -1) const;
|
||||
/*virtual*/S32 getHeight(S32 discard_level = -1) const;
|
||||
|
||||
BOOL hasGLTexture() const ;
|
||||
LLGLuint getTexName() const ;
|
||||
BOOL createGLTexture() ;
|
||||
BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLViewerTexture::OTHER);
|
||||
virtual void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ;
|
||||
|
||||
void setFilteringOption(LLTexUnit::eTextureFilterOptions option);
|
||||
void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE);
|
||||
void setAddressMode(LLTexUnit::eTextureAddressMode mode);
|
||||
BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update = false);
|
||||
BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update = false);
|
||||
void setGLTextureCreated (bool initialized);
|
||||
void setCategory(S32 category) ;
|
||||
|
||||
LLTexUnit::eTextureAddressMode getAddressMode(void) const ;
|
||||
S32 getMaxDiscardLevel() const;
|
||||
S32 getDiscardLevel() const;
|
||||
S8 getComponents() const ;
|
||||
BOOL getBoundRecently() const;
|
||||
S32 getTextureMemory() const ;
|
||||
LLGLenum getPrimaryFormat() const;
|
||||
BOOL getIsAlphaMask() const ;
|
||||
LLTexUnit::eTextureType getTarget(void) const ;
|
||||
BOOL getMask(const LLVector2 &tc);
|
||||
F32 getTimePassedSinceLastBound();
|
||||
BOOL getMissed() const ;
|
||||
BOOL isJustBound()const ;
|
||||
void forceUpdateBindStats(void) const;
|
||||
|
||||
/*U32 getTexelsInAtlas() const ;
|
||||
U32 getTexelsInGLTexture() const ;
|
||||
BOOL isGLTextureCreated() const ;
|
||||
S32 getDiscardLevelInAtlas() const ;*/
|
||||
//---------------------------------------------------------------------------------------------
|
||||
//end of functions to access LLImageGL
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
//-----------------
|
||||
/*virtual*/ void setActive() ;
|
||||
void forceActive() ;
|
||||
void setNoDelete() ;
|
||||
void dontDiscard() { mDontDiscard = 1; mTextureState = NO_DELETE; }
|
||||
BOOL getDontDiscard() const { return mDontDiscard; }
|
||||
//-----------------
|
||||
|
||||
BOOL isLargeImage() ;
|
||||
|
||||
void setParcelMedia(LLViewerMediaTexture* media) {mParcelMedia = media;}
|
||||
@@ -227,35 +168,23 @@ protected:
|
||||
void init(bool firstinit) ;
|
||||
void reorganizeFaceList() ;
|
||||
void reorganizeVolumeList() ;
|
||||
void setTexelsPerImage();
|
||||
private:
|
||||
friend class LLBumpImageList;
|
||||
friend class LLUIImageList;
|
||||
|
||||
//note: do not make this function public.
|
||||
/*virtual*/ LLImageGL* getGLTexture() const ;
|
||||
virtual void switchToCachedImage();
|
||||
|
||||
static bool isMemoryForTextureLow() ;
|
||||
protected:
|
||||
LLUUID mID;
|
||||
S32 mBoostLevel; // enum describing priority level
|
||||
S32 mFullWidth;
|
||||
S32 mFullHeight;
|
||||
BOOL mUseMipMaps ;
|
||||
S8 mComponents;
|
||||
F32 mTexelsPerImage; // Texels per image.
|
||||
mutable S8 mNeedsGLTexture;
|
||||
|
||||
mutable F32 mMaxVirtualSize; // The largest virtual size of the image, in pixels - how much data to we need?
|
||||
mutable S32 mMaxVirtualSizeResetCounter ;
|
||||
mutable S32 mMaxVirtualSizeResetInterval;
|
||||
mutable F32 mAdditionalDecodePriority; // priority add to mDecodePriority.
|
||||
LLFrameTimer mLastReferencedTimer;
|
||||
|
||||
//GL texture
|
||||
LLPointer<LLImageGL> mGLTexturep ;
|
||||
S8 mDontDiscard; // Keep full res version of this image (for UI, etc)
|
||||
|
||||
ll_face_list_t mFaceList ; //reverse pointer pointing to the faces using this image as texture
|
||||
U32 mNumFaces ;
|
||||
LLFrameTimer mLastFaceListUpdateTimer ;
|
||||
@@ -267,9 +196,6 @@ protected:
|
||||
//do not use LLPointer here.
|
||||
LLViewerMediaTexture* mParcelMedia ;
|
||||
|
||||
protected:
|
||||
LLGLTextureState mTextureState ;
|
||||
|
||||
static F32 sTexelPixelRatio;
|
||||
public:
|
||||
static const U32 sCurrentFileVersion;
|
||||
@@ -692,7 +618,7 @@ public:
|
||||
|
||||
static LLViewerFetchedTexture* getFetchedTexture(const LLUUID &image_id,
|
||||
BOOL usemipmap = TRUE,
|
||||
LLGLTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
|
||||
LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE, // Get the requested level immediately upon creation.
|
||||
S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
|
||||
LLGLint internal_format = 0,
|
||||
LLGLenum primary_format = 0,
|
||||
@@ -701,7 +627,7 @@ public:
|
||||
|
||||
static LLViewerFetchedTexture* getFetchedTextureFromFile(const std::string& filename,
|
||||
BOOL usemipmap = TRUE,
|
||||
LLGLTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE,
|
||||
LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE,
|
||||
S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
|
||||
LLGLint internal_format = 0,
|
||||
LLGLenum primary_format = 0,
|
||||
@@ -710,7 +636,7 @@ public:
|
||||
|
||||
static LLViewerFetchedTexture* getFetchedTextureFromUrl(const std::string& url,
|
||||
BOOL usemipmap = TRUE,
|
||||
LLGLTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE,
|
||||
LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_NONE,
|
||||
S8 texture_type = LLViewerTexture::FETCHED_TEXTURE,
|
||||
LLGLint internal_format = 0,
|
||||
LLGLenum primary_format = 0,
|
||||
|
||||
@@ -2203,7 +2203,7 @@ void LLViewerWindow::reshape(S32 width, S32 height)
|
||||
mWindowRectRaw.mTop = mWindowRectRaw.mBottom + height;
|
||||
calcDisplayScale();
|
||||
|
||||
BOOL display_scale_changed = mDisplayScale != LLUI::sGLScaleFactor;
|
||||
BOOL display_scale_changed = mDisplayScale != LLUI::getScaleFactor();
|
||||
LLUI::setScaleFactor(mDisplayScale);
|
||||
|
||||
// update our window rectangle
|
||||
@@ -2382,7 +2382,7 @@ void LLViewerWindow::draw()
|
||||
// scale view by UI global scale factor and aspect ratio correction factor
|
||||
gGL.scalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
|
||||
|
||||
LLVector2 old_scale_factor = LLUI::sGLScaleFactor;
|
||||
LLVector2 old_scale_factor = LLUI::getScaleFactor();
|
||||
// apply camera zoom transform (for high res screenshots)
|
||||
F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor();
|
||||
S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion();
|
||||
@@ -2396,7 +2396,7 @@ void LLViewerWindow::draw()
|
||||
(F32)getWindowHeightScaled() * -(F32)pos_y,
|
||||
0.f);
|
||||
gGL.scalef(zoom_factor, zoom_factor, 1.f);
|
||||
LLUI::sGLScaleFactor *= zoom_factor;
|
||||
LLUI::getScaleFactor() *= zoom_factor;
|
||||
}
|
||||
|
||||
// Draw tool specific overlay on world
|
||||
@@ -2464,7 +2464,7 @@ void LLViewerWindow::draw()
|
||||
LLFontGL::HCENTER, LLFontGL::TOP);
|
||||
}
|
||||
|
||||
LLUI::sGLScaleFactor = old_scale_factor;
|
||||
LLUI::setScaleFactor(old_scale_factor);
|
||||
}
|
||||
gGL.popMatrix();
|
||||
|
||||
@@ -3236,8 +3236,8 @@ void LLViewerWindow::hoverPickCallback(const LLPickInfo& pick_info)
|
||||
|
||||
void LLViewerWindow::updateMouseDelta()
|
||||
{
|
||||
S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]);
|
||||
S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]);
|
||||
S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::getScaleFactor().mV[VX]);
|
||||
S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::getScaleFactor().mV[VY]);
|
||||
|
||||
//RN: fix for asynchronous notification of mouse leaving window not working
|
||||
LLCoordWindow mouse_pos;
|
||||
|
||||
@@ -462,8 +462,8 @@ void LLWorldMapView::draw()
|
||||
{
|
||||
// Inform the fetch mechanism of the size we need
|
||||
S32 draw_size = llround(sMapScale);
|
||||
overlayimage->setKnownDrawSize( llround(draw_size * LLUI::sGLScaleFactor.mV[VX] * ((F32)info->getSizeX() / REGION_WIDTH_METERS)),
|
||||
llround(draw_size * LLUI::sGLScaleFactor.mV[VY] * ((F32)info->getSizeY() / REGION_WIDTH_METERS)));
|
||||
overlayimage->setKnownDrawSize( llround(draw_size * LLUI::getScaleFactor().mV[VX] * ((F32)info->getSizeX() / REGION_WIDTH_METERS)),
|
||||
llround(draw_size * LLUI::getScaleFactor().mV[VY] * ((F32)info->getSizeY() / REGION_WIDTH_METERS)));
|
||||
// Draw something whenever we have enough info
|
||||
if (overlayimage->hasGLTexture() && !overlayimage->isMissingAsset() && overlayimage->getID() != IMG_DEFAULT)
|
||||
{
|
||||
@@ -833,8 +833,8 @@ void LLWorldMapView::drawLegacyBackgroundLayers(S32 width, S32 height) {
|
||||
}
|
||||
|
||||
current_image->setBoostLevel(LLGLTexture::BOOST_MAP);
|
||||
current_image->setKnownDrawSize(llround(pix_width * LLUI::sGLScaleFactor.mV[VX]),
|
||||
llround(pix_height * LLUI::sGLScaleFactor.mV[VY]));
|
||||
current_image->setKnownDrawSize(llround(pix_width * LLUI::getScaleFactor().mV[VX]),
|
||||
llround(pix_height * LLUI::getScaleFactor().mV[VY]));
|
||||
|
||||
if (!current_image->hasGLTexture()) //Still loading.
|
||||
{
|
||||
@@ -922,8 +922,8 @@ F32 LLWorldMapView::drawLegacySimTile(LLSimInfo& sim_info, S32 left, S32 top, S3
|
||||
if(sim_fetching || alpha >= ALPHA_CUTOFF)
|
||||
{
|
||||
S32 draw_size = llround(sMapScale);
|
||||
simimage->setKnownDrawSize( llround(draw_size * LLUI::sGLScaleFactor.mV[VX] * ((F32)sim_info.getSizeX() / REGION_WIDTH_METERS)),
|
||||
llround(draw_size * LLUI::sGLScaleFactor.mV[VY] * ((F32)sim_info.getSizeY() / REGION_WIDTH_METERS)));
|
||||
simimage->setKnownDrawSize( llround(draw_size * LLUI::getScaleFactor().mV[VX] * ((F32)sim_info.getSizeX() / REGION_WIDTH_METERS)),
|
||||
llround(draw_size * LLUI::getScaleFactor().mV[VY] * ((F32)sim_info.getSizeY() / REGION_WIDTH_METERS)));
|
||||
simimage->setBoostLevel(LLGLTexture::BOOST_MAP);
|
||||
if(alpha >= ALPHA_CUTOFF)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user