Ver Fonte

Fixed directional lights and fog in OpenGL orthographic mode.

Lasse Öörni há 14 anos atrás
pai
commit
630edabb4b

+ 8 - 0
Engine/Graphics/Batch.cpp

@@ -111,7 +111,15 @@ void Batch::Prepare(Graphics* graphics, const HashMap<StringHash, Vector4>& shad
     {
         Vector4 depthMode = Vector4::ZERO;
         if (camera_->IsOrthographic())
+        {
+            depthMode.x_ = 1.0f;
+            #ifdef USE_OPENGL
+            depthMode.z_ = 0.5f;
+            depthMode.w_ = 0.5f;
+            #else
             depthMode.z_ = 1.0f;
+            #endif
+        }
         else
             depthMode.w_ = 1.0f / camera_->GetFarClip();
         

+ 1 - 1
SourceAssets/GLSLShaders/ScreenPos.vert

@@ -31,5 +31,5 @@ vec3 GetNearRay(vec4 clipPos)
         clipPos.y / clipPos.w * cFrustumSize.y,
         0.0);
     
-    return (cCameraRot * viewRay) * cDepthMode.z;
+    return (cCameraRot * viewRay) * cDepthMode.x;
 }

+ 1 - 1
SourceAssets/HLSLShaders/ScreenPos.hlsl

@@ -31,5 +31,5 @@ float3 GetNearRay(float4 clipPos)
         clipPos.y / clipPos.w * cFrustumSize.y,
         0.0);
 
-    return mul(viewRay, cCameraRot) * cDepthMode.z;
+    return mul(viewRay, cCameraRot) * cDepthMode.x;
 }