Ver código fonte

Prefer to use camera's EffectiveWorldTransform for view inverse to avoid double inversing.

Lasse Öörni 10 anos atrás
pai
commit
ca3f3ced4f

+ 1 - 1
Source/Urho3D/Graphics/Renderer.cpp

@@ -1420,7 +1420,7 @@ void Renderer::OptimizeLightByStencil(Light* light, Camera* camera)
         graphics_->SetStencilTest(true, CMP_ALWAYS, OP_REF, OP_KEEP, OP_KEEP, lightStencilValue_);
         graphics_->SetShaders(graphics_->GetShader(VS, "Stencil"), graphics_->GetShader(PS, "Stencil"));
         graphics_->SetShaderParameter(VSP_VIEW, view);
-        graphics_->SetShaderParameter(VSP_VIEWINV, view.Inverse());
+        graphics_->SetShaderParameter(VSP_VIEWINV, camera->GetEffectiveWorldTransform());
         graphics_->SetShaderParameter(VSP_VIEWPROJ, projection * view);
         graphics_->SetShaderParameter(VSP_MODEL, light->GetVolumeTransform(camera));
 

+ 1 - 1
Source/Urho3D/Graphics/View.cpp

@@ -756,7 +756,7 @@ void View::SetCameraShaderParameters(Camera* camera, bool setProjection)
         projection.m23_ += projection.m33_ * constantBias;
 #endif
 
-        graphics_->SetShaderParameter(VSP_VIEWINV, camera->GetView().Inverse());
+        graphics_->SetShaderParameter(VSP_VIEWINV, camera->GetEffectiveWorldTransform());
         graphics_->SetShaderParameter(VSP_VIEW, camera->GetView());
         graphics_->SetShaderParameter(VSP_VIEWPROJ, projection * camera->GetView());
     }