summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-03-01 15:22:17 -0600
committerDave Parks <davep@lindenlab.com>2011-03-01 15:22:17 -0600
commit5eeca73940bb083e76cb73d1528e61544d3f7fd2 (patch)
treed958e4caa6cebd64aa616c850408080e74b4cf8e /indra
parent10f14598243ef93f8990f9a1473334ef918f9cf7 (diff)
SH-1072 Fix for DoF focal point being incorrect.
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/app_settings/settings.xml12
-rw-r--r--indra/newview/llviewerwindow.cpp2
-rw-r--r--indra/newview/llvovolume.cpp7
-rwxr-xr-xindra/newview/pipeline.cpp41
4 files changed, 47 insertions, 15 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 71a611ba90..01610f73ed 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1323,6 +1323,18 @@
<integer>0</integer>
</map>
+ <key>CameraFocusTransitionTime</key>
+ <map>
+ <key>Comment</key>
+ <string>How many seconds it takes the camera to transition between focal distances</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>0.5</real>
+ </map>
+
<key>CameraFNumber</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 94fb0b7d31..7aa90bd76d 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -3698,7 +3698,7 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de
{
found = gPipeline.lineSegmentIntersectInWorld(mouse_world_start, mouse_world_end, pick_transparent,
face_hit, intersection, uv, normal, binormal);
- if (found)
+ if (found && !pick_transparent)
{
gDebugRaycastIntersection = *intersection;
}
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index e3cc2f2589..132e50904a 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3365,8 +3365,15 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e
end_face = face+1;
}
+ bool special_cursor = specialHoverCursor();
for (S32 i = start_face; i < end_face; ++i)
{
+ if (!special_cursor && !pick_transparent && getTE(i)->getColor().mV[3] == 0.f)
+ { //don't attempt to pick completely transparent faces unless
+ //pick_transparent is true
+ continue;
+ }
+
face_hit = volume->lineSegmentIntersect(v_start, v_end, i,
&p, &tc, &n, &bn);
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index c280805516..55d73f9808 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -6173,26 +6173,39 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
//depth of field focal plane calculations
- F32 subject_distance = 16.f;
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- //flycam mode, use mouse cursor as focus point
- LLVector3 eye = LLViewerCamera::getInstance()->getOrigin();
- subject_distance = (eye-gDebugRaycastIntersection).magVec();
+ static F32 current_distance = 16.f;
+ static F32 start_distance = 16.f;
+ static F32 transition_time = 1.f;
+
+ LLVector3 eye = LLViewerCamera::getInstance()->getOrigin();
+ F32 target_distance = LLViewerCamera::getInstance()->getAtAxis() * (gDebugRaycastIntersection-eye);
+
+ if (transition_time >= 1.f &&
+ fabsf(current_distance-target_distance)/current_distance > 0.01f)
+ { //large shift happened, interpolate smoothly to new target distance
+ llinfos << "start" << llendl;
+ transition_time = 0.f;
+ start_distance = current_distance;
}
- else
- {
- LLViewerObject* obj = gAgentCamera.getFocusObject();
- if (obj)
+ else if (transition_time < 1.f)
+ { //currently in a transition, continue interpolating
+ transition_time += 1.f/gSavedSettings.getF32("CameraFocusTransitionTime")*gFrameIntervalSeconds;
+ if (transition_time >= 1.f)
{
- LLVector3 focus = LLVector3(gAgentCamera.getFocusGlobal()-gAgent.getRegion()->getOriginGlobal());
- LLVector3 eye = LLViewerCamera::getInstance()->getOrigin();
- subject_distance = (focus-eye).magVec();
+ llinfos << "stop" << llendl;
}
+ transition_time = llmin(transition_time, 1.f);
+
+ F32 t = cosf(transition_time*F_PI+F_PI)*0.5f+0.5f;
+ current_distance = start_distance + (target_distance-start_distance)*t;
+ }
+ else
+ { //small or no change, just snap to target distance
+ current_distance = target_distance;
}
//convert to mm
- subject_distance *= 1000.f;
+ F32 subject_distance = current_distance*1000.f;
F32 fnumber = gSavedSettings.getF32("CameraFNumber");
const F32 default_focal_length = gSavedSettings.getF32("CameraFocalLength");