summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rwxr-xr-xindra/newview/pipeline.cpp50
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;