diff options
author | Nyx (Neal Orman) <nyx@lindenlab.com> | 2011-03-21 17:56:11 -0400 |
---|---|---|
committer | Nyx (Neal Orman) <nyx@lindenlab.com> | 2011-03-21 17:56:11 -0400 |
commit | 955b727550e8595fd67c55775d8f0fe249826277 (patch) | |
tree | f4ac70eb36bcb14d44fad4199811d365eb4b788f /indra/newview/llmeshrepository.cpp | |
parent | 77fff26431671ffef8cf482044b1fcd98262d3e0 (diff) | |
parent | 5b9ee2a9d5687eae6fd48ee6038cd2f7ed1d9a53 (diff) |
merge
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rwxr-xr-x | indra/newview/llmeshrepository.cpp | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index a2b0ac09af..93e773d33b 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1162,7 +1162,12 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat info.mAlternateBindMatrix.push_back(mat); } } - + + if (skin.has("pelvis_offset")) + { + info.mPelvisOffset = skin["pelvis_offset"].asReal(); + } + //llinfos<<"info pelvis offset"<<info.mPelvisOffset<<llendl; mSkinInfoQ.push(info); } @@ -2981,7 +2986,7 @@ LLSD LLMeshUploadThread::createObject(LLModelInstance& instance) object_params["pos"] = ll_sd_from_vector3(position + mOrigin); object_params["rotation"] = ll_sd_from_quaternion(quat_rotation); object_params["scale"] = ll_sd_from_vector3(scale); - object_params["name"] = instance.mModel->getName(); + object_params["name"] = instance.mLabel; // load material from dae file object_params["facelist"] = LLSD::emptyArray(); @@ -3100,9 +3105,7 @@ F32 LLMeshRepository::getStreamingCost(const LLSD& header, F32 radius) F32 dlowest = llmin(radius/0.06f, 256.f); F32 dlow = llmin(radius/0.24f, 256.f); F32 dmid = llmin(radius/1.0f, 256.f); - F32 dhigh = 0.f; - - + F32 bytes_lowest = header["lowest_lod"]["size"].asReal()/1024.f; F32 bytes_low = header["low_lod"]["size"].asReal()/1024.f; F32 bytes_mid = header["medium_lod"]["size"].asReal()/1024.f; @@ -3128,14 +3131,35 @@ F32 LLMeshRepository::getStreamingCost(const LLSD& header, F32 radius) bytes_lowest = bytes_low; } - F32 cost = 0.f; - cost += llmax(256.f-dlowest, 1.f)/32.f*bytes_lowest; - cost += llmax(dlowest-dlow, 1.f)/32.f*bytes_low; - cost += llmax(dlow-dmid, 1.f)/32.f*bytes_mid; - cost += llmax(dmid-dhigh, 1.f)/32.f*bytes_high; + F32 max_area = 65536.f; + F32 min_area = 1.f; + + F32 high_area = llmin(F_PI*dmid*dmid, max_area); + F32 mid_area = llmin(F_PI*dlow*dlow, max_area); + F32 low_area = llmin(F_PI*dlowest*dlowest, max_area); + F32 lowest_area = max_area; + + lowest_area -= low_area; + low_area -= mid_area; + mid_area -= high_area; + + high_area = llclamp(high_area, min_area, max_area); + mid_area = llclamp(mid_area, min_area, max_area); + low_area = llclamp(low_area, min_area, max_area); + lowest_area = llclamp(lowest_area, min_area, max_area); + + F32 total_area = high_area + mid_area + low_area + lowest_area; + high_area /= total_area; + mid_area /= total_area; + 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; - cost *= gSavedSettings.getF32("MeshStreamingCostScaler"); - return cost; + return weighted_avg * gSavedSettings.getF32("MeshStreamingCostScaler"); } |