diff options
| -rw-r--r-- | indra/newview/llfloatermodelpreview.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llmeshrepository.cpp | 156 | ||||
| -rw-r--r-- | indra/newview/llmeshrepository.h | 52 | ||||
| -rw-r--r-- | indra/newview/llsceneview.cpp | 19 | ||||
| -rw-r--r-- | indra/newview/llselectmgr.cpp | 12 | ||||
| -rw-r--r-- | indra/newview/llviewerobject.cpp | 11 | ||||
| -rw-r--r-- | indra/newview/llviewerobject.h | 5 | ||||
| -rw-r--r-- | indra/newview/llviewerwindow.cpp | 9 | ||||
| -rw-r--r-- | indra/newview/llvovolume.cpp | 82 | ||||
| -rw-r--r-- | indra/newview/llvovolume.h | 4 | 
10 files changed, 231 insertions, 125 deletions
| diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 168fb13d11..1667f01272 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1360,7 +1360,11 @@ U32 LLModelPreview::calcResourceCost()  			F32 radius = scale.length()*0.5f*debug_scale; -			streaming_cost += LLMeshRepository::getStreamingCost(ret, radius); +            LLMeshCostData costs; +            if (gMeshRepo.getCostData(ret, costs)) +            { +                streaming_cost += costs.getRadiusBasedStreamingCost(radius); +            }  		}  	} diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 9687376cff..215cdf3394 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -4062,53 +4062,12 @@ void LLMeshRepository::uploadError(LLSD& args)  	mUploadErrorQ.push(args);  } -bool LLMeshRepository::getLODSizes(LLSD& header, std::vector<S32>& lod_byte_sizes, std::vector<F32>& lod_tri_counts) -{ -    lod_byte_sizes.resize(4); -    lod_tri_counts.resize(4); - -    std::fill(lod_byte_sizes.begin(), lod_byte_sizes.end(), 0); -    std::fill(lod_tri_counts.begin(), lod_tri_counts.end(), 0.f); -     -    S32 bytes_high = header["high_lod"]["size"].asInteger(); -    S32 bytes_med = header["medium_lod"]["size"].asInteger(); -    if (bytes_med == 0) -    { -        bytes_med = bytes_high; -    } -    S32 bytes_low = header["low_lod"]["size"].asInteger(); -    if (bytes_low == 0) -    { -        bytes_low = bytes_med; -    } -    S32 bytes_lowest = header["lowest_lod"]["size"].asInteger(); -    if (bytes_lowest == 0) -    { -        bytes_lowest = bytes_low; -    } -    lod_byte_sizes[0] = bytes_lowest; -    lod_byte_sizes[1] = bytes_low; -    lod_byte_sizes[2] = bytes_med; -    lod_byte_sizes[3] = bytes_high; - -    F32 METADATA_DISCOUNT = (F32) gSavedSettings.getU32("MeshMetaDataDiscount");  //discount 128 bytes to cover the cost of LLSD tags and compression domain overhead -    F32 MINIMUM_SIZE = (F32) gSavedSettings.getU32("MeshMinimumByteSize"); //make sure nothing is "free" -    F32 bytes_per_triangle = (F32) gSavedSettings.getU32("MeshBytesPerTriangle"); - -    for (S32 i=0; i<4; i++) -    { -        lod_tri_counts[i] = llmax((F32) lod_byte_sizes[i]-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle;  -    } - -    return true; -} -  F32 LLMeshRepository::getEstTrianglesMax(LLUUID mesh_id)  {      LLMeshCostData costs;      if (getCostData(mesh_id, costs))      { -        return costs.mEstTrisMax; +        return costs.getEstTrisMax();      }      else      { @@ -4121,7 +4080,7 @@ F32 LLMeshRepository::getEstTrianglesStreamingCost(LLUUID mesh_id)      LLMeshCostData costs;      if (getCostData(mesh_id, costs))      { -        return costs.computeEstTrisForStreamingCost(); +        return costs.getEstTrisForStreamingCost();      }      else      { @@ -4130,7 +4089,7 @@ F32 LLMeshRepository::getEstTrianglesStreamingCost(LLUUID mesh_id)  }  // FIXME replace with calc based on LLMeshCostData -F32 LLMeshRepository::getStreamingCost(LLUUID mesh_id, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value) +F32 LLMeshRepository::getStreamingCostLegacy(LLUUID mesh_id, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value)  {  	F32 result = 0.f;      if (mThread && mesh_id.notNull()) @@ -4139,7 +4098,7 @@ F32 LLMeshRepository::getStreamingCost(LLUUID mesh_id, F32 radius, S32* bytes, S          LLMeshRepoThread::mesh_header_map::iterator iter = mThread->mMeshHeader.find(mesh_id);          if (iter != mThread->mMeshHeader.end() && mThread->mMeshHeaderSize[mesh_id] > 0)          { -            result  = getStreamingCost(iter->second, radius, bytes, bytes_visible, lod, unscaled_value); +            result  = getStreamingCostLegacy(iter->second, radius, bytes, bytes_visible, lod, unscaled_value);          }      }      if (result > 0.f) @@ -4147,8 +4106,8 @@ F32 LLMeshRepository::getStreamingCost(LLUUID mesh_id, F32 radius, S32* bytes, S          LLMeshCostData data;          if (getCostData(mesh_id, data))          { -            F32 ref_streaming_cost = data.computeRadiusBasedStreamingCost(radius); -            F32 ref_weighted_tris = data.computeRadiusWeightedTris(radius); +            F32 ref_streaming_cost = data.getRadiusBasedStreamingCost(radius); +            F32 ref_weighted_tris = data.getRadiusWeightedTris(radius);              if (!is_approx_equal(ref_streaming_cost,result))              {                  LL_WARNS() << mesh_id << "streaming mismatch " << result << " " << ref_streaming_cost << LL_ENDL; @@ -4157,13 +4116,13 @@ F32 LLMeshRepository::getStreamingCost(LLUUID mesh_id, F32 radius, S32* bytes, S              {                  LL_WARNS() << mesh_id << "weighted_tris mismatch " << *unscaled_value << " " << ref_weighted_tris << LL_ENDL;              } -            if (bytes && (*bytes != data.mSizeTotal)) +            if (bytes && (*bytes != data.getSizeTotal()))              { -                LL_WARNS() << mesh_id << "bytes mismatch " << *bytes << " " << data.mSizeTotal << LL_ENDL; +                LL_WARNS() << mesh_id << "bytes mismatch " << *bytes << " " << data.getSizeTotal() << LL_ENDL;              } -            if (bytes_visible && (lod >=0) && (lod < 4) && (*bytes_visible != data.mSizeByLOD[lod])) +            if (bytes_visible && (lod >=0) && (lod < 4) && (*bytes_visible != data.getSizeByLOD(lod)))              { -                LL_WARNS() << mesh_id << "bytes_visible mismatch " << *bytes_visible << " " << data.mSizeByLOD[lod] << LL_ENDL; +                LL_WARNS() << mesh_id << "bytes_visible mismatch " << *bytes_visible << " " << data.getSizeByLOD(lod) << LL_ENDL;              }          }          else @@ -4176,7 +4135,7 @@ F32 LLMeshRepository::getStreamingCost(LLUUID mesh_id, F32 radius, S32* bytes, S  // FIXME replace with calc based on LLMeshCostData  //static -F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value) +F32 LLMeshRepository::getStreamingCostLegacy(LLSD& header, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value)  {  	if (header.has("404")  		|| !header.has("lowest_lod") @@ -4287,12 +4246,79 @@ LLMeshCostData::LLMeshCostData()      std::fill(mSizeByLOD.begin(), mSizeByLOD.end(), 0);      std::fill(mEstTrisByLOD.begin(), mEstTrisByLOD.end(), 0.f); +} + +bool LLMeshCostData::init(const LLSD& header) +{ +    mSizeByLOD.resize(4); +    mEstTrisByLOD.resize(4); + +    std::fill(mSizeByLOD.begin(), mSizeByLOD.end(), 0); +    std::fill(mEstTrisByLOD.begin(), mEstTrisByLOD.end(), 0.f); -    mSizeTotal = 0; -    mEstTrisMax = 0; +    S32 bytes_high = header["high_lod"]["size"].asInteger(); +    S32 bytes_med = header["medium_lod"]["size"].asInteger(); +    if (bytes_med == 0) +    { +        bytes_med = bytes_high; +    } +    S32 bytes_low = header["low_lod"]["size"].asInteger(); +    if (bytes_low == 0) +    { +        bytes_low = bytes_med; +    } +    S32 bytes_lowest = header["lowest_lod"]["size"].asInteger(); +    if (bytes_lowest == 0) +    { +        bytes_lowest = bytes_low; +    } +    mSizeByLOD[0] = bytes_lowest; +    mSizeByLOD[1] = bytes_low; +    mSizeByLOD[2] = bytes_med; +    mSizeByLOD[3] = bytes_high; + +    F32 METADATA_DISCOUNT = (F32) gSavedSettings.getU32("MeshMetaDataDiscount");  //discount 128 bytes to cover the cost of LLSD tags and compression domain overhead +    F32 MINIMUM_SIZE = (F32) gSavedSettings.getU32("MeshMinimumByteSize"); //make sure nothing is "free" +    F32 bytes_per_triangle = (F32) gSavedSettings.getU32("MeshBytesPerTriangle"); + +    for (S32 i=0; i<4; i++) +    { +        mEstTrisByLOD[i] = llmax((F32) mSizeByLOD[i]-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle;  +    } + +    return true;  } -F32 LLMeshCostData::computeRadiusWeightedTris(F32 radius) + +S32 LLMeshCostData::getSizeByLOD(S32 lod) +{ +    if (llclamp(lod,0,3) != lod) +    { +        return 0; +    } +    return mSizeByLOD[lod]; +} + +S32 LLMeshCostData::getSizeTotal() +{ +    return mSizeByLOD[0] + mSizeByLOD[1] + mSizeByLOD[2] + mSizeByLOD[3]; +} + +F32 LLMeshCostData::getEstTrisByLOD(S32 lod) +{ +    if (llclamp(lod,0,3) != lod) +    { +        return 0.f; +    } +    return mEstTrisByLOD[lod]; +} + +F32 LLMeshCostData::getEstTrisMax() +{ +    return llmax(mEstTrisByLOD[0], mEstTrisByLOD[1], mEstTrisByLOD[2], mEstTrisByLOD[3]); +} + +F32 LLMeshCostData::getRadiusWeightedTris(F32 radius)  {  	F32 max_distance = 512.f; @@ -4336,7 +4362,7 @@ F32 LLMeshCostData::computeRadiusWeightedTris(F32 radius)      return weighted_avg;  } -F32 LLMeshCostData::computeEstTrisForStreamingCost() +F32 LLMeshCostData::getEstTrisForStreamingCost()  {      LL_DEBUGS("StreamingCost") << "tris_by_lod: "                                 << mEstTrisByLOD[0] << ", " @@ -4363,14 +4389,14 @@ F32 LLMeshCostData::computeEstTrisForStreamingCost()      return charged_tris;  } -F32 LLMeshCostData::computeRadiusBasedStreamingCost(F32 radius) +F32 LLMeshCostData::getRadiusBasedStreamingCost(F32 radius)  { -	return computeRadiusWeightedTris(radius)/gSavedSettings.getU32("MeshTriangleBudget")*15000.f; +	return getRadiusWeightedTris(radius)/gSavedSettings.getU32("MeshTriangleBudget")*15000.f;  } -F32 LLMeshCostData::computeTriangleBasedStreamingCost() +F32 LLMeshCostData::getTriangleBasedStreamingCost()  { -    F32 result = ANIMATED_OBJECT_COST_PER_KTRI * 0.001 * computeEstTrisForStreamingCost()/0.06; +    F32 result = ANIMATED_OBJECT_COST_PER_KTRI * 0.001 * getEstTrisForStreamingCost();      return result;  } @@ -4391,7 +4417,7 @@ bool LLMeshRepository::getCostData(LLUUID mesh_id, LLMeshCostData& data)                                     || (header.has("version") && header["version"].asInteger() > MAX_MESH_VERSION));              if (!header_invalid)              { -                return getCostData(header, mesh_id, data); +                return getCostData(header, data);              }              return true; @@ -4400,19 +4426,15 @@ bool LLMeshRepository::getCostData(LLUUID mesh_id, LLMeshCostData& data)      return false;  } -bool LLMeshRepository::getCostData(LLSD& header, LLUUID mesh_id, LLMeshCostData& data) +bool LLMeshRepository::getCostData(LLSD& header, LLMeshCostData& data)  {      data = LLMeshCostData(); -    if (!getLODSizes(header, data.mSizeByLOD, data.mEstTrisByLOD)) +    if (!data.init(header))      {          return false;      } -    data.mEstTrisMax = llmax(data.mEstTrisByLOD[0], data.mEstTrisByLOD[1], data.mEstTrisByLOD[2], data.mEstTrisByLOD[3]); - -    data.mSizeTotal = data.mSizeByLOD[0] + data.mSizeByLOD[1] + data.mSizeByLOD[2] + data.mSizeByLOD[3]; -      return true;  } diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index e43f719471..9bf12e9e41 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -452,42 +452,57 @@ private:  };  // Params related to streaming cost, render cost, and scene complexity tracking. -struct LLMeshCostData +class LLMeshCostData  { +public:      LLMeshCostData(); -    // From the "size" field of the mesh header. LOD 0=lowest, 3=highest. -    std::vector<S32> mSizeByLOD; +    bool init(const LLSD& header); +     +    // Size for given LOD +    S32 getSizeByLOD(S32 lod); -    // Estimated triangle counts derived from the LOD sizes. LOD 0=lowest, 3=highest. -    std::vector<F32> mEstTrisByLOD; +    // Sum of all LOD sizes. +    S32 getSizeTotal(); +    // Estimated triangle counts for the given LOD. +    F32 getEstTrisByLOD(S32 lod); +          // Estimated triangle counts for the largest LOD. Typically this      // is also the "high" LOD, but not necessarily. -    F32 mEstTrisMax; - -    // Sum of all LOD sizes. -    S32 mSizeTotal; - -    // Helper functions for building data +    F32 getEstTrisMax();      // Triangle count as computed by original streaming cost      // formula. Triangles in each LOD are weighted based on how      // frequently they will be seen.      // This was called "unscaled_value" in the original getStreamingCost() functions. -    F32 computeRadiusWeightedTris(F32 radius); +    F32 getRadiusWeightedTris(F32 radius);      // Triangle count used by triangle-based cost formula. Based on      // triangles in highest LOD plus potentially partial charges for      // lower LODs depending on complexity. -    F32 computeEstTrisForStreamingCost(); +    F32 getEstTrisForStreamingCost();      // Streaming cost. This should match the server-side calculation      // for the corresponding volume. -    F32 computeRadiusBasedStreamingCost(F32 radius); +    F32 getRadiusBasedStreamingCost(F32 radius);      // New streaming cost formula, currently only used for animated objects. -    F32 computeTriangleBasedStreamingCost(); +    F32 getTriangleBasedStreamingCost(); + +private: +    // From the "size" field of the mesh header. LOD 0=lowest, 3=highest. +    std::vector<S32> mSizeByLOD; + +    // Estimated triangle counts derived from the LOD sizes. LOD 0=lowest, 3=highest. +    std::vector<F32> mEstTrisByLOD; + +    // Estimated triangle counts for the largest LOD. Typically this +    // is also the "high" LOD, but not necessarily. +    F32 mEstTrisMax; + +    // Sum of all LOD sizes. +    S32 mSizeTotal;  };  class LLMeshRepository @@ -511,14 +526,13 @@ public:  	static LLDeadmanTimer sQuiescentTimer;		// Time-to-complete-mesh-downloads after significant events -    bool getLODSizes(LLSD& header, std::vector<S32>& lod_byte_sizes, std::vector<F32>& lod_tri_counts);      // Estimated triangle count of the largest LOD      F32 getEstTrianglesMax(LLUUID mesh_id);      F32 getEstTrianglesStreamingCost(LLUUID mesh_id); -	F32 getStreamingCost(LLUUID mesh_id, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1, F32 *unscaled_value = NULL); -	static F32 getStreamingCost(LLSD& header, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1, F32 *unscaled_value = NULL); +	F32 getStreamingCostLegacy(LLUUID mesh_id, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1, F32 *unscaled_value = NULL); +	static F32 getStreamingCostLegacy(LLSD& header, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1, F32 *unscaled_value = NULL);      bool getCostData(LLUUID mesh_id, LLMeshCostData& data); -    bool getCostData(LLSD& header, LLUUID mesh_id, LLMeshCostData& data); +    bool getCostData(LLSD& header, LLMeshCostData& data);  	LLMeshRepository(); diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp index 112fa5b4e1..f7aa63e34d 100644 --- a/indra/newview/llsceneview.cpp +++ b/indra/newview/llsceneview.cpp @@ -33,6 +33,7 @@  #include "llviewerregion.h"  #include "llagent.h"  #include "llvolumemgr.h" +#include "llmeshrepository.h"  LLSceneView* gSceneView = NULL; @@ -129,17 +130,23 @@ void LLSceneView::draw()  				visible_triangles[idx].push_back(visible);  				triangles[idx].push_back(high_triangles); -				S32 bytes = 0; -				S32 visible_bytes = 0; - -				F32 streaming = object->getStreamingCost(&bytes, &visible_bytes); -				total_streaming[idx] += streaming; -				streaming_cost[idx].push_back(streaming); +                F32 streaming = object->getStreamingCost(); +                total_streaming[idx] += streaming; +                streaming_cost[idx].push_back(streaming);  				F32 physics = object->getPhysicsCost();  				total_physics[idx] += physics;  				physics_cost[idx].push_back(physics); +				S32 bytes = 0; +				S32 visible_bytes = 0; +                LLMeshCostData costs; +                if (object->getCostData(costs)) +                { +                    bytes = costs.getSizeTotal(); +                    visible_bytes = costs.getSizeByLOD(object->getLOD()); +                } +  				total_bytes[idx] += bytes;  				total_visible_bytes[idx] += visible_bytes;  			} diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index d29a06f7e5..ce5fc7a71e 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -7252,10 +7252,16 @@ F32 LLObjectSelection::getSelectedObjectStreamingCost(S32* total_bytes, S32* vis  		if (object)  		{ -			S32 bytes = 0; -			S32 visible = 0; -			cost += object->getStreamingCost(&bytes, &visible); +			cost += object->getStreamingCost(); +            S32 bytes = 0; +            S32 visible = 0; +            LLMeshCostData costs; +            if (object->getCostData(costs)) +            { +                bytes = costs.getSizeTotal(); +                visible = costs.getSizeByLOD(object->getLOD()); +            }  			if (total_bytes)  			{  				*total_bytes += bytes; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 72cb1d4cf6..32a1ccd852 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -106,6 +106,7 @@  #include "llvocache.h"  #include "llcleanup.h"  #include "llcallstack.h" +#include "llmeshrepository.h"  //#define DEBUG_UPDATE_TYPE @@ -3698,11 +3699,19 @@ F32 LLViewerObject::getEstTrianglesStreamingCost() const      return 0.f;  } -F32 LLViewerObject::getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscaled_value) const +// virtual +F32 LLViewerObject::getStreamingCost() const  {  	return 0.f;  } +// virtual +bool LLViewerObject::getCostData(LLMeshCostData& costs) const +{ +    costs = LLMeshCostData(); +    return false; +} +  U32 LLViewerObject::getTriangleCount(S32* vcount) const  {  	return 0; diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 2fe14c2fcf..9552d4e99e 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -68,6 +68,8 @@ class LLViewerRegion;  class LLViewerTexture;  class LLWorld; +class LLMeshCostData; +  typedef enum e_object_update_type  {  	OUT_FULL, @@ -366,7 +368,8 @@ public:      F32 recursiveGetEstTrianglesMax() const;      virtual F32 getEstTrianglesMax() const;      virtual F32 getEstTrianglesStreamingCost() const; -	virtual F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL, F32* unscaled_value = NULL) const; +	virtual F32 getStreamingCost() const; +    virtual bool getCostData(LLMeshCostData& costs) const;  	virtual U32 getTriangleCount(S32* vcount = NULL) const;  	virtual U32 getHighLODTriangleCount();      F32 recursiveGetScaledSurfaceArea() const; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index b87a6d14e5..467b0c6fcb 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -546,7 +546,14 @@ public:  								object_count++;  								S32 bytes = 0;	  								S32 visible = 0; -								cost += object->getStreamingCost(&bytes, &visible); +								cost += object->getStreamingCost(); +                                LLMeshCostData costs; +                                if (object->getCostData(costs)) +                                { +                                    bytes = costs.getSizeTotal(); +                                    visible = costs.getSizeByLOD(object->getLOD()); +                                } +  								S32 vt = 0;  								count += object->getTriangleCount(&vt);  								vcount += vt; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 9db4b3de0c..88f2ba34d3 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3691,16 +3691,25 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const  		path_params = volume_params.getPathParams();  		profile_params = volume_params.getProfileParams(); -		F32 weighted_triangles = -1.0; -		getStreamingCost(NULL, NULL, &weighted_triangles); - -		if (weighted_triangles > 0.0) +        LLMeshCostData costs; +		if (getCostData(costs))  		{ -			num_triangles = (U32)(weighted_triangles);  +            if (isAnimatedObject() && isRiggedMesh()) +            { +                // AXON Scaling here is to make animated object vs +                // non-animated object ARC proportional to the +                // corresponding calculations for streaming cost. +                num_triangles = (ANIMATED_OBJECT_COST_PER_KTRI * 0.001 * costs.getEstTrisForStreamingCost())/0.06; +            } +            else +            { +                F32 radius = getScale().length()*0.5f; +                num_triangles = costs.getRadiusWeightedTris(radius); +            }  		}  	} -	if (num_triangles == 0) +	if (num_triangles <= 0)  	{  		num_triangles = 4;  	} @@ -3888,6 +3897,14 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const  		shame += media_faces * ARC_MEDIA_FACE_COST;  	} +    // AXON streaming cost for animated objects includes a fixed cost +    // per linkset. Add a corresponding charge here translated into +    // triangles, but not weighted by any graphics properties. +    if (isAnimatedObject() && isRootEdit()) +    { +        shame += (ANIMATED_OBJECT_BASE_COST/0.06) * 5.0f; +    } +  	if (shame > mRenderComplexity_current)  	{  		mRenderComplexity_current = (S32)shame; @@ -3914,33 +3931,50 @@ F32 LLVOVolume::getEstTrianglesStreamingCost() const      return 0.f;  } -F32 LLVOVolume::getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscaled_value) const +F32 LLVOVolume::getStreamingCost() const  {  	F32 radius = getScale().length()*0.5f; -      F32 linkset_base_cost = 0.f; -    if (isAnimatedObject() && isRootEdit()) + +    LLMeshCostData costs; +    if (getCostData(costs))      { -        // Root object of an animated object has this to account for skeleton overhead. -        linkset_base_cost = ANIMATED_OBJECT_BASE_COST; -    } -	if (isMesh()) -	{ -        if (isAnimatedObject() && isRiggedMesh()) +        if (isAnimatedObject() && isRootEdit()) +        { +            // Root object of an animated object has this to account for skeleton overhead. +            linkset_base_cost = ANIMATED_OBJECT_BASE_COST; +        } +        if (isMesh())          { -            if (unscaled_value) +            if (isAnimatedObject() && isRiggedMesh())              { -                *unscaled_value = (linkset_base_cost + ANIMATED_OBJECT_COST_PER_KTRI * 0.001 * getEstTrianglesStreamingCost())/0.06; +                return linkset_base_cost + costs.getTriangleBasedStreamingCost(); +            } +            else +            { +                return linkset_base_cost + costs.getRadiusBasedStreamingCost(radius);              } -            return linkset_base_cost + ANIMATED_OBJECT_COST_PER_KTRI * 0.001 * getEstTrianglesStreamingCost();          }          else          { -            return linkset_base_cost + gMeshRepo.getStreamingCost(getVolume()->getParams().getSculptID(), radius, bytes, visible_bytes, mLOD, unscaled_value); +            return linkset_base_cost + costs.getRadiusBasedStreamingCost(radius);          } -	} -	else -	{ +    } +    else +    { +        return 0.f; +    } +} + +// virtual +bool LLVOVolume::getCostData(LLMeshCostData& costs) const +{ +    if (isMesh()) +    { +        return gMeshRepo.getCostData(getVolume()->getParams().getSculptID(), costs); +    } +    else +    {  		LLVolume* volume = getVolume();  		S32 counts[4];  		LLVolume::getLoDTriangleCounts(volume->getParams(), counts); @@ -3951,8 +3985,8 @@ F32 LLVOVolume::getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscaled_v  		header["medium_lod"]["size"] = counts[2] * 10;  		header["high_lod"]["size"] = counts[3] * 10; -		return linkset_base_cost + LLMeshRepository::getStreamingCost(header, radius, NULL, NULL, -1, unscaled_value); -	}	 +		return gMeshRepo.getCostData(header, costs); +    }  }  //static  diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index f6738945d8..3ffb7c140a 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -136,8 +136,8 @@ public:  				U32 	getRenderCost(texture_cost_t &textures) const;      /*virtual*/	F32		getEstTrianglesMax() const;      /*virtual*/	F32		getEstTrianglesStreamingCost() const; -				F32		getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscaled_value) const; -	/*virtual*/	F32		getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL) { return getStreamingCost(bytes, visible_bytes, NULL); } +    /* virtual*/ F32	getStreamingCost() const; +    /*virtual*/ bool getCostData(LLMeshCostData& costs) const;  	/*virtual*/ U32		getTriangleCount(S32* vcount = NULL) const;  	/*virtual*/ U32		getHighLODTriangleCount(); | 
