diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2010-08-18 11:33:01 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2010-08-18 11:33:01 -0600 |
commit | 247ca1660bf4029d4e5bb701654433f14c785ab5 (patch) | |
tree | 1bcc6a234b1c3dd6908c9a1999a3dce19a4da566 /indra/newview/llvotree.cpp | |
parent | 2afe1f3999f85e21f2cdfcb614670b89762dfeef (diff) |
EXT-8673: FIXED: UDP texture loading is slower in 2.x viewers than 1.23.5
Improved the following:
1, make sure the texture callback queue is properly handled and cleaned in time;
2, estimate the LLVOTree pixel area more accurately;
3, eliminate the possibility of back and forth stopping/restarting a texture fetching
Diffstat (limited to 'indra/newview/llvotree.cpp')
-rw-r--r-- | indra/newview/llvotree.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 0efe6682be..9c08c0eec1 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -448,22 +448,35 @@ void LLVOTree::render(LLAgent &agent) void LLVOTree::setPixelAreaAndAngle(LLAgent &agent) { - // First calculate values as for any other object (for mAppAngle) - LLViewerObject::setPixelAreaAndAngle(agent); - - // Re-calculate mPixelArea accurately + LLVector3 center = getPositionAgent();//center of tree. + LLVector3 viewer_pos_agent = gAgentCamera.getCameraPositionAgent(); + LLVector3 lookAt = center - viewer_pos_agent; + F32 dist = lookAt.normVec() ; + F32 cos_angle_to_view_dir = lookAt * LLViewerCamera::getInstance()->getXAxis() ; - // This should be the camera's center, as soon as we move to all region-local. - LLVector3 relative_position = getPositionAgent() - gAgentCamera.getCameraPositionAgent(); - F32 range_squared = relative_position.lengthSquared() ; + F32 range = dist - getMinScale()/2; + if (range < F_ALMOST_ZERO || isHUDAttachment()) // range == zero + { + mAppAngle = 180.f; + } + else + { + mAppAngle = (F32) atan2( getMaxScale(), range) * RAD_TO_DEG; + } F32 max_scale = mBillboardScale * getMaxScale(); F32 area = max_scale * (max_scale*mBillboardRatio); - // Compute pixels per meter at the given range - F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / tan(LLViewerCamera::getInstance()->getView()); + F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / (tan(LLViewerCamera::getInstance()->getView()) * dist); + mPixelArea = pixels_per_meter * pixels_per_meter * area ; + + F32 importance = LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist) ; + mPixelArea = LLFace::adjustPixelArea(importance, mPixelArea) ; + if (mPixelArea > LLViewerCamera::getInstance()->getScreenPixelArea()) + { + mAppAngle = 180.f; + } - mPixelArea = (pixels_per_meter) * (pixels_per_meter) * area / range_squared; #if 0 // mAppAngle is a bit of voodoo; // use the one calculated LLViewerObject::setPixelAreaAndAngle above |