- Handles on floor are shown

- Fixed a problem where the wrong plane was assigned to ceiling surfaces
This commit is contained in:
biwa 2020-01-01 21:47:33 +01:00
parent 4bfbe567c1
commit 55135f2982
6 changed files with 42 additions and 37 deletions

View file

@ -706,6 +706,7 @@
<EmbeddedResource Include="Resources\world3d_skybox.fp" />
<EmbeddedResource Include="Resources\world3d_skybox.vp" />
<EmbeddedResource Include="Resources\world3d_vertex_color.fp" />
<EmbeddedResource Include="Resources\world3d_slopehandle.vp" />
<None Include="Resources\Zoom.png" />
<None Include="Resources\Properties.png" />
<None Include="Resources\NewMap2.png" />

View file

@ -65,6 +65,7 @@ namespace CodeImp.DoomBuilder.Rendering
DeclareUniform(UniformName.texturefactor, "texturefactor", UniformType.Vec4);
DeclareUniform(UniformName.fogsettings, "fogsettings", UniformType.Vec4);
DeclareUniform(UniformName.fogcolor, "fogcolor", UniformType.Vec4);
DeclareUniform(UniformName.slopeHandleLength, "slopeHandleLength", UniformType.Float);
DeclareShader(ShaderName.display2d_fsaa, "display2d.vp", "display2d_fsaa.fp");
DeclareShader(ShaderName.display2d_normal, "display2d.vp", "display2d_normal.fp");
@ -88,7 +89,9 @@ namespace CodeImp.DoomBuilder.Rendering
DeclareShader(ShaderName.world3d_constant_color, "world3d_customvertexcolor.vp", "world3d_constant_color.fp");
DeclareShader(ShaderName.world3d_lightpass, "world3d_lightpass.vp", "world3d_lightpass.fp");
SetupSettings();
DeclareShader(ShaderName.world3d_slope_handle, "world3d_slopehandle.vp", "world3d_constant_color.fp");
SetupSettings();
}
~RenderDevice()
@ -632,7 +635,8 @@ namespace CodeImp.DoomBuilder.Rendering
world3d_main_highlight_fog_vertexcolor,
world3d_vertex_color,
world3d_constant_color,
world3d_lightpass
world3d_lightpass,
world3d_slope_handle
}
public enum UniformType : int
@ -665,7 +669,8 @@ namespace CodeImp.DoomBuilder.Rendering
campos,
texturefactor,
fogsettings,
fogcolor
fogcolor,
slopeHandleLength
}
public enum VertexFormat : int { Flat, World }

View file

@ -684,19 +684,15 @@ namespace CodeImp.DoomBuilder.Rendering
private void RenderSlopeHandles()
{
/*
if (visualslopehandles == null) return;
graphics.SetAlphaBlendEnable(true);
graphics.SetAlphaTestEnable(false);
graphics.SetZWriteEnable(false);
graphics.SetSourceBlend(Blend.SourceAlpha);
graphics.SetDestinationBlend(Blend.SourceAlpha);
graphics.SetDestinationBlend(Blend.InverseSourceAlpha);
graphics.Shaders.World3D.BeginPass(18);
// world = Matrix.Identity;
// ApplyMatrices3D();
graphics.SetShader(ShaderName.world3d_slope_handle);
foreach (VisualSlope handle in visualslopehandles)
{
@ -712,22 +708,25 @@ namespace CodeImp.DoomBuilder.Rendering
color = General.Colors.Vertices;
world = handle.Position;
ApplyMatrices3D();
graphics.SetUniform(UniformName.world, ref world);
graphics.SetUniform(UniformName.slopeHandleLength, handle.Length);
handle.Update(color);
//handle.Update();
graphics.Shaders.World3D.VertexColor = color.ToColorValue();
graphics.Shaders.World3D.SlopeHandleLength = handle.Length;
graphics.SetUniform(UniformName.vertexColor, color.ToColorValue());
//graphics.Shaders.World3D.SlopeHandleLength = handle.Length;
graphics.Shaders.World3D.ApplySettings();
// graphics.Device.SetStreamSource(0, handle.GeoBuffer, 0, WorldVertex.Stride);
graphics.Device.SetStreamSource(0, visualslopehandle.Geometry, 0, WorldVertex.Stride);
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2);
//graphics.Device.SetStreamSource(0, visualslopehandle.Geometry, 0, WorldVertex.Stride);
//graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2);
graphics.SetVertexBuffer(visualslopehandle.Geometry);
graphics.Draw(PrimitiveType.TriangleList, 0, 2);
}
// Done
graphics.SetUniform(UniformName.texturefactor, new Color4(1f, 1f, 1f, 1f));
*/
}
//mxd

View file

@ -61,6 +61,12 @@ namespace CodeImp.DoomBuilder.Rendering
WorldVertex v2 = new WorldVertex(1.0f, 8.0f, 0.5f);
WorldVertex v3 = new WorldVertex(0.0f, 8.0f, 0.5f);
//WorldVertex v0 = new WorldVertex(0.0f, 0.0f, 0.5f);
//WorldVertex v1 = new WorldVertex(32.0f, 0.0f, 0.5f);
//WorldVertex v2 = new WorldVertex(32.0f, 32.0f, 0.5f);
//WorldVertex v3 = new WorldVertex(0.0f, 32.0f, 0.5f);
v0.c = v1.c = PixelColor.INT_WHITE;
v2.c = v3.c = PixelColor.INT_WHITE_NO_ALPHA;

View file

@ -107,18 +107,17 @@ namespace CodeImp.DoomBuilder.VisualModes
return true;
}
public virtual bool Update(PixelColor color)
{
return true;
}
public virtual void Update() {}
public void SetPosition(Vector3D pos, Geometry.Plane plane, float angle)
{
Matrix translate = Matrix.Translation(pos.x, pos.y, pos.z);
Matrix rotate = Matrix.RotationZ(angle);
Vector3 v = new Vector3(plane.Normal.x, plane.Normal.y, plane.Normal.z);
// Matrix rotate = Matrix.RotationAxis(v, angle);
//position = Matrix.Multiply(rotate, translate);
position = Matrix.Multiply(rotate, translate);
}
#endregion

View file

@ -82,8 +82,7 @@ namespace CodeImp.DoomBuilder.VisualModes
return new RectangleF(left - SIZE, top - SIZE, right - left + SIZE*2, bottom - top + SIZE*2);
}
public bool Setup() { return Setup(General.Colors.Vertices); }
public bool Setup(PixelColor color)
public bool Setup()
{
if (sidedef == null)
return false;
@ -102,13 +101,14 @@ namespace CodeImp.DoomBuilder.VisualModes
// Line2D line = new Line2D(ld.Line.GetCoordinatesAt(ld.LengthInv * SIZE), ld.Line.GetCoordinatesAt(1.0f - (ld.LengthInv * SIZE)));
Line2D line = ld.Line;
UpdatePosition();
return true;
}
public override bool Update(PixelColor color)
public override void Update()
{
UpdatePosition();
return Setup(color);
}
/// <summary>
@ -373,25 +373,20 @@ namespace CodeImp.DoomBuilder.VisualModes
foreach (SectorLevel l in levels)
{
if (up)
Vector2D center = new Vector2D(l.sector.BBox.X + l.sector.BBox.Width / 2,
l.sector.BBox.Y + l.sector.BBox.Height / 2);
if (l.plane.Normal.z >= 0.0f)
{
l.sector.FloorSlope = plane.Normal;
l.sector.FloorSlopeOffset = plane.Offset;
Vector2D center = new Vector2D(l.sector.BBox.X + l.sector.BBox.Width / 2,
l.sector.BBox.Y + l.sector.BBox.Height / 2);
l.sector.FloorHeight = (int)new Plane(l.sector.FloorSlope, l.sector.FloorSlopeOffset).GetZ(center);
}
else
{
plane = plane.GetInverted();
l.sector.CeilSlope = plane.Normal;
l.sector.CeilSlopeOffset = plane.Offset;
Vector2D center = new Vector2D(l.sector.BBox.X + l.sector.BBox.Width / 2,
l.sector.BBox.Y + l.sector.BBox.Height / 2);
Plane downplane = plane.GetInverted();
l.sector.CeilSlope = downplane.Normal;
l.sector.CeilSlopeOffset = downplane.Offset;
l.sector.CeilHeight = (int)new Plane(l.sector.CeilSlope, l.sector.CeilSlopeOffset).GetZ(center);
}