summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/llviewertexture.cpp417
1 files changed, 145 insertions, 272 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index eb6c453e76..6cc9f4ace1 100644..100755
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -55,8 +55,6 @@
#include "llappviewer.h"
#include "llface.h"
#include "llviewercamera.h"
-#include "lltextureatlas.h"
-#include "lltextureatlasmanager.h"
#include "lltextureentry.h"
#include "lltexturemanagerbridge.h"
#include "llmediaentry.h"
@@ -73,6 +71,7 @@ LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sMissingAssetImagep =
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sWhiteImagep = NULL;
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sDefaultImagep = NULL;
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sSmokeImagep = NULL;
+LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sFlatNormalImagep = NULL;
LLViewerMediaTexture::media_map_t LLViewerMediaTexture::sMediaMap ;
LLTexturePipelineTester* LLViewerTextureManager::sTesterp = NULL ;
const std::string sTesterName("TextureTester");
@@ -98,7 +97,6 @@ S32 LLViewerTexture::sMinLargeImageSize = 65536 ; //256 * 256.
S32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA ;
BOOL LLViewerTexture::sFreezeImageScalingDown = FALSE ;
F32 LLViewerTexture::sCurrentTime = 0.0f ;
-BOOL LLViewerTexture::sUseTextureAtlas = FALSE ;
F32 LLViewerTexture::sTexelPixelRatio = 1.0f;
LLViewerTexture::EDebugTexels LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_OFF;
@@ -277,7 +275,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(
}
LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile(
- const std::string& filename,
+ const std::string& filename,
FTType f_type,
BOOL usemipmaps,
LLViewerTexture::EBoostLevel boost_priority,
@@ -290,7 +288,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile(
}
//static
-LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string& url,
+LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string& url,
FTType f_type,
BOOL usemipmaps,
LLViewerTexture::EBoostLevel boost_priority,
@@ -397,7 +395,7 @@ void LLViewerTextureManager::init()
LLViewerTexture::sCheckerBoardImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE);
LLViewerTexture::initClass() ;
-
+
// Create a texture manager bridge.
gTextureManagerBridgep = new LLViewerTextureManagerBridge;
@@ -425,6 +423,7 @@ void LLViewerTextureManager::cleanup()
LLViewerFetchedTexture::sSmokeImagep = NULL;
LLViewerFetchedTexture::sMissingAssetImagep = NULL;
LLViewerFetchedTexture::sWhiteImagep = NULL;
+ LLViewerFetchedTexture::sFlatNormalImagep = NULL;
LLViewerMediaTexture::cleanUpClass() ;
}
@@ -565,8 +564,7 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
}
}
sDesiredDiscardBias = llclamp(sDesiredDiscardBias, desired_discard_bias_min, desired_discard_bias_max);
- LLViewerTexture::sUseTextureAtlas = gSavedSettings.getBOOL("EnableTextureAtlas") ;
-
+
F32 camera_moving_speed = LLViewerCamera::getInstance()->getAverageSpeed() ;
F32 camera_angular_speed = LLViewerCamera::getInstance()->getAverageAngularSpeed();
sCameraMovingBias = llmax(0.2f * camera_moving_speed, 2.0f * camera_angular_speed - 1);
@@ -632,9 +630,14 @@ void LLViewerTexture::init(bool firstinit)
mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval ;
mAdditionalDecodePriority = 0.f ;
mParcelMedia = NULL ;
- mNumFaces = 0 ;
+
mNumVolumes = 0;
- mFaceList.clear() ;
+ mFaceList[LLRender::DIFFUSE_MAP].clear() ;
+ mFaceList[LLRender::NORMAL_MAP].clear() ;
+ mFaceList[LLRender::SPECULAR_MAP].clear() ;
+ mNumFaces[LLRender::DIFFUSE_MAP] =
+ mNumFaces[LLRender::NORMAL_MAP] =
+ mNumFaces[LLRender::SPECULAR_MAP] = 0 ;
mVolumeList.clear();
}
@@ -646,7 +649,9 @@ S8 LLViewerTexture::getType() const
void LLViewerTexture::cleanup()
{
- mFaceList.clear() ;
+ mFaceList[LLRender::DIFFUSE_MAP].clear() ;
+ mFaceList[LLRender::NORMAL_MAP].clear() ;
+ mFaceList[LLRender::SPECULAR_MAP].clear() ;
mVolumeList.clear();
}
@@ -762,38 +767,57 @@ void LLViewerTexture::setKnownDrawSize(S32 width, S32 height)
}
//virtual
-void LLViewerTexture::addFace(LLFace* facep)
+void LLViewerTexture::addFace(U32 ch, LLFace* facep)
{
- if(mNumFaces >= mFaceList.size())
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+
+ if(mNumFaces[ch] >= mFaceList[ch].size())
{
- mFaceList.resize(2 * mNumFaces + 1) ;
+ mFaceList[ch].resize(2 * mNumFaces[ch] + 1) ;
}
- mFaceList[mNumFaces] = facep ;
- facep->setIndexInTex(mNumFaces) ;
- mNumFaces++ ;
+ mFaceList[ch][mNumFaces[ch]] = facep ;
+ facep->setIndexInTex(ch, mNumFaces[ch]) ;
+ mNumFaces[ch]++ ;
mLastFaceListUpdateTimer.reset() ;
}
//virtual
-void LLViewerTexture::removeFace(LLFace* facep)
+void LLViewerTexture::removeFace(U32 ch, LLFace* facep)
{
- if(mNumFaces > 1)
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+
+ if(mNumFaces[ch] > 1)
{
- S32 index = facep->getIndexInTex() ;
- mFaceList[index] = mFaceList[--mNumFaces] ;
- mFaceList[index]->setIndexInTex(index) ;
+ S32 index = facep->getIndexInTex(ch) ;
+ llassert(index < mFaceList[ch].size());
+ llassert(index < mNumFaces[ch]);
+ mFaceList[ch][index] = mFaceList[ch][--mNumFaces[ch]] ;
+ mFaceList[ch][index]->setIndexInTex(ch, index) ;
}
else
{
- mFaceList.clear() ;
- mNumFaces = 0 ;
+ mFaceList[ch].clear() ;
+ mNumFaces[ch] = 0 ;
}
mLastFaceListUpdateTimer.reset() ;
}
-S32 LLViewerTexture::getNumFaces() const
+S32 LLViewerTexture::getTotalNumFaces() const
{
- return mNumFaces ;
+ S32 ret = 0;
+
+ for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
+ {
+ ret += mNumFaces[i];
+ }
+
+ return ret;
+}
+
+S32 LLViewerTexture::getNumFaces(U32 ch) const
+{
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+ return mNumFaces[ch];
}
@@ -816,6 +840,8 @@ void LLViewerTexture::removeVolume(LLVOVolume* volumep)
if(mNumVolumes > 1)
{
S32 index = volumep->getIndexInTex() ;
+ llassert(index < mVolumeList.size());
+ llassert(index < mNumVolumes);
mVolumeList[index] = mVolumeList[--mNumVolumes] ;
mVolumeList[index]->setIndexInTex(index) ;
}
@@ -837,18 +863,22 @@ void LLViewerTexture::reorganizeFaceList()
static const F32 MAX_WAIT_TIME = 20.f; // seconds
static const U32 MAX_EXTRA_BUFFER_SIZE = 4 ;
- if(mNumFaces + MAX_EXTRA_BUFFER_SIZE > mFaceList.size())
+ if(mLastFaceListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
{
- return ;
+ return;
}
- if(mLastFaceListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
+ for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
{
- return ;
+ if(mNumFaces[i] + MAX_EXTRA_BUFFER_SIZE > mFaceList[i].size())
+ {
+ return ;
+ }
+
+ mFaceList[i].erase(mFaceList[i].begin() + mNumFaces[i], mFaceList[i].end());
}
-
+
mLastFaceListUpdateTimer.reset() ;
- mFaceList.erase(mFaceList.begin() + mNumFaces, mFaceList.end());
}
void LLViewerTexture::reorganizeVolumeList()
@@ -1177,7 +1207,7 @@ void LLViewerFetchedTexture::destroyTexture()
{
return ;
}
-
+
//LL_DEBUGS("Avatar") << mID << llendl;
destroyGLTexture() ;
mFullyLoaded = FALSE ;
@@ -1194,9 +1224,14 @@ void LLViewerFetchedTexture::addToCreateTexture()
mGLTexturep->setComponents(mComponents) ;
force_update = true ;
- for(U32 i = 0 ; i < mNumFaces ; i++)
+ for (U32 j = 0; j < LLRender::NUM_TEXTURE_CHANNELS; ++j)
{
- mFaceList[i]->dirtyTexture() ;
+ llassert(mNumFaces[j] <= mFaceList[j].size());
+
+ for(U32 i = 0 ; i < mNumFaces[j]; i++)
+ {
+ mFaceList[j][i]->dirtyTexture() ;
+ }
}
//discard the cached raw image and the saved raw image
@@ -1340,11 +1375,8 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/)
return FALSE;
}
- if(!(res = insertToAtlas()))
- {
- res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel);
- resetFaceAtlas() ;
- }
+ res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel);
+
setActive() ;
if (!needsToSaveRawImage())
@@ -1633,28 +1665,32 @@ void LLViewerFetchedTexture::updateVirtualSize()
addTextureStats(0.f, FALSE) ;//reset
}
- for(U32 i = 0 ; i < mNumFaces ; i++)
- {
- LLFace* facep = mFaceList[i] ;
- if( facep )
- {
- LLDrawable* drawable = facep->getDrawable();
- if (drawable)
+ for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
+ {
+ llassert(mNumFaces[ch] <= mFaceList[ch].size());
+
+ for(U32 i = 0 ; i < mNumFaces[ch]; i++)
+ {
+ LLFace* facep = mFaceList[ch][i] ;
+ if( facep )
{
- if(drawable->isRecentlyVisible())
+ LLDrawable* drawable = facep->getDrawable();
+ if (drawable)
{
- if (getBoostLevel() == LLViewerTexture::BOOST_NONE &&
- drawable->getVObj() && drawable->getVObj()->isSelected())
+ if(drawable->isRecentlyVisible())
{
- setBoostLevel(LLViewerTexture::BOOST_SELECTED);
+ if (getBoostLevel() == LLViewerTexture::BOOST_NONE &&
+ drawable->getVObj() && drawable->getVObj()->isSelected())
+ {
+ setBoostLevel(LLViewerTexture::BOOST_SELECTED);
+ }
+ addTextureStats(facep->getVirtualSize()) ;
+ setAdditionalDecodePriority(facep->getImportanceToCamera()) ;
}
- addTextureStats(facep->getVirtualSize()) ;
- setAdditionalDecodePriority(facep->getImportanceToCamera()) ;
}
}
}
}
-
//reset whether or not a face was selected after 10 seconds
const F32 SELECTION_RESET_TIME = 10.f;
@@ -2739,190 +2775,6 @@ F32 LLViewerFetchedTexture::getElapsedLastReferencedSavedRawImageTime() const
{
return sCurrentTime - mLastReferencedSavedRawImageTime ;
}
-//----------------------------------------------------------------------------------------------
-//atlasing
-//----------------------------------------------------------------------------------------------
-void LLViewerFetchedTexture::resetFaceAtlas()
-{
- //Nothing should be done here.
-}
-
-//invalidate all atlas slots for this image.
-void LLViewerFetchedTexture::invalidateAtlas(BOOL rebuild_geom)
-{
- for(U32 i = 0 ; i < mNumFaces ; i++)
- {
- LLFace* facep = mFaceList[i] ;
- facep->removeAtlas() ;
- if(rebuild_geom && facep->getDrawable() && facep->getDrawable()->getSpatialGroup())
- {
- facep->getDrawable()->getSpatialGroup()->setState(LLSpatialGroup::GEOM_DIRTY);
- }
- }
-}
-
-BOOL LLViewerFetchedTexture::insertToAtlas()
-{
- if(!LLViewerTexture::sUseTextureAtlas)
- {
- return FALSE ;
- }
- if(getNumFaces() < 1)
- {
- return FALSE ;
- }
- if(mGLTexturep->getDiscardLevelInAtlas() > 0 && mRawDiscardLevel >= mGLTexturep->getDiscardLevelInAtlas())
- {
- return FALSE ;
- }
- if(!LLTextureAtlasManager::getInstance()->canAddToAtlas(mRawImage->getWidth(), mRawImage->getHeight(), mRawImage->getComponents(), mGLTexturep->getTexTarget()))
- {
- return FALSE ;
- }
-
- BOOL ret = TRUE ;//if ret is set to false, will generate a gl texture for this image.
- S32 raw_w = mRawImage->getWidth() ;
- S32 raw_h = mRawImage->getHeight() ;
- F32 xscale = 1.0f, yscale = 1.0f ;
- LLPointer<LLTextureAtlasSlot> slot_infop;
- LLTextureAtlasSlot* cur_slotp ;//no need to be smart pointer.
- LLSpatialGroup* groupp ;
- LLFace* facep;
-
- //if the atlas slot pointers for some faces are null, process them later.
- ll_face_list_t waiting_list ;
- for(U32 i = 0 ; i < mNumFaces ; i++)
- {
- {
- facep = mFaceList[i] ;
-
- //face can not use atlas.
- if(!facep->canUseAtlas())
- {
- if(facep->getAtlasInfo())
- {
- facep->removeAtlas() ;
- }
- ret = FALSE ;
- continue ;
- }
-
- //the atlas slot is updated
- slot_infop = facep->getAtlasInfo() ;
- groupp = facep->getDrawable()->getSpatialGroup() ;
-
- if(slot_infop)
- {
- if(slot_infop->getSpatialGroup() != groupp)
- {
- if((cur_slotp = groupp->getCurUpdatingSlot(this))) //switch slot
- {
- facep->setAtlasInfo(cur_slotp) ;
- facep->setAtlasInUse(TRUE) ;
- continue ;
- }
- else //do not forget to update slot_infop->getSpatialGroup().
- {
- LLSpatialGroup* gp = slot_infop->getSpatialGroup() ;
- gp->setCurUpdatingTime(gFrameCount) ;
- gp->setCurUpdatingTexture(this) ;
- gp->setCurUpdatingSlot(slot_infop) ;
- }
- }
- else //same group
- {
- if(gFrameCount && slot_infop->getUpdatedTime() == gFrameCount)//slot is just updated
- {
- facep->setAtlasInUse(TRUE) ;
- continue ;
- }
- }
- }
- else
- {
- //if the slot is null, wait to process them later.
- waiting_list.push_back(facep) ;
- continue ;
- }
-
- //----------
- //insert to atlas
- if(!slot_infop->getAtlas()->insertSubTexture(mGLTexturep, mRawDiscardLevel, mRawImage, slot_infop->getSlotCol(), slot_infop->getSlotRow()))
- {
-
- //the texture does not qualify to add to atlas, do not bother to try for other faces.
- //invalidateAtlas();
- return FALSE ;
- }
-
- //update texture scale
- slot_infop->getAtlas()->getTexCoordScale(raw_w, raw_h, xscale, yscale) ;
- slot_infop->setTexCoordScale(xscale, yscale) ;
- slot_infop->setValid() ;
- slot_infop->setUpdatedTime(gFrameCount) ;
-
- //update spatial group atlas info
- groupp->setCurUpdatingTime(gFrameCount) ;
- groupp->setCurUpdatingTexture(this) ;
- groupp->setCurUpdatingSlot(slot_infop) ;
-
- //make the face to switch to the atlas.
- facep->setAtlasInUse(TRUE) ;
- }
- }
-
- //process the waiting_list
- for(std::vector<LLFace*>::iterator iter = waiting_list.begin(); iter != waiting_list.end(); ++iter)
- {
- facep = (LLFace*)*iter ;
- groupp = facep->getDrawable()->getSpatialGroup() ;
-
- //check if this texture already inserted to atlas for this group
- if((cur_slotp = groupp->getCurUpdatingSlot(this)))
- {
- facep->setAtlasInfo(cur_slotp) ;
- facep->setAtlasInUse(TRUE) ;
- continue ;
- }
-
- //need to reserve a slot from atlas
- slot_infop = LLTextureAtlasManager::getInstance()->reserveAtlasSlot(llmax(mFullWidth, mFullHeight), getComponents(), groupp, this) ;
-
- facep->setAtlasInfo(slot_infop) ;
-
- groupp->setCurUpdatingTime(gFrameCount) ;
- groupp->setCurUpdatingTexture(this) ;
- groupp->setCurUpdatingSlot(slot_infop) ;
-
- //slot allocation failed.
- if(!slot_infop || !slot_infop->getAtlas())
- {
- ret = FALSE ;
- facep->setAtlasInUse(FALSE) ;
- continue ;
- }
-
- //insert to atlas
- if(!slot_infop->getAtlas()->insertSubTexture(mGLTexturep, mRawDiscardLevel, mRawImage, slot_infop->getSlotCol(), slot_infop->getSlotRow()))
- {
- //the texture does not qualify to add to atlas, do not bother to try for other faces.
- ret = FALSE ;
- //invalidateAtlas();
- break ;
- }
-
- //update texture scale
- slot_infop->getAtlas()->getTexCoordScale(raw_w, raw_h, xscale, yscale) ;
- slot_infop->setTexCoordScale(xscale, yscale) ;
- slot_infop->setValid() ;
- slot_infop->setUpdatedTime(gFrameCount) ;
-
- //make the face to switch to the atlas.
- facep->setAtlasInUse(TRUE) ;
- }
-
- return ret ;
-}
//----------------------------------------------------------------------------------------------
//end of LLViewerFetchedTexture
@@ -3269,11 +3121,14 @@ BOOL LLViewerMediaTexture::findFaces()
LLViewerTexture* tex = gTextureList.findImage(mID) ;
if(tex) //this media is a parcel media for tex.
{
- const ll_face_list_t* face_list = tex->getFaceList() ;
- U32 end = tex->getNumFaces() ;
- for(U32 i = 0 ; i < end ; i++)
+ for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
{
- mMediaFaceList.push_back((*face_list)[i]) ;
+ const ll_face_list_t* face_list = tex->getFaceList(ch) ;
+ U32 end = tex->getNumFaces(ch) ;
+ for(U32 i = 0 ; i < end ; i++)
+ {
+ mMediaFaceList.push_back((*face_list)[i]) ;
+ }
}
}
@@ -3338,7 +3193,7 @@ void LLViewerMediaTexture::addMediaToFace(LLFace* facep)
return ; //no need to add the face because the media is not in playing.
}
- switchTexture(facep) ;
+ switchTexture(LLRender::DIFFUSE_MAP, facep) ;
}
void LLViewerMediaTexture::removeMediaFromFace(LLFace* facep)
@@ -3355,19 +3210,19 @@ void LLViewerMediaTexture::removeMediaFromFace(LLFace* facep)
}
mIsPlaying = FALSE ; //set to remove the media from the face.
- switchTexture(facep) ;
+ switchTexture(LLRender::DIFFUSE_MAP, facep) ;
mIsPlaying = TRUE ; //set the flag back.
- if(getNumFaces() < 1) //no face referencing to this media
+ if(getTotalNumFaces() < 1) //no face referencing to this media
{
stopPlaying() ;
}
}
//virtual
-void LLViewerMediaTexture::addFace(LLFace* facep)
+void LLViewerMediaTexture::addFace(U32 ch, LLFace* facep)
{
- LLViewerTexture::addFace(facep) ;
+ LLViewerTexture::addFace(ch, facep) ;
const LLTextureEntry* te = facep->getTextureEntry() ;
if(te && te->getID().notNull())
@@ -3394,9 +3249,9 @@ void LLViewerMediaTexture::addFace(LLFace* facep)
}
//virtual
-void LLViewerMediaTexture::removeFace(LLFace* facep)
+void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep)
{
- LLViewerTexture::removeFace(facep) ;
+ LLViewerTexture::removeFace(ch, facep) ;
const LLTextureEntry* te = facep->getTextureEntry() ;
if(te && te->getID().notNull())
@@ -3414,24 +3269,35 @@ void LLViewerMediaTexture::removeFace(LLFace* facep)
}
}
- //
- //we have some trouble here: the texture of the face is changed.
- //we need to find the former texture, and remove it from the list to avoid memory leaking.
- if(!mNumFaces)
+ std::vector<const LLTextureEntry*> te_list;
+
+ for (U32 ch = 0; ch < 3; ++ch)
{
- mTextureList.clear() ;
- return ;
+ //
+ //we have some trouble here: the texture of the face is changed.
+ //we need to find the former texture, and remove it from the list to avoid memory leaking.
+
+ llassert(mNumFaces[ch] <= mFaceList[ch].size());
+
+ for(U32 j = 0 ; j < mNumFaces[ch] ; j++)
+ {
+ te_list.push_back(mFaceList[ch][j]->getTextureEntry());//all textures are in use.
+ }
}
- S32 end = getNumFaces() ;
- std::vector<const LLTextureEntry*> te_list(end) ;
- S32 i = 0 ;
- for(U32 j = 0 ; j < mNumFaces ; j++)
+
+ if (te_list.empty())
{
- te_list[i++] = mFaceList[j]->getTextureEntry() ;//all textures are in use.
+ mTextureList.clear() ;
+ return ;
}
+
+ S32 end = te_list.size();
+
for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin();
iter != mTextureList.end(); ++iter)
{
+ S32 i = 0;
+
for(i = 0 ; i < end ; i++)
{
if(te_list[i] && te_list[i]->getID() == (*iter)->getID())//the texture is in use.
@@ -3476,7 +3342,7 @@ void LLViewerMediaTexture::stopPlaying()
mIsPlaying = FALSE ;
}
-void LLViewerMediaTexture::switchTexture(LLFace* facep)
+void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep)
{
if(facep)
{
@@ -3492,7 +3358,7 @@ void LLViewerMediaTexture::switchTexture(LLFace* facep)
if(mIsPlaying) //old textures switch to the media texture
{
- facep->switchTexture(this) ;
+ facep->switchTexture(ch, this) ;
}
else //switch to old textures.
{
@@ -3508,7 +3374,7 @@ void LLViewerMediaTexture::switchTexture(LLFace* facep)
{
tex = LLViewerFetchedTexture::sDefaultImagep ;
}
- facep->switchTexture(tex) ;
+ facep->switchTexture(ch, tex) ;
}
}
}
@@ -3547,14 +3413,17 @@ void LLViewerMediaTexture::setPlaying(BOOL playing)
for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter)
{
- switchTexture(*iter) ;
+ switchTexture(LLRender::DIFFUSE_MAP, *iter) ;
}
}
else //stop playing this media
{
- for(U32 i = mNumFaces ; i ; i--)
+ U32 ch = LLRender::DIFFUSE_MAP;
+
+ llassert(mNumFaces[ch] <= mFaceList[ch].size());
+ for(U32 i = mNumFaces[ch] ; i ; i--)
{
- switchTexture(mFaceList[i - 1]) ; //current face could be removed in this function.
+ switchTexture(ch, mFaceList[ch][i - 1]) ; //current face could be removed in this function.
}
}
return ;
@@ -3576,14 +3445,18 @@ F32 LLViewerMediaTexture::getMaxVirtualSize()
if(mIsPlaying) //media is playing
{
- for(U32 i = 0 ; i < mNumFaces ; i++)
+ for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
{
- LLFace* facep = mFaceList[i] ;
- if(facep->getDrawable()->isRecentlyVisible())
+ llassert(mNumFaces[ch] <= mFaceList[ch].size());
+ for(U32 i = 0 ; i < mNumFaces[ch] ; i++)
{
- addTextureStats(facep->getVirtualSize()) ;
- }
- }
+ LLFace* facep = mFaceList[ch][i] ;
+ if(facep->getDrawable()->isRecentlyVisible())
+ {
+ addTextureStats(facep->getVirtualSize()) ;
+ }
+ }
+ }
}
else //media is not in playing
{