diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-07-01 10:09:03 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-07-01 10:09:03 -0400 |
commit | 3da45a3cd1e4a7984e2e41ab92ad9f97166aa3a6 (patch) | |
tree | be99785bd263e745020de6456e6449ca9da62f3d /indra/newview/llmeshrepository.cpp | |
parent | 1716b8428f88989b2b8898e27cc137e7746a4805 (diff) | |
parent | 021ce5ccaf10e140fe114c586466ccea8ea7dbdf (diff) |
merge
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rw-r--r--[-rwxr-xr-x] | indra/newview/llmeshrepository.cpp | 80 |
1 files changed, 44 insertions, 36 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index ff6c33ac27..ee899ef613 100755..100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3245,58 +3245,66 @@ void LLMeshRepository::uploadError(LLSD& args) //static F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32* bytes_visible, S32 lod) { - F32 dlowest = llmin(radius/0.03f, 256.f); - F32 dlow = llmin(radius/0.06f, 256.f); - F32 dmid = llmin(radius/0.24f, 256.f); + F32 max_distance = 512.f; + + F32 dlowest = llmin(radius/0.03f, max_distance); + F32 dlow = llmin(radius/0.06f, max_distance); + F32 dmid = llmin(radius/0.24f, max_distance); - F32 METADATA_DISCOUNT = 128.f; //discount 128 bytes to cover the cost of LLSD tags and compression domain overhead - F32 MINIMUM_SIZE = 32.f; //make sure nothing is "free" + 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_lowest = llmax((F32) header["lowest_lod"]["size"].asReal()-METADATA_DISCOUNT, MINIMUM_SIZE)/1024.f; - F32 bytes_low = llmax((F32) header["low_lod"]["size"].asReal()/-METADATA_DISCOUNT, MINIMUM_SIZE)/1024.f; - F32 bytes_mid = llmax((F32) header["medium_lod"]["size"].asReal()-METADATA_DISCOUNT, MINIMUM_SIZE)/1024.f; - F32 bytes_high = llmax((F32) header["high_lod"]["size"].asReal()-METADATA_DISCOUNT, MINIMUM_SIZE)/1024.f; + F32 bytes_per_triangle = (F32) gSavedSettings.getU32("MeshBytesPerTriangle"); - if (bytes) + S32 bytes_lowest = header["lowest_lod"]["size"].asInteger(); + S32 bytes_low = header["low_lod"]["size"].asInteger(); + S32 bytes_mid = header["medium_lod"]["size"].asInteger(); + S32 bytes_high = header["high_lod"]["size"].asInteger(); + + if (bytes_high == 0) { - *bytes = 0; - *bytes += header["lowest_lod"]["size"].asInteger(); - *bytes += header["low_lod"]["size"].asInteger(); - *bytes += header["medium_lod"]["size"].asInteger(); - *bytes += header["high_lod"]["size"].asInteger(); + return 0.f; } - - if (bytes_visible) + if (bytes_mid == 0) { - lod = LLMeshRepository::getActualMeshLOD(header, lod); - if (lod >= 0 && lod <= 3) - { - *bytes_visible = header[header_lod[lod]]["size"].asInteger(); - } + bytes_mid = bytes_high; } - if (bytes_high == 0.f) + if (bytes_low == 0) { - return 0.f; + bytes_low = bytes_mid; } - if (bytes_mid == 0.f) + if (bytes_lowest == 0) { - bytes_mid = bytes_high; + bytes_lowest = bytes_low; } - if (bytes_low == 0.f) + F32 triangles_lowest = llmax((F32) bytes_lowest-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle; + F32 triangles_low = llmax((F32) bytes_low-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle; + F32 triangles_mid = llmax((F32) bytes_mid-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle; + F32 triangles_high = llmax((F32) bytes_high-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle; + + if (bytes) { - bytes_low = bytes_mid; + *bytes = 0; + *bytes += header["lowest_lod"]["size"].asInteger(); + *bytes += header["low_lod"]["size"].asInteger(); + *bytes += header["medium_lod"]["size"].asInteger(); + *bytes += header["high_lod"]["size"].asInteger(); } - if (bytes_lowest == 0.f) + if (bytes_visible) { - bytes_lowest = bytes_low; + lod = LLMeshRepository::getActualMeshLOD(header, lod); + if (lod >= 0 && lod <= 3) + { + *bytes_visible = header[header_lod[lod]]["size"].asInteger(); + } } - F32 max_area = 65536.f; + F32 max_area = 102932.f; //area of circle that encompasses region F32 min_area = 1.f; F32 high_area = llmin(F_PI*dmid*dmid, max_area); @@ -3319,12 +3327,12 @@ F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32 low_area /= total_area; lowest_area /= total_area; - F32 weighted_avg = bytes_high*high_area + - bytes_mid*mid_area + - bytes_low*low_area + - bytes_lowest*lowest_area; + F32 weighted_avg = triangles_high*high_area + + triangles_mid*mid_area + + triangles_low*low_area + + triangles_lowest*lowest_area; - return weighted_avg * gSavedSettings.getF32("MeshStreamingCostScaler"); + return weighted_avg/gSavedSettings.getU32("MeshTriangleBudget")*15000.f; } |