MAINT-8258 Don't show sculpty until it is loaded or load fails

master
andreykproductengine 2018-02-07 20:41:53 +02:00
parent 62aa399839
commit 0d40ac2ed9
4 changed files with 51 additions and 16 deletions

View File

@ -2921,15 +2921,41 @@ F32 LLVolume::sculptGetSurfaceArea()
return area;
}
// create placeholder shape
void LLVolume::sculptGeneratePlaceholder()
// create empty placeholder shape
void LLVolume::sculptGenerateEmptyPlaceholder()
{
S32 sizeS = mPathp->mPath.size();
S32 sizeT = mProfilep->mProfile.size();
S32 line = 0;
for (S32 s = 0; s < sizeS; s++)
{
for (S32 t = 0; t < sizeT; t++)
{
S32 i = t + line;
LLVector4a& pt = mMesh[i];
F32* p = pt.getF32ptr();
p[0] = 0;
p[1] = 0;
p[2] = 0;
llassert(pt.isFinite3());
}
line += sizeT;
}
}
// create sphere placeholder shape
void LLVolume::sculptGenerateSpherePlaceholder()
{
S32 sizeS = mPathp->mPath.size();
S32 sizeT = mProfilep->mProfile.size();
S32 line = 0;
// for now, this is a sphere.
for (S32 s = 0; s < sizeS; s++)
{
for (S32 t = 0; t < sizeT; t++)
@ -2937,12 +2963,12 @@ void LLVolume::sculptGeneratePlaceholder()
S32 i = t + line;
LLVector4a& pt = mMesh[i];
F32 u = (F32)s/(sizeS-1);
F32 v = (F32)t/(sizeT-1);
F32 u = (F32)s / (sizeS - 1);
F32 v = (F32)t / (sizeT - 1);
const F32 RADIUS = (F32) 0.3;
F32* p = pt.getF32ptr();
p[0] = (F32)(sin(F_PI * v) * cos(2.0 * F_PI * u) * RADIUS);
@ -2950,7 +2976,6 @@ void LLVolume::sculptGeneratePlaceholder()
p[2] = (F32)(cos(F_PI * v) * RADIUS);
llassert(pt.isFinite3());
}
line += sizeT;
}
@ -3113,9 +3138,9 @@ void sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 detail, S32
}
// sculpt replaces generate() for sculpted surfaces
void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level)
void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level, bool visible_placeholder)
{
U8 sculpt_type = mParams.getSculptType();
U8 sculpt_type = mParams.getSculptType();
BOOL data_is_empty = FALSE;
@ -3163,13 +3188,22 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
if (area < SCULPT_MIN_AREA || area > SCULPT_MAX_AREA)
{
data_is_empty = TRUE;
visible_placeholder = true;
}
}
}
if (data_is_empty)
{
sculptGeneratePlaceholder();
if (visible_placeholder)
{
// Object should be visible since there will be nothing else to display
sculptGenerateSpherePlaceholder();
}
else
{
sculptGenerateEmptyPlaceholder();
}
}

View File

@ -1059,7 +1059,7 @@ public:
U32 mFaceMask; // bit array of which faces exist in this volume
LLVector3 mLODScaleBias; // vector for biasing LOD based on scale
void sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level);
void sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level, bool visible_placeholder);
void copyVolumeFaces(const LLVolume* volume);
void copyFacesTo(std::vector<LLVolumeFace> &faces) const;
void copyFacesFrom(const std::vector<LLVolumeFace> &faces);
@ -1068,7 +1068,8 @@ public:
private:
void sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type);
F32 sculptGetSurfaceArea();
void sculptGeneratePlaceholder();
void sculptGenerateEmptyPlaceholder();
void sculptGenerateSpherePlaceholder();
void sculptCalcMeshResolution(U16 width, U16 height, U8 type, S32& s, S32& t);

View File

@ -793,7 +793,7 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
if (imagep)
{
mVolume->sculpt(imagep->getWidth(), imagep->getHeight(), imagep->getComponents(), imagep->getData(), 0);
mVolume->sculpt(imagep->getWidth(), imagep->getHeight(), imagep->getComponents(), imagep->getData(), 0, false);
}
const LLVolumeFace &vf = mVolume->getVolumeFace(0);

View File

@ -1200,7 +1200,7 @@ void LLVOVolume::sculpt()
mSculptTexture->updateBindStatsForTester() ;
}
}
getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level);
getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset());
//notify rebuild any other VOVolumes that reference this sculpty volume
for (S32 i = 0; i < mSculptTexture->getNumVolumes(); ++i)