summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llagentcamera.cpp6
-rw-r--r--indra/newview/llfloatermodelpreview.cpp21
-rw-r--r--indra/newview/llfloatermodelpreview.h3
-rwxr-xr-xindra/newview/llmeshrepository.cpp21
-rw-r--r--indra/newview/llviewertexture.cpp19
-rw-r--r--indra/newview/llviewertexture.h3
6 files changed, 53 insertions, 20 deletions
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 80085dad9d..c30d3b9aa3 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -392,11 +392,9 @@ LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 origi
}
LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation
- LLVector3 object_extents;
+ LLVector3 object_extents = object->getScale();
const LLVector4a* oe4 = object->mDrawable->getSpatialExtents();
- LLVector4a size;
- size.setSub(oe4[1], oe4[0]);
- object_extents.set( size[0], size[1], size[2] );
+ object_extents.set( oe4[1][0], oe4[1][1], oe4[1][2] );
// make sure they object extents are non-zero
object_extents.clamp(0.001f, F32_MAX);
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 4e35029ce6..ab6753b4be 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -1121,7 +1121,7 @@ LLModelLoader::LLModelLoader( std::string filename, S32 lod, LLModelPreview* pre
std::deque<std::string>& jointsFromNodes )
: mJointList( jointMap )
, mJointsFromNode( jointsFromNodes )
-, LLThread("Model Loader"), mFilename(filename), mLod(lod), mPreview(preview), mFirstTransform(TRUE)
+, LLThread("Model Loader"), mFilename(filename), mLod(lod), mPreview(preview), mFirstTransform(TRUE), mNumOfFetchingTextures(0)
{
mJointMap["mPelvis"] = "mPelvis";
mJointMap["mTorso"] = "mTorso";
@@ -2274,7 +2274,8 @@ void LLModelLoader::loadTextures()
iter->second[i].mMaterial[j].mDiffuseMap =
LLViewerTextureManager::getFetchedTextureFromUrl("file://" + iter->second[i].mMaterial[j].mDiffuseMapFilename, TRUE, LLViewerTexture::BOOST_PREVIEW);
iter->second[i].mMaterial[j].mDiffuseMap->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, mPreview, NULL, FALSE);
- iter->second[i].mMaterial[j].mDiffuseMap->forceToSaveRawImage();
+ iter->second[i].mMaterial[j].mDiffuseMap->forceToSaveRawImage(0, F32_MAX);
+ mNumOfFetchingTextures++ ;
}
}
}
@@ -4154,6 +4155,14 @@ void LLModelPreview::updateStatusMessages()
}
}
+ if(upload_ok && mModelLoader)
+ {
+ if(!mModelLoader->areTexturesReady() && mFMP->childGetValue("upload_textures").asBoolean())
+ {
+ upload_ok = false ;
+ }
+ }
+
const BOOL confirmed_checkbox = mFMP->getChild<LLCheckBoxCtrl>("confirm_checkbox")->getValue().asBoolean();
if ( upload_ok && !errorStateFromLoader && skinAndRigOk && !has_degenerate && confirmed_checkbox)
{
@@ -5292,6 +5301,14 @@ void LLModelPreview::textureLoadedCallback( BOOL success, LLViewerFetchedTexture
{
LLModelPreview* preview = (LLModelPreview*) userdata;
preview->refresh();
+
+ if(final && preview->mModelLoader)
+ {
+ if(preview->mModelLoader->mNumOfFetchingTextures > 0)
+ {
+ preview->mModelLoader->mNumOfFetchingTextures-- ;
+ }
+ }
}
void LLModelPreview::onLODParamCommit(bool enforce_tri_limit)
diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h
index 8e7189e8c6..ccd6fef953 100644
--- a/indra/newview/llfloatermodelpreview.h
+++ b/indra/newview/llfloatermodelpreview.h
@@ -132,6 +132,9 @@ public:
JointTransformMap& mJointList;
std::deque<std::string>& mJointsFromNode;
+ S32 mNumOfFetchingTextures ; //updated in the main thread
+ bool areTexturesReady() { return !mNumOfFetchingTextures; } //called in the main thread.
+
private:
static std::list<LLModelLoader*> sActiveLoaderList;
static bool isAlive(LLModelLoader* loader) ;
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 083038acba..76079b2bf5 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1586,16 +1586,12 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
std::stringstream texture_str;
if (texture != NULL && include_textures && mUploadTextures)
{
- // Get binary rep of texture, if needed.
- LLTextureUploadData data(texture, material.mDiffuseMapLabel);
- if (!data.mTexture->isRawImageValid())
- {
- data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel());
+ if(texture->hasSavedRawImage())
+ {
+ LLPointer<LLImageJ2C> upload_file =
+ LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage());
+ texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize());
}
-
- LLPointer<LLImageJ2C> upload_file =
- LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage());
- texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize());
}
if (texture != NULL &&
@@ -2898,9 +2894,12 @@ void LLMeshUploadThread::doUploadTexture(LLTextureUploadData& data)
data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel());
}
- LLPointer<LLImageJ2C> upload_file = LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage());
+ if(data.mTexture->hasSavedRawImage())
+ {
+ LLPointer<LLImageJ2C> upload_file = LLViewerTextureList::convertToUploadFile(data.mTexture->getSavedRawImage());
- ostr.write((const char*) upload_file->getData(), upload_file->getDataSize());
+ ostr.write((const char*) upload_file->getData(), upload_file->getDataSize());
+ }
data.mAssetData = ostr.str();
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index af06421bf9..4da0f80a00 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1168,6 +1168,7 @@ void LLViewerFetchedTexture::init(bool firstinit)
mSavedRawDiscardLevel = -1 ;
mDesiredSavedRawDiscardLevel = -1 ;
mLastReferencedSavedRawImageTime = 0.0f ;
+ mKeptSavedRawImageTime = 0.f ;
mLastCallBackActiveTime = 0.f;
}
@@ -2696,8 +2697,16 @@ void LLViewerFetchedTexture::saveRawImage()
mLastReferencedSavedRawImageTime = sCurrentTime ;
}
-void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard)
+void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, F32 kept_time)
{
+ mKeptSavedRawImageTime = kept_time ;
+ mLastReferencedSavedRawImageTime = sCurrentTime ;
+
+ if(mSavedRawDiscardLevel > -1 && mSavedRawDiscardLevel <= desired_discard)
+ {
+ return ; //raw imge is ready.
+ }
+
if(!mForceToSaveRawImage || mDesiredSavedRawDiscardLevel < 0 || mDesiredSavedRawDiscardLevel > desired_discard)
{
mForceToSaveRawImage = TRUE ;
@@ -2713,11 +2722,16 @@ void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard)
mRawImage = NULL ;
mRawDiscardLevel = INVALID_DISCARD_LEVEL ;
- }
+ }
}
}
void LLViewerFetchedTexture::destroySavedRawImage()
{
+ if(mLastReferencedSavedRawImageTime < mKeptSavedRawImageTime)
+ {
+ return ; //keep the saved raw image.
+ }
+
mForceToSaveRawImage = FALSE ;
mSaveRawImage = FALSE ;
@@ -2729,6 +2743,7 @@ void LLViewerFetchedTexture::destroySavedRawImage()
mSavedRawDiscardLevel = -1 ;
mDesiredSavedRawDiscardLevel = -1 ;
mLastReferencedSavedRawImageTime = 0.0f ;
+ mKeptSavedRawImageTime = 0.f ;
}
LLImageRaw* LLViewerFetchedTexture::getSavedRawImage()
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index d512f8ec3a..c5b8c8923a 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -465,7 +465,7 @@ public:
S32 getCachedRawImageLevel() const {return mCachedRawDiscardLevel;}
BOOL isCachedRawImageReady() const {return mCachedRawImageReady ;}
BOOL isRawImageValid()const { return mIsRawImageValid ; }
- void forceToSaveRawImage(S32 desired_discard = 0) ;
+ void forceToSaveRawImage(S32 desired_discard = 0, F32 kept_time = 0.f) ;
/*virtual*/ void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ;
void destroySavedRawImage() ;
LLImageRaw* getSavedRawImage() ;
@@ -550,6 +550,7 @@ protected:
S32 mSavedRawDiscardLevel;
S32 mDesiredSavedRawDiscardLevel;
F32 mLastReferencedSavedRawImageTime ;
+ F32 mKeptSavedRawImageTime ;
//a small version of the copy of the raw image (<= 64 * 64)
LLPointer<LLImageRaw> mCachedRawImage;