Intermediary commit #3

This commit is contained in:
Shyotl
2019-03-17 01:08:34 -05:00
parent 3a78568a6f
commit aa37a0b539
19 changed files with 464 additions and 79 deletions

View File

@@ -3416,6 +3416,47 @@ F32 LLViewerObject::getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscal
{
return 0.f;
}
F32 LLViewerObject::recursiveGetEstTrianglesMax() const
{
F32 est_tris = getEstTrianglesMax();
for (child_list_t::const_iterator iter = mChildList.begin();
iter != mChildList.end(); iter++)
{
const LLViewerObject* child = *iter;
if (!child->isAvatar())
{
est_tris += child->recursiveGetEstTrianglesMax();
}
}
return est_tris;
}
S32 LLViewerObject::getAnimatedObjectMaxTris() const
{
S32 max_tris = 0;
if (gSavedSettings.getBOOL("AnimatedObjectsIgnoreLimits"))
{
max_tris = S32_MAX;
}
else
{
if (gAgent.getRegion())
{
LLSD features;
gAgent.getRegion()->getSimulatorFeatures(features);
if (features.has("AnimatedObjects"))
{
max_tris = features["AnimatedObjects"]["AnimatedObjectMaxTris"].asInteger();
}
}
}
return max_tris;
}
F32 LLViewerObject::getEstTrianglesMax() const
{
return 0.f;
}
U32 LLViewerObject::getTriangleCount(S32* vcount) const
{
@@ -3427,6 +3468,57 @@ U32 LLViewerObject::getHighLODTriangleCount()
return 0;
}
U32 LLViewerObject::recursiveGetTriangleCount(S32* vcount) const
{
S32 total_tris = getTriangleCount(vcount);
LLViewerObject::const_child_list_t& child_list = getChildren();
for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); ++iter)
{
LLViewerObject* childp = *iter;
if (childp)
{
total_tris += childp->getTriangleCount(vcount);
}
}
return total_tris;
}
// This is using the stored surface area for each volume (which
// defaults to 1.0 for the case of everything except a sculpt) and
// then scaling it linearly based on the largest dimension in the
// prim's scale. Should revisit at some point.
F32 LLViewerObject::recursiveGetScaledSurfaceArea() const
{
F32 area = 0.f;
const LLDrawable* drawable = mDrawable;
if (drawable)
{
const LLVOVolume* volume = drawable->getVOVolume();
if (volume)
{
if (volume->getVolume())
{
const LLVector3& scale = volume->getScale();
area += volume->getVolume()->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]);
}
LLViewerObject::const_child_list_t children = volume->getChildren();
for (LLViewerObject::const_child_list_t::const_iterator child_iter = children.begin();
child_iter != children.end();
++child_iter)
{
LLViewerObject* child_obj = *child_iter;
LLVOVolume *child = dynamic_cast<LLVOVolume*>( child_obj );
if (child && child->getVolume())
{
const LLVector3& scale = child->getScale();
area += child->getVolume()->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]);
}
}
}
}
return area;
}
void LLViewerObject::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
{
if(mDrawable.isNull())