A bunch of supersize sculpty fixes by Thickbrick
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user