mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 15:02:54 +08:00
Finxed rendering issues due to reversed depth
This commit is contained in:
parent
442d623302
commit
755477590d
@ -196,8 +196,8 @@ namespace CodeWalker.World
|
|||||||
float my = MouseY;
|
float my = MouseY;
|
||||||
ViewProjMatrix = Matrix.Multiply(ViewMatrix, ProjMatrix);
|
ViewProjMatrix = Matrix.Multiply(ViewMatrix, ProjMatrix);
|
||||||
ViewProjInvMatrix = Matrix.Invert(ViewProjMatrix);
|
ViewProjInvMatrix = Matrix.Invert(ViewProjMatrix);
|
||||||
MouseRayNear = ViewProjInvMatrix.MultiplyW(new Vector3(mx, my, 0.0f));
|
MouseRayNear = ViewProjInvMatrix.MultiplyW(new Vector3(mx, my, 1.0f));
|
||||||
MouseRayFar = ViewProjInvMatrix.MultiplyW(new Vector3(mx, my, 1.0f));
|
MouseRayFar = ViewProjInvMatrix.MultiplyW(new Vector3(mx, my, 0.0f));
|
||||||
MouseRay.Position = Vector3.Zero;
|
MouseRay.Position = Vector3.Zero;
|
||||||
MouseRay.Direction = Vector3.Normalize(MouseRayFar - MouseRayNear);
|
MouseRay.Direction = Vector3.Normalize(MouseRayFar - MouseRayNear);
|
||||||
if (IsMapView || IsOrthographic)
|
if (IsMapView || IsOrthographic)
|
||||||
|
@ -35,7 +35,7 @@ VS_OUTPUT main(VS_INPUT input, uint iid : SV_InstanceID)
|
|||||||
float3 ipos = input.Position.xyz * 0.25f;
|
float3 ipos = input.Position.xyz * 0.25f;
|
||||||
float3 opos = ipos + npos - CameraPos.xyz;
|
float3 opos = ipos + npos - CameraPos.xyz;
|
||||||
float4 cpos = mul(float4(opos, 1), ViewProj);
|
float4 cpos = mul(float4(opos, 1), ViewProj);
|
||||||
cpos.z -= 0.01; //bias paths depth slightly to bring it in front of normal geometry...
|
cpos.z *= 1.01; //bias paths depth slightly to bring it in front of normal geometry...
|
||||||
|
|
||||||
output.Position = cpos;
|
output.Position = cpos;
|
||||||
output.Colour = ((float4)1) * LightColour.a; //apply intensity
|
output.Colour = ((float4)1) * LightColour.a; //apply intensity
|
||||||
|
@ -36,7 +36,7 @@ VS_OUTPUT main(uint id : SV_VertexID)
|
|||||||
|
|
||||||
float3 opos = pos - CameraPos.xyz;
|
float3 opos = pos - CameraPos.xyz;
|
||||||
float4 cpos = mul(float4(opos, 1), ViewProj);
|
float4 cpos = mul(float4(opos, 1), ViewProj);
|
||||||
cpos.z -= 0.01; //bias paths depth slightly to bring it in front of normal geometry...
|
cpos.z *= 1.01; //bias paths depth slightly to bring it in front of normal geometry...
|
||||||
output.Position = cpos;
|
output.Position = cpos;
|
||||||
output.Colour.rgb = col.rgb * LightColour.a; //apply intensity
|
output.Colour.rgb = col.rgb * LightColour.a; //apply intensity
|
||||||
output.Colour.a = col.a;
|
output.Colour.a = col.a;
|
||||||
|
@ -28,7 +28,7 @@ VS_OUTPUT main(VS_INPUT input)
|
|||||||
|
|
||||||
float3 opos = pos - CameraPos.xyz;
|
float3 opos = pos - CameraPos.xyz;
|
||||||
float4 cpos = mul(float4(opos, 1), ViewProj);
|
float4 cpos = mul(float4(opos, 1), ViewProj);
|
||||||
cpos.z -= 0.01; //bias paths depth slightly to bring it in front of normal geometry...
|
cpos.z *= 1.01; //bias paths depth slightly to bring it in front of normal geometry...
|
||||||
output.Position = cpos;
|
output.Position = cpos;
|
||||||
output.Colour.rgb = col.rgb * LightColour.a; //apply intensity
|
output.Colour.rgb = col.rgb * LightColour.a; //apply intensity
|
||||||
output.Colour.a = col.a;
|
output.Colour.a = col.a;
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user