mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2025-01-07 10:32:55 +08:00
Reversed depth buffer
This commit is contained in:
parent
7fb07e1a27
commit
442d623302
@ -24,8 +24,8 @@ namespace CodeWalker.World
|
||||
public float FieldOfView;// 1.0f;
|
||||
public float FieldOfViewFactor = 0.5f / (float)Math.Tan(/*FieldOfView*/ 1.0f * 0.5f);
|
||||
public float AspectRatio = 1920.0f / 1080.0f;
|
||||
public float ZNear = 0.5f;
|
||||
public float ZFar = 12000.0f;
|
||||
public float ZNear = 0.01f;
|
||||
public float ZFar = 100000.0f;
|
||||
public Entity FollowEntity = null;
|
||||
public Vector3 LocalLookAt = Vector3.ForwardLH;
|
||||
public float VOffset = 0.0f;
|
||||
@ -176,15 +176,15 @@ namespace CodeWalker.World
|
||||
{
|
||||
if (IsMapView)
|
||||
{
|
||||
ProjMatrix = Matrix.OrthoRH(AspectRatio * OrthographicSize, OrthographicSize, 1.0f, 3000.0f);
|
||||
ProjMatrix = Matrix.OrthoRH(AspectRatio * OrthographicSize, OrthographicSize, 3000.0f, 1.0f);
|
||||
}
|
||||
else if (IsOrthographic)
|
||||
{
|
||||
ProjMatrix = Matrix.OrthoRH(AspectRatio * OrthographicSize, OrthographicSize, ZNear, ZFar);
|
||||
ProjMatrix = Matrix.OrthoRH(AspectRatio * OrthographicSize, OrthographicSize, ZFar, ZNear);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProjMatrix = Matrix.PerspectiveFovRH(FieldOfView, AspectRatio, ZNear, ZFar);
|
||||
ProjMatrix = Matrix.PerspectiveFovRH(FieldOfView, AspectRatio, ZFar, ZNear);
|
||||
}
|
||||
//ProjMatrix._33/=ZFar;
|
||||
//ProjMatrix._43/=ZFar;
|
||||
@ -301,8 +301,8 @@ namespace CodeWalker.World
|
||||
Planes[1] = Plane.Normalize(new Plane((vp.M14 - vp.M11), (vp.M24 - vp.M21), (vp.M34 - vp.M31), (vp.M44 - vp.M41)));
|
||||
Planes[2] = Plane.Normalize(new Plane((vp.M14 - vp.M12), (vp.M24 - vp.M22), (vp.M34 - vp.M32), (vp.M44 - vp.M42)));
|
||||
Planes[3] = Plane.Normalize(new Plane((vp.M14 + vp.M12), (vp.M24 + vp.M22), (vp.M34 + vp.M32), (vp.M44 + vp.M42)));
|
||||
Planes[4] = Plane.Normalize(new Plane((vp.M13), (vp.M23), (vp.M33), 0.0f));//(vp.M43));
|
||||
Planes[5] = Plane.Normalize(new Plane((vp.M14 - vp.M13), (vp.M24 - vp.M23), (vp.M34 - vp.M33), (vp.M44 - vp.M43)));
|
||||
Planes[4] = Plane.Normalize(new Plane((vp.M14 - vp.M13), (vp.M24 - vp.M23), (vp.M34 - vp.M33), (vp.M44 - vp.M43)));
|
||||
Planes[5] = Plane.Normalize(new Plane((vp.M13), (vp.M23), (vp.M33), 0.0f));//(vp.M43));
|
||||
}
|
||||
|
||||
//public bool ContainsSphere(ref Vector3 c, float cls, float r)
|
||||
|
@ -430,8 +430,6 @@ namespace CodeWalker.Forms
|
||||
camera.TargetDistance = rad * 1.6f;
|
||||
camera.CurrentDistance = rad * 1.6f;
|
||||
|
||||
camera.ZFar = Math.Min(rad * 200.0f, 12000.0f);
|
||||
camera.ZNear = Math.Min(camera.ZFar * 5e-5f, 0.5f);
|
||||
camera.UpdateProj = true;
|
||||
}
|
||||
|
||||
|
@ -491,8 +491,6 @@ namespace CodeWalker.Peds
|
||||
camera.TargetDistance = rad * 1.2f;
|
||||
camera.CurrentDistance = rad * 1.2f;
|
||||
|
||||
camera.ZFar = Math.Min(rad * 200.0f, 12000.0f);
|
||||
camera.ZNear = Math.Min(camera.ZFar * 5e-5f, 0.5f);
|
||||
camera.UpdateProj = true;
|
||||
|
||||
}
|
||||
|
@ -322,11 +322,11 @@ namespace CodeWalker.Rendering
|
||||
public void ClearRenderTarget(DeviceContext ctx)
|
||||
{
|
||||
ctx.ClearRenderTargetView(targetview, clearcolour);
|
||||
ctx.ClearDepthStencilView(depthview, DepthStencilClearFlags.Depth, 1.0f, 0);
|
||||
ctx.ClearDepthStencilView(depthview, DepthStencilClearFlags.Depth, 0.0f, 0);
|
||||
}
|
||||
public void ClearDepth(DeviceContext ctx)
|
||||
{
|
||||
ctx.ClearDepthStencilView(depthview, DepthStencilClearFlags.Depth, 1.0f, 0);
|
||||
ctx.ClearDepthStencilView(depthview, DepthStencilClearFlags.Depth, 0.0f, 0);
|
||||
}
|
||||
public void SetDefaultRenderTarget(DeviceContext ctx)
|
||||
{
|
||||
|
@ -176,16 +176,16 @@ namespace CodeWalker.Rendering
|
||||
{
|
||||
BackFace = new DepthStencilOperationDescription()
|
||||
{
|
||||
Comparison = Comparison.LessEqual,
|
||||
Comparison = Comparison.GreaterEqual,
|
||||
DepthFailOperation = StencilOperation.Zero,
|
||||
FailOperation = StencilOperation.Zero,
|
||||
PassOperation = StencilOperation.Zero,
|
||||
},
|
||||
DepthComparison = Comparison.LessEqual,
|
||||
DepthComparison = Comparison.GreaterEqual,
|
||||
DepthWriteMask = DepthWriteMask.All,
|
||||
FrontFace = new DepthStencilOperationDescription()
|
||||
{
|
||||
Comparison = Comparison.LessEqual,
|
||||
Comparison = Comparison.GreaterEqual,
|
||||
DepthFailOperation = StencilOperation.Zero,
|
||||
FailOperation = StencilOperation.Zero,
|
||||
PassOperation = StencilOperation.Zero
|
||||
|
@ -380,7 +380,7 @@ namespace CodeWalker.Rendering
|
||||
context.ClearRenderTargetView(MSRTV, colour);
|
||||
if (UseDepth)
|
||||
{
|
||||
context.ClearDepthStencilView(MSDSV, DepthStencilClearFlags.Depth, 1.0f, 0);
|
||||
context.ClearDepthStencilView(MSDSV, DepthStencilClearFlags.Depth, 0.0f, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -388,7 +388,7 @@ namespace CodeWalker.Rendering
|
||||
context.ClearRenderTargetView(RTV, colour);
|
||||
if (UseDepth)
|
||||
{
|
||||
context.ClearDepthStencilView(DSV, DepthStencilClearFlags.Depth, 1.0f, 0);
|
||||
context.ClearDepthStencilView(DSV, DepthStencilClearFlags.Depth, 0.0f, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -398,11 +398,11 @@ namespace CodeWalker.Rendering
|
||||
if (!UseDepth) return;
|
||||
if (Multisampled)
|
||||
{
|
||||
context.ClearDepthStencilView(MSDSV, DepthStencilClearFlags.Depth, 1.0f, 0);
|
||||
context.ClearDepthStencilView(MSDSV, DepthStencilClearFlags.Depth, 0.0f, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.ClearDepthStencilView(DSV, DepthStencilClearFlags.Depth, 1.0f, 0);
|
||||
context.ClearDepthStencilView(DSV, DepthStencilClearFlags.Depth, 0.0f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -441,8 +441,6 @@ namespace CodeWalker.Vehicles
|
||||
camera.TargetDistance = rad * 1.6f;
|
||||
camera.CurrentDistance = rad * 1.6f;
|
||||
|
||||
camera.ZFar = Math.Min(rad * 200.0f, 12000.0f);
|
||||
camera.ZNear = Math.Min(camera.ZFar * 5e-5f, 0.5f);
|
||||
camera.UpdateProj = true;
|
||||
|
||||
}
|
||||
|
6
WorldForm.Designer.cs
generated
6
WorldForm.Designer.cs
generated
@ -1698,7 +1698,7 @@ namespace CodeWalker
|
||||
this.FarClipUpDown.Size = new System.Drawing.Size(114, 20);
|
||||
this.FarClipUpDown.TabIndex = 61;
|
||||
this.FarClipUpDown.Value = new decimal(new int[] {
|
||||
12000,
|
||||
100000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
@ -1736,10 +1736,10 @@ namespace CodeWalker
|
||||
this.NearClipUpDown.Size = new System.Drawing.Size(114, 20);
|
||||
this.NearClipUpDown.TabIndex = 59;
|
||||
this.NearClipUpDown.Value = new decimal(new int[] {
|
||||
5,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
131072});
|
||||
this.NearClipUpDown.ValueChanged += new System.EventHandler(this.NearClipUpDown_ValueChanged);
|
||||
//
|
||||
// label31
|
||||
|
@ -240,6 +240,14 @@ ufo
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB4SURBVDhP3ZC7DcAgDEQZKTMwHOvSIFriS7BlEB+HMic9
|
||||
QJbvFThLUkpXzjkSpaeuzMPlEELx3jdsBauyCHBY6UWYPQI93KEljQD3jL6EGzN6x0bASyNYwkKU8Udm
|
||||
gd6TMnIikDJyIqjVNz8T7FgKrAwFX6lVinM3aJ05lWDPRRcAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="ToolbarTransformSpaceButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB0SURBVDhP7ZNBCoAgEEXnSJ3BqxmetNpaMLhVv5DNRJS2
|
||||
CxIeuvA9XSjtg5mHEILPxB6U7JyLxphmSkDK1o5x9dst87SUfTXwRsYsA+paT0BGDGsVOJ92hdz3Bz4f
|
||||
wGPC48uu7w5IGd+gBlpRMgYCnRwyESUj3CsQkYNFDwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="ToolbarObjectSpaceButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
@ -261,12 +269,13 @@ ufo
|
||||
WBXYx9R1nV75RuyHKrrnzCcGjE1u9ZyD4BugoZigQ9xrngAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="ToolbarTransformSpaceButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<data name="ToolbarSnapButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB0SURBVDhP7ZNBCoAgEEXnSJ3BqxmetNpaMLhVv5DNRJS2
|
||||
CxIeuvA9XSjtg5mHEILPxB6U7JyLxphmSkDK1o5x9dst87SUfTXwRsYsA+paT0BGDGsVOJ92hdz3Bz4f
|
||||
wGPC48uu7w5IGd+gBlpRMgYCnRwyESUj3CsQkYNFDwAAAABJRU5ErkJggg==
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACtSURBVDhPrZBBEsIgEAR5Gy/wFV55T/wHr+KgHuCKNsVY
|
||||
ZI2JiU7VVIVlp7OL+1mllIr7cb8Ie++PQwQYITnnM24NWxoBgsQYm/l+gk699bMsRA4h1JTSPsg0Xert
|
||||
em/mGwh3vW1Z7MvIABSWqXG3+iZHAEw1m4wD49oVANgVOL/VeSgeDAiX1mpWeKy9BIQiI+OxWQF77tG5
|
||||
2Fc729BmeElf/3lNhORe+oecewDObEqX49RqCgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="ToolbarSnapToGroundButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
@ -295,15 +304,6 @@ ufo
|
||||
EcMw2DzPDMEke9AsYBrHs10vN4I1QqImwwDcFyMjQGaBHr5Bo8nEoYCnCQTGzVeI4oj6fIi+KHgoPBhC
|
||||
4knCjTww9vxfbIUQNDEyiGIZ8t6tW/k0vC/AOpuiueNOLwVkUeylvju9FJCg8E1vM/2PlTv5UoervVTJ
|
||||
uQAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="ToolbarSnapButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACtSURBVDhPrZBBEsIgEAR5Gy/wFV55T/wHr+KgHuCKNsVY
|
||||
ZI2JiU7VVIVlp7OL+1mllIr7cb8Ie++PQwQYITnnM24NWxoBgsQYm/l+gk699bMsRA4h1JTSPsg0Xert
|
||||
em/mGwh3vW1Z7MvIABSWqXG3+iZHAEw1m4wD49oVANgVOL/VeSgeDAiX1mpWeKy9BIQiI+OxWQF77tG5
|
||||
2Fc729BmeElf/3lNhORe+oecewDObEqX49RqCgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="ToolbarUndoButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
@ -389,6 +389,17 @@ ufo
|
||||
4BJN+IjGo5O8ZJndGVhKxpjWWts551aih0fre+0BLaVchRAezPB2NXSSV/gVwXGYPJiVUt6ns1ghCDjn
|
||||
UQG86w3FToVgDcWCWS9Fvi/Ao0RVAcwUjwpyhzmf4n8BFApS5HZRwRuONGMbrIJ1JIN8O2QAAAAASUVO
|
||||
RK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="ToolbarCameraModeButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEvSURBVDhP3dK/K0dRGMfxKxRJopCSEkLya/guUhQRmQwG
|
||||
WfwIkYySgYUSKUKJlOK/MBoMFMofYLUIsfJ+f3NuF3+A8tRree5zP/fcc070f6oHT/jAPTqQj6WvXvCM
|
||||
TZQgG3H58gFGcYVLtGIN15jBNDbwiGNUIg4pQx8GsQuHhrCDW8yjHyns4Q0DcCXpykM5bFzgHGPYxw1G
|
||||
UIVMtMHfWUUj4nIg/KurGIYrSAZYOXDGlbhXcZlegUO8Yxzb+BlQAwNW0G0jVAYK0AwHtnCEOyQDZvGC
|
||||
ObTbKIIvLMA9WIYDizhFMsDjfsAZptCA9JcdfoVBvryOSbgCe4HPTuCz+BQMKEUvJmCy96ET1ehCuAf2
|
||||
5ZF+uwdZKEYtmuBGFSIXhtejBe5PHX7dxL+qKPoEppRHcXOtiDsAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="ToolbarCameraPerspectiveButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
@ -424,17 +435,6 @@ ufo
|
||||
rp3fhGJScIRLzKMLFTC9cMIu3nCDVUyjB6WkYA93mEWbAyH9cMImPuA+rWMA31YwBU82kF6BS32Er/aO
|
||||
M8zAh+OEghpcwQ2bg3uwBW8ewFd7xQkm0IA4oaAS7bh2KHjBIZbhV/D6GJkFphrdcIP8lFrAGPwPOjCO
|
||||
QdQiTqrAWNICd7gPnUj+xBKaU9dxfhTkjwV/FxU+AbsiGnc46OYIAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="ToolbarCameraModeButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEvSURBVDhP3dK/K0dRGMfxKxRJopCSEkLya/guUhQRmQwG
|
||||
WfwIkYySgYUSKUKJlOK/MBoMFMofYLUIsfJ+f3NuF3+A8tRree5zP/fcc070f6oHT/jAPTqQj6WvXvCM
|
||||
TZQgG3H58gFGcYVLtGIN15jBNDbwiGNUIg4pQx8GsQuHhrCDW8yjHyns4Q0DcCXpykM5bFzgHGPYxw1G
|
||||
UIVMtMHfWUUj4nIg/KurGIYrSAZYOXDGlbhXcZlegUO8Yxzb+BlQAwNW0G0jVAYK0AwHtnCEOyQDZvGC
|
||||
ObTbKIIvLMA9WIYDizhFMsDjfsAZptCA9JcdfoVBvryOSbgCe4HPTuCz+BQMKEUvJmCy96ET1ehCuAf2
|
||||
5ZF+uwdZKEYtmuBGFSIXhtejBe5PHX7dxL+qKPoEppRHcXOtiDsAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="SubtitleTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
|
Loading…
Reference in New Issue
Block a user