diff options
author | Dave Parks <davep@lindenlab.com> | 2011-03-03 18:09:32 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-03-03 18:09:32 -0600 |
commit | 24eb86c774eb545bb8e0d5153e3aa85e6d4f2094 (patch) | |
tree | 00cd36e8f96cc6fefd8af7c7d31c0fb693bbfc4c /indra/newview | |
parent | 33d9a577ecf280ddc309479089c6d4d323698dfb (diff) |
SH-1072 Implement new DoF focus rules (no DoF in build mode, always focus on media texture, focus on alt-zoom target if exists, focus 16m in front of camera when in followcam, focus on object under cursor in flycam).
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/pipeline.cpp | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 73cd60e2f5..9eaf515c65 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -75,6 +75,7 @@ #include "lltool.h" #include "lltoolmgr.h" #include "llviewercamera.h" +#include "llviewermediafocus.h" #include "llviewertexturelist.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" @@ -6176,9 +6177,45 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) static F32 start_distance = 16.f; static F32 transition_time = 1.f; + LLVector3 focus_point; + + LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject(); + if (obj && obj->mDrawable && obj->isSelected()) + { + S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace(); + if (obj && obj->mDrawable) + { + LLFace* face = obj->mDrawable->getFace(face_idx); + if (face) + { + focus_point = face->getPositionAgent(); + } + } + } +
+ if (focus_point.isExactlyZero())
+ {
+ if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ { + focus_point = gDebugRaycastIntersection; + } + else + { + LLViewerObject* obj = gAgentCamera.getFocusObject();
+ if (obj)
+ {
+ focus_point = LLVector3(gAgentCamera.getFocusGlobal()-gAgent.getRegion()->getOriginGlobal());
+ } + } + } + LLVector3 eye = LLViewerCamera::getInstance()->getOrigin(); - F32 target_distance = LLViewerCamera::getInstance()->getAtAxis() * (gDebugRaycastIntersection-eye); - + F32 target_distance = 16.f; + if (!focus_point.isExactlyZero()) + { + target_distance = LLViewerCamera::getInstance()->getAtAxis() * (focus_point-eye); + } + if (transition_time >= 1.f && fabsf(current_distance-target_distance)/current_distance > 0.01f) { //large shift happened, interpolate smoothly to new target distance @@ -6206,8 +6243,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) //convert to mm F32 subject_distance = current_distance*1000.f; F32 fnumber = gSavedSettings.getF32("CameraFNumber"); - const F32 default_focal_length = gSavedSettings.getF32("CameraFocalLength"); - + F32 default_focal_length = gSavedSettings.getF32("CameraFocalLength"); + + if (LLToolMgr::getInstance()->inBuildMode()) + { //squish focal length when in build mode so DoF doesn't make editing objects difficult + default_focal_length = 5.f; + } + F32 fov = LLViewerCamera::getInstance()->getView(); const F32 default_fov = gSavedSettings.getF32("CameraFieldOfView") * F_PI/180.f; |