diff --git a/Source/Core/Data/ImageDataFormat.cs b/Source/Core/Data/ImageDataFormat.cs index 77a830fc..7892460c 100644 --- a/Source/Core/Data/ImageDataFormat.cs +++ b/Source/Core/Data/ImageDataFormat.cs @@ -55,7 +55,7 @@ namespace CodeImp.DoomBuilder.Data // This check image data and returns the appropriate image reader public static IImageReader GetImageReader(Stream data, int guessformat, Playpal palette) { - BinaryReader bindata = new BinaryReader(data); + //BinaryReader bindata = new BinaryReader(data); DoomPictureReader picreader; DoomFlatReader flatreader; DoomColormapReader colormapreader; diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs index c35158f2..041a57bd 100644 --- a/Source/Core/Rendering/Renderer3D.cs +++ b/Source/Core/Rendering/Renderer3D.cs @@ -623,14 +623,11 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha); graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.SourceAlpha); - //mxd. Doesn't look nearly as good as I expected :( - //graphics.Device.SetRenderState(RenderState.AntialiasedLineEnable, General.Settings.QualityDisplay); - graphics.Shaders.World3D.BeginPass(16); foreach (VisualThing t in thingsbydistance) { // Setup matrix - world = Matrix.Multiply(t.CageScales, t.Position); + world = Matrix.Multiply(t.CageScales, t.ScaledPosition); //mxd. GZDoom vertical scale hack ApplyMatrices3D(); // Setup color @@ -651,7 +648,7 @@ namespace CodeImp.DoomBuilder.Rendering //and arrow float sx = t.CageScales.M11; Matrix arrowScaler = Matrix.Scaling(sx, sx, sx); //scale arrow evenly based on thing width\depth - world = Matrix.Multiply(arrowScaler, t.Position * Matrix.Translation(0.0f, 0.0f, t.CageScales.M33 / 2)); + world = Matrix.Multiply(arrowScaler, t.ScaledPosition * Matrix.Translation(0.0f, 0.0f, t.CageScales.M33 / 2)); //mxd. GZDoom vertical scale hack Matrix rot = Matrix.RotationZ(t.Thing.Angle - Angle2D.PI / 2); world = Matrix.Multiply(rot, world); ApplyMatrices3D(); @@ -744,7 +741,11 @@ namespace CodeImp.DoomBuilder.Rendering litGeometry[curtexture.Texture] = new List(); litGeometry[curtexture.Texture].Add(g); } - } + } + + //mxd. Scale everything to match GZDoom's wicked way of rendering + world = Matrix.Scaling(new Vector3(1.0f, 1.0f, 1.2f)); + ApplyMatrices3D(); // Switch shader pass? if(currentshaderpass != wantedshaderpass) @@ -861,7 +862,7 @@ namespace CodeImp.DoomBuilder.Rendering // Create the matrix for positioning / rotation world = t.Orientation; if (t.Billboard) world = Matrix.Multiply(world, billboard); - world = Matrix.Multiply(world, t.Position); + world = Matrix.Multiply(world, t.ScaledPosition); //mxd. GZDoom vertical scale hack ApplyMatrices3D(); //mxd. set variables for fog rendering diff --git a/Source/Core/VisualModes/VisualMode.cs b/Source/Core/VisualModes/VisualMode.cs index ae343356..2c3b2bbc 100644 --- a/Source/Core/VisualModes/VisualMode.cs +++ b/Source/Core/VisualModes/VisualMode.cs @@ -46,6 +46,7 @@ namespace CodeImp.DoomBuilder.VisualModes #region ================== Constants private const float MOVE_SPEED_MULTIPLIER = 0.001f; + private const float SCALE_OFFSET = 1f / 1.2f; //mxd GZDoom vertical scale hack #endregion @@ -647,7 +648,11 @@ namespace CodeImp.DoomBuilder.VisualModes // This picks an object from the scene public VisualPickResult PickObject(Vector3D from, Vector3D to) { - VisualPickResult result = new VisualPickResult(); + //mxd GZDoom vertical scale hack + to.z *= SCALE_OFFSET; + from.z *= SCALE_OFFSET; + + VisualPickResult result = new VisualPickResult(); Line2D ray2d = new Line2D(from, to); Vector3D delta = to - from; diff --git a/Source/Core/VisualModes/VisualThing.cs b/Source/Core/VisualModes/VisualThing.cs index fb5d94f2..37c689f1 100644 --- a/Source/Core/VisualModes/VisualThing.cs +++ b/Source/Core/VisualModes/VisualThing.cs @@ -83,6 +83,7 @@ namespace CodeImp.DoomBuilder.VisualModes //mxd private int cameraDistance3D; private int thingHeight; + private Matrix scaledPosition; //mxd GZDoom vertical scale hack //mxd. light properties private int lightType; @@ -124,6 +125,7 @@ namespace CodeImp.DoomBuilder.VisualModes } } public Vector3 PositionV3 { get { return position_v3; } } + public Matrix ScaledPosition { get { return scaledPosition; } } //mxd GZDoom vertical scale hack public Vector3[] BoundingBox { get { return boundingBox; } } //mxd. light properties public int LightType { get { return lightType; } } @@ -185,6 +187,7 @@ namespace CodeImp.DoomBuilder.VisualModes lightInterval = -1; lightColor = new Color4(); boundingBox = new Vector3[9]; + scaledPosition = position; //mxd GZDoom vertical scale hack // Register as resource General.Map.Graphics.RegisterResource(this); @@ -268,6 +271,7 @@ namespace CodeImp.DoomBuilder.VisualModes //mxd position_v3 = D3DDevice.V3(pos); position = Matrix.Translation(position_v3); + scaledPosition = Matrix.Translation(position_v3.X, position_v3.Y, position_v3.Z * 1.2f); //mxd GZDoom vertical scale hack //mxd. update bounding box if (thing.IsModel) {