diff options
author | Dave Parks <davep@lindenlab.com> | 2010-04-22 16:52:05 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-04-22 16:52:05 -0500 |
commit | bd216c96498585ca01e1634877d4b184f20fa45f (patch) | |
tree | 9ffee9054674196817a81889a469fb15b933a23f /indra | |
parent | 8496f2673971d0b3ba0f22623d7007cd163f8b02 (diff) |
Fix for shadows from skyboxes hitting the ground.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmath/llcamera.h | 2 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h index 0c81067919..d6c5f7bbb1 100644 --- a/indra/llmath/llcamera.h +++ b/indra/llmath/llcamera.h @@ -143,7 +143,7 @@ private: public: LLVector3 mAgentFrustum[8]; //8 corners of 6-plane frustum F32 mFrustumCornerDist; //distance to corner of frustum against far clip plane - LLPlane getAgentPlane(U32 idx) { return mAgentPlanes[idx].p; } + LLPlane& getAgentPlane(U32 idx) { return mAgentPlanes[idx].p; } public: LLCamera(); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a36f6831c3..5a173d8460 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8118,6 +8118,14 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLVector3 n = gSavedSettings.getVector3("RenderShadowNearDist"); //F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] }; + //put together a universal "near clip" plane for shadow frusta + LLPlane shadow_near_clip; + { + LLVector3 p = gAgent.getPositionAgent(); + p += mSunDir * gSavedSettings.getF32("RenderFarClip")*2.f; + shadow_near_clip.setVec(p, mSunDir); + } + LLVector3 lightDir = -mSunDir; lightDir.normVec(); @@ -8551,7 +8559,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); - shadow_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR); + //shadow_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR); + shadow_cam.getAgentPlane(LLCamera::AGENT_PLANE_NEAR).set(shadow_near_clip); //translate and scale to from [-1, 1] to [0, 1] glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f, |