Merge branch 'master' of git://github.com/siana/SingularityViewer.git
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted, provided that
|
||||
the above copyright notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting documentation, and that
|
||||
the name of M.I.T. not be used in advertising or publicity pertaining to
|
||||
distribution of the software without specific, written prior permission.
|
||||
M.I.T. makes no representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied warranty.
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 1996 - 2010, Daniel Stenberg, <daniel@haxx.se>.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright
|
||||
notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||
OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization of the copyright holder.
|
||||
@@ -43,6 +43,8 @@ if (WINDOWS)
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2
|
||||
"${CMAKE_C_FLAGS_RELEASESSE2} ${LL_C_FLAGS} /O2 /Zi /MD /MP /arch:SSE2 /fp:fast"
|
||||
CACHE STRING "C compiler release-SSE2 options" FORCE)
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LARGEADDRESSAWARE")
|
||||
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "")
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "")
|
||||
@@ -99,6 +101,7 @@ if (WINDOWS)
|
||||
|
||||
endif (WINDOWS)
|
||||
|
||||
set (GCC_EXTRA_OPTIMIZATION "-ffast-math -frounding-math")
|
||||
|
||||
if (LINUX)
|
||||
set(CMAKE_SKIP_RPATH TRUE)
|
||||
@@ -193,8 +196,8 @@ if (LINUX)
|
||||
# this stops us requiring a really recent glibc at runtime
|
||||
add_definitions(-fno-stack-protector)
|
||||
endif (NOT STANDALONE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "${CMAKE_CXX_FLAGS_RELEASESSE2} -march=pentium4 -mfpmath=sse -msse2")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "${CMAKE_C_FLAGS_RELEASESSE2} -march=pentium4 -mfpmath=sse -msse2")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "${CMAKE_CXX_FLAGS_RELEASESSE2} -march=pentium4 -mfpmath=sse -msse2 ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "${CMAKE_C_FLAGS_RELEASESSE2} -march=pentium4 -mfpmath=sse -msse2 "${GCC_EXTRA_OPTIMIZATIONS})
|
||||
endif (VIEWER)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
@@ -214,8 +217,8 @@ if (DARWIN)
|
||||
# NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered.
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "-O3 -msse2 -mfpmath=sse ${CMAKE_CXX_FLAGS_RELEASESSE2}")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "-03 -msse2 -mfpmath=sse ${CMAKE_C_FLAGS_RELEASESSE2}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASESSE2 "${CMAKE_CXX_FLAGS_RELEASESSE2} -O3 -msse2 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
set(CMAKE_C_FLAGS_RELEASESSE2 "${CMAKE_C_FLAGS_RELEASESSE2} -03 -msse2 -mtune=generic -mfpmath=sse ${GCC_EXTRA_OPTIMIZATIONS}")
|
||||
endif (DARWIN)
|
||||
|
||||
|
||||
|
||||
@@ -56,8 +56,6 @@ LLPngWrapper::LLPngWrapper()
|
||||
mCompressionType( 0 ),
|
||||
mFilterMethod( 0 ),
|
||||
mFinalSize( 0 ),
|
||||
mHasBKGD(false),
|
||||
mBackgroundColor(),
|
||||
mGamma(0.f)
|
||||
{
|
||||
}
|
||||
@@ -117,9 +115,9 @@ void LLPngWrapper::writeFlush(png_structp png_ptr)
|
||||
}
|
||||
|
||||
// Read the PNG file using the libpng. The low-level interface is used here
|
||||
// because we want to do various transformations (including setting the
|
||||
// matte background if any, and applying gama) which can't be done with
|
||||
// the high-level interface. The scanline also begins at the bottom of
|
||||
// because we want to do various transformations (including applying gama)
|
||||
// which can't be done with the high-level interface.
|
||||
// The scanline also begins at the bottom of
|
||||
// the image (per SecondLife conventions) instead of at the top, so we
|
||||
// must assign row-pointers in "reverse" order.
|
||||
BOOL LLPngWrapper::readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop)
|
||||
@@ -207,8 +205,7 @@ void LLPngWrapper::normalizeImage()
|
||||
// 2. Convert grayscales to RGB
|
||||
// 3. Create alpha layer from transparency
|
||||
// 4. Ensure 8-bpp for all images
|
||||
// 5. Apply background matte if any
|
||||
// 6. Set (or guess) gamma
|
||||
// 5. Set (or guess) gamma
|
||||
|
||||
if (mColorType == PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
@@ -235,12 +232,6 @@ void LLPngWrapper::normalizeImage()
|
||||
{
|
||||
png_set_strip_16(mReadPngPtr);
|
||||
}
|
||||
mHasBKGD = png_get_bKGD(mReadPngPtr, mReadInfoPtr, &mBackgroundColor);
|
||||
if (mHasBKGD)
|
||||
{
|
||||
png_set_background(mReadPngPtr, mBackgroundColor,
|
||||
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
|
||||
}
|
||||
|
||||
#if LL_DARWIN
|
||||
const F64 SCREEN_GAMMA = 1.8;
|
||||
@@ -267,7 +258,6 @@ void LLPngWrapper::updateMetaData()
|
||||
mBitDepth = png_get_bit_depth(mReadPngPtr, mReadInfoPtr);
|
||||
mColorType = png_get_color_type(mReadPngPtr, mReadInfoPtr);
|
||||
mChannels = png_get_channels(mReadPngPtr, mReadInfoPtr);
|
||||
mHasBKGD = png_get_bKGD(mReadPngPtr, mReadInfoPtr, &mBackgroundColor);
|
||||
}
|
||||
|
||||
// Method to write raw image into PNG at dest. The raw scanline begins
|
||||
|
||||
@@ -94,9 +94,6 @@ private:
|
||||
|
||||
U32 mFinalSize;
|
||||
|
||||
bool mHasBKGD;
|
||||
png_color_16p mBackgroundColor;
|
||||
|
||||
F64 mGamma;
|
||||
|
||||
std::string mErrorMessage;
|
||||
|
||||
@@ -106,6 +106,9 @@ public:
|
||||
F32 getVirtualSize() const { return mVSize; }
|
||||
F32 getPixelArea() const { return mPixelArea; }
|
||||
|
||||
S32 getIndexInTex() const {return mIndexInTex ;}
|
||||
void setIndexInTex(S32 index) { mIndexInTex = index ;}
|
||||
|
||||
void renderSetColor() const;
|
||||
S32 renderElements(const U16 *index_array) const;
|
||||
S32 renderIndexed ();
|
||||
@@ -226,6 +229,7 @@ private:
|
||||
U16 mGeomIndex; // index into draw pool
|
||||
U32 mIndicesCount;
|
||||
U32 mIndicesIndex; // index into draw pool for indices (yeah, I know!)
|
||||
S32 mIndexInTex ;
|
||||
|
||||
//previous rebuild's geometry info
|
||||
U16 mLastGeomCount;
|
||||
|
||||
@@ -1249,7 +1249,24 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOADFEE]", fee);
|
||||
|
||||
LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio");
|
||||
snapshot_type_radio->setSelectedIndex(gSavedSettings.getS32("LastSnapshotType"));
|
||||
if (snapshot_type_radio)
|
||||
{
|
||||
snapshot_type_radio->setSelectedIndex(gSavedSettings.getS32("LastSnapshotType"));
|
||||
|
||||
const child_list_t *childs = snapshot_type_radio->getChildList();
|
||||
if (childs)
|
||||
{
|
||||
child_list_t::const_iterator it, end=childs->end();
|
||||
for (it=childs->begin(); it!=end; ++it)
|
||||
{
|
||||
LLRadioCtrl *ctrl = dynamic_cast<LLRadioCtrl*>(*it);
|
||||
if (ctrl && (ctrl->getName() == "texture"))
|
||||
{
|
||||
ctrl->setLabelArg("[UPLOADFEE]", fee);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LLSnapshotLivePreview::ESnapshotType shot_type = getTypeIndex(floater);
|
||||
ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); //getFormatIndex(floater); LLViewerWindow::ESnapshotType layer_type = getLayerType(floater);
|
||||
LLViewerWindow::ESnapshotType layer_type = getLayerType(floater);
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include "llappviewer.h"
|
||||
#include "llface.h"
|
||||
#include "llviewercamera.h"
|
||||
#include "llvovolume.h"
|
||||
|
||||
// <edit>
|
||||
#include "llimagemetadatareader.h"
|
||||
@@ -357,6 +358,11 @@ void LLViewerImage::init(bool firstinit)
|
||||
mDesiredSavedRawDiscardLevel = -1 ;
|
||||
|
||||
mCanUseHTTP = true; //default on if cap/settings allows us
|
||||
|
||||
mNumFaces = 0 ;
|
||||
mNumVolumes = 0;
|
||||
mFaceList.clear() ;
|
||||
mVolumeList.clear();
|
||||
}
|
||||
|
||||
// virtual
|
||||
@@ -393,6 +399,7 @@ LLViewerImage::~LLViewerImage()
|
||||
void LLViewerImage::cleanup()
|
||||
{
|
||||
mFaceList.clear() ;
|
||||
mVolumeList.clear();
|
||||
for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
|
||||
iter != mLoadedCallbackList.end(); )
|
||||
{
|
||||
@@ -753,19 +760,19 @@ void LLViewerImage::updateVirtualSize()
|
||||
{
|
||||
addTextureStats(0.f, FALSE) ;//reset
|
||||
}
|
||||
if(mFaceList.size() > 0)
|
||||
for(U32 i = 0 ; i < mNumFaces ; i++)
|
||||
{
|
||||
for(std::list<LLFace*>::iterator iter = mFaceList.begin(); iter != mFaceList.end(); ++iter)
|
||||
LLFace* facep = mFaceList[i] ;
|
||||
if(facep->getDrawable()->isRecentlyVisible())
|
||||
{
|
||||
LLFace* facep = *iter ;
|
||||
if(facep->getDrawable()->isRecentlyVisible())
|
||||
{
|
||||
addTextureStats(facep->getVirtualSize()) ;
|
||||
setAdditionalDecodePriority(facep->getImportanceToCamera()) ;
|
||||
}
|
||||
}
|
||||
addTextureStats(facep->getVirtualSize()) ;
|
||||
setAdditionalDecodePriority(facep->getImportanceToCamera()) ;
|
||||
}
|
||||
}
|
||||
|
||||
mNeedsResetMaxVirtualSize = TRUE ;
|
||||
reorganizeFaceList();
|
||||
reorganizeVolumeList();
|
||||
#endif
|
||||
}
|
||||
void LLViewerImage::scaleDown()
|
||||
@@ -1755,13 +1762,19 @@ void LLViewerImage::setCachedRawImage()
|
||||
if(mForSculpt)
|
||||
{
|
||||
max_size = MAX_CACHED_RAW_SCULPT_IMAGE_AREA ;
|
||||
// Even though we don't use the full pixel size, we want to decode up to discard 0,
|
||||
// because some legacy sculpts are weird like that.
|
||||
mCachedRawImageReady = !mRawDiscardLevel ;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCachedRawImageReady = (!mRawDiscardLevel || ((w * h) >= max_size)) ;
|
||||
}
|
||||
|
||||
while(((w >> i) * (h >> i)) > max_size)
|
||||
{
|
||||
++i ;
|
||||
}
|
||||
mCachedRawImageReady = (!mRawDiscardLevel || ((w * h) >= max_size)) ;
|
||||
|
||||
if(i)
|
||||
{
|
||||
@@ -1772,7 +1785,8 @@ void LLViewerImage::setCachedRawImage()
|
||||
mRawImage->scale(w >> i, h >> i) ;
|
||||
}
|
||||
mCachedRawImage = mRawImage ;
|
||||
mCachedRawDiscardLevel = mRawDiscardLevel + i ;
|
||||
mRawDiscardLevel += i ;
|
||||
mCachedRawDiscardLevel = mRawDiscardLevel ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1780,7 +1794,7 @@ void LLViewerImage::checkCachedRawSculptImage()
|
||||
{
|
||||
if(mCachedRawImageReady && mCachedRawDiscardLevel > 0)
|
||||
{
|
||||
if(mCachedRawImage->getWidth() * mCachedRawImage->getHeight() < MAX_CACHED_RAW_SCULPT_IMAGE_AREA)
|
||||
if(getDiscardLevel() != 0)
|
||||
{
|
||||
mCachedRawImageReady = FALSE ;
|
||||
}
|
||||
@@ -1806,11 +1820,111 @@ void LLViewerImage::setForSculpt()
|
||||
checkCachedRawSculptImage() ;
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLViewerImage::addFace(LLFace* facep)
|
||||
{
|
||||
mFaceList.push_back(facep) ;
|
||||
if(mNumFaces >= mFaceList.size())
|
||||
{
|
||||
mFaceList.resize(2 * mNumFaces + 1) ;
|
||||
}
|
||||
mFaceList[mNumFaces] = facep ;
|
||||
facep->setIndexInTex(mNumFaces) ;
|
||||
mNumFaces++ ;
|
||||
mLastFaceListUpdateTimer.reset() ;
|
||||
}
|
||||
void LLViewerImage::removeFace(LLFace* facep)
|
||||
|
||||
//virtual
|
||||
void LLViewerImage::removeFace(LLFace* facep)
|
||||
{
|
||||
mFaceList.remove(facep) ;
|
||||
if(mNumFaces > 1)
|
||||
{
|
||||
S32 index = facep->getIndexInTex() ;
|
||||
mFaceList[index] = mFaceList[--mNumFaces] ;
|
||||
mFaceList[index]->setIndexInTex(index) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
mFaceList.clear() ;
|
||||
mNumFaces = 0 ;
|
||||
}
|
||||
mLastFaceListUpdateTimer.reset() ;
|
||||
}
|
||||
|
||||
S32 LLViewerImage::getNumFaces() const
|
||||
{
|
||||
return mNumFaces ;
|
||||
}
|
||||
|
||||
|
||||
//virtual
|
||||
void LLViewerImage::addVolume(LLVOVolume* volumep)
|
||||
{
|
||||
if( mNumVolumes >= mVolumeList.size())
|
||||
{
|
||||
mVolumeList.resize(2 * mNumVolumes + 1) ;
|
||||
}
|
||||
mVolumeList[mNumVolumes] = volumep ;
|
||||
volumep->setIndexInTex(mNumVolumes) ;
|
||||
mNumVolumes++ ;
|
||||
mLastVolumeListUpdateTimer.reset() ;
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLViewerImage::removeVolume(LLVOVolume* volumep)
|
||||
{
|
||||
if(mNumVolumes > 1)
|
||||
{
|
||||
S32 index = volumep->getIndexInTex() ;
|
||||
mVolumeList[index] = mVolumeList[--mNumVolumes] ;
|
||||
mVolumeList[index]->setIndexInTex(index) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
mVolumeList.clear() ;
|
||||
mNumVolumes = 0 ;
|
||||
}
|
||||
mLastVolumeListUpdateTimer.reset() ;
|
||||
}
|
||||
|
||||
S32 LLViewerImage::getNumVolumes() const
|
||||
{
|
||||
return mNumVolumes ;
|
||||
}
|
||||
|
||||
void LLViewerImage::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())
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
if(mLastFaceListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
mLastFaceListUpdateTimer.reset() ;
|
||||
mFaceList.erase(mFaceList.begin() + mNumFaces, mFaceList.end());
|
||||
}
|
||||
|
||||
void LLViewerImage::reorganizeVolumeList()
|
||||
{
|
||||
static const F32 MAX_WAIT_TIME = 20.f; // seconds
|
||||
static const U32 MAX_EXTRA_BUFFER_SIZE = 4 ;
|
||||
|
||||
if(mNumVolumes + MAX_EXTRA_BUFFER_SIZE > mVolumeList.size())
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
if(mLastVolumeListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
mLastVolumeListUpdateTimer.reset() ;
|
||||
mVolumeList.erase(mVolumeList.begin() + mNumVolumes, mVolumeList.end());
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ typedef void (*loaded_callback_func)( BOOL success, LLViewerImage *src_vi, LLIma
|
||||
|
||||
class LLVFile;
|
||||
class LLMessageSystem;
|
||||
class LLVOVolume;
|
||||
|
||||
class LLLoadedCallbackEntry
|
||||
{
|
||||
@@ -209,6 +210,9 @@ public:
|
||||
INVALID_DISCARD_LEVEL = 0x7fff
|
||||
};
|
||||
|
||||
typedef std::vector<LLFace*> ll_face_list_t;
|
||||
typedef std::vector<LLVOVolume*> ll_volume_list_t;
|
||||
|
||||
protected:
|
||||
/*virtual*/ ~LLViewerImage();
|
||||
|
||||
@@ -317,8 +321,17 @@ public:
|
||||
|
||||
BOOL isSameTexture(const LLViewerImage* tex) const ;
|
||||
|
||||
void addFace(LLFace* facep) ;
|
||||
void removeFace(LLFace* facep) ;
|
||||
virtual void addFace(LLFace* facep) ;
|
||||
virtual void removeFace(LLFace* facep) ;
|
||||
S32 getNumFaces() const;
|
||||
const ll_face_list_t* getFaceList() const {return &mFaceList;}
|
||||
void reorganizeFaceList() ;
|
||||
|
||||
virtual void addVolume(LLVOVolume* volumep);
|
||||
virtual void removeVolume(LLVOVolume* volumep);
|
||||
S32 getNumVolumes() const;
|
||||
const ll_volume_list_t* getVolumeList() const { return &mVolumeList; }
|
||||
void reorganizeVolumeList() ;
|
||||
|
||||
void setCanUseHTTP(bool can_use_http) {mCanUseHTTP = can_use_http;};
|
||||
|
||||
@@ -424,8 +437,13 @@ private:
|
||||
BOOL mForSculpt ; //a flag if the texture is used for a sculpt data.
|
||||
mutable BOOL mNeedsResetMaxVirtualSize ;
|
||||
|
||||
typedef std::list<LLFace*> ll_face_list_t ;
|
||||
ll_face_list_t mFaceList ; //reverse pointer pointing to the faces using this image as texture
|
||||
ll_face_list_t mFaceList ; //reverse pointer pointing to the faces using this image as texture
|
||||
U32 mNumFaces ;
|
||||
LLFrameTimer mLastFaceListUpdateTimer ;
|
||||
|
||||
ll_volume_list_t mVolumeList;
|
||||
U32 mNumVolumes;
|
||||
LLFrameTimer mLastVolumeListUpdateTimer;
|
||||
|
||||
bool mCanUseHTTP; // can this image be fetched by http
|
||||
|
||||
|
||||
@@ -88,12 +88,12 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re
|
||||
mRelativeXformInvTrans.setIdentity();
|
||||
|
||||
mLOD = MIN_LOD;
|
||||
mSculptLevel = -2;
|
||||
mTextureAnimp = NULL;
|
||||
mVObjRadius = LLVector3(1,1,0.5f).length();
|
||||
mNumFaces = 0;
|
||||
mLODChanged = FALSE;
|
||||
mSculptChanged = FALSE;
|
||||
mIndexInTex = 0;
|
||||
}
|
||||
|
||||
LLVOVolume::~LLVOVolume()
|
||||
@@ -513,9 +513,8 @@ void LLVOVolume::updateTextureVirtualSize()
|
||||
|
||||
if (isSculpted())
|
||||
{
|
||||
LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
|
||||
LLUUID id = sculpt_params->getSculptTexture();
|
||||
mSculptTexture = gImageList.getImage(id);
|
||||
updateSculptTexture();
|
||||
|
||||
if (mSculptTexture.notNull())
|
||||
{
|
||||
mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(),
|
||||
@@ -538,8 +537,8 @@ void LLVOVolume::updateTextureVirtualSize()
|
||||
}
|
||||
}
|
||||
|
||||
S32 texture_discard = mSculptTexture->getCachedRawImageLevel(); //try to match the texture
|
||||
S32 current_discard = mSculptLevel;
|
||||
S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture
|
||||
S32 current_discard = getVolume() ? getVolume()->getSculptLevel() : -2 ;
|
||||
|
||||
if (texture_discard >= 0 && //texture has some data available
|
||||
(texture_discard < current_discard || //texture has more data than last rebuild
|
||||
@@ -692,25 +691,52 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &volume_params, const S32 detail
|
||||
mVolumeImpl->onSetVolume(volume_params, detail);
|
||||
}
|
||||
|
||||
updateSculptTexture();
|
||||
|
||||
if (isSculpted())
|
||||
{
|
||||
mSculptTexture = gImageList.getImage(volume_params.getSculptID());
|
||||
if (mSculptTexture.notNull())
|
||||
{
|
||||
sculpt();
|
||||
mSculptLevel = getVolume()->getSculptLevel();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mSculptTexture = NULL;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLVOVolume::updateSculptTexture()
|
||||
{
|
||||
LLPointer<LLViewerImage> old_sculpt = mSculptTexture;
|
||||
|
||||
if (isSculpted())
|
||||
{
|
||||
LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
|
||||
LLUUID id = sculpt_params->getSculptTexture();
|
||||
if (id.notNull())
|
||||
{
|
||||
mSculptTexture = gImageList.getImage(id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mSculptTexture = NULL;
|
||||
}
|
||||
|
||||
if (mSculptTexture != old_sculpt)
|
||||
{
|
||||
if (old_sculpt.notNull())
|
||||
{
|
||||
old_sculpt->removeVolume(this);
|
||||
}
|
||||
if (mSculptTexture.notNull())
|
||||
{
|
||||
mSculptTexture->addVolume(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sculpt replaces generate() for sculpted surfaces
|
||||
void LLVOVolume::sculpt()
|
||||
{
|
||||
@@ -721,7 +747,7 @@ void LLVOVolume::sculpt()
|
||||
S8 sculpt_components = 0;
|
||||
const U8* sculpt_data = NULL;
|
||||
|
||||
S32 discard_level = mSculptTexture->getCachedRawImageLevel() ;
|
||||
S32 discard_level = mSculptTexture->getDiscardLevel();
|
||||
LLImageRaw* raw_image = mSculptTexture->getCachedRawImage() ;
|
||||
|
||||
S32 max_discard = mSculptTexture->getMaxDiscardLevel();
|
||||
@@ -764,6 +790,16 @@ void LLVOVolume::sculpt()
|
||||
sculpt_data = raw_image->getData();
|
||||
}
|
||||
getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level);
|
||||
|
||||
//notify rebuild any other VOVolumes that reference this sculpty volume
|
||||
for (S32 i = 0; i < mSculptTexture->getNumVolumes(); ++i)
|
||||
{
|
||||
LLVOVolume* volume = (*(mSculptTexture->getVolumeList()))[i];
|
||||
if (volume != this && volume->getVolume() == getVolume())
|
||||
{
|
||||
gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -169,8 +169,10 @@ public:
|
||||
/*virtual*/ BOOL setMaterial(const U8 material);
|
||||
|
||||
void setTexture(const S32 face);
|
||||
|
||||
S32 getIndexInTex() const {return mIndexInTex ;}
|
||||
/*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false);
|
||||
void updateSculptTexture();
|
||||
void setIndexInTex(S32 index) { mIndexInTex = index ;}
|
||||
void sculpt();
|
||||
void updateRelativeXform();
|
||||
/*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
|
||||
@@ -228,7 +230,6 @@ private:
|
||||
LLFrameTimer mTextureUpdateTimer;
|
||||
S32 mLOD;
|
||||
BOOL mLODChanged;
|
||||
S32 mSculptLevel;
|
||||
BOOL mSculptChanged;
|
||||
LLMatrix4 mRelativeXform;
|
||||
LLMatrix3 mRelativeXformInvTrans;
|
||||
@@ -236,6 +237,7 @@ private:
|
||||
F32 mVObjRadius;
|
||||
LLVolumeInterface *mVolumeImpl;
|
||||
LLPointer<LLViewerImage> mSculptTexture;
|
||||
S32 mIndexInTex;
|
||||
|
||||
// statics
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user