From e4751dfaf12a5f457ad7e554bece8b79e924d538 Mon Sep 17 00:00:00 2001 From: MaxED Date: Thu, 2 May 2013 11:03:16 +0000 Subject: [PATCH] Visual Mode, UDMF, Visual Vertices: heights of vertices without z-offset was incorrect in some cases. Visual Mode, UDMF, Visual Vertices: vertices without z-offset are now rendered using Vertex color (Preferences -> Appearance -> Vertices). --- Source/Core/Rendering/Renderer3D.cs | 2 +- Source/Core/VisualModes/VisualVertex.cs | 2 ++ .../BuilderModes/VisualModes/BaseVisualMode.cs | 3 --- .../BuilderModes/VisualModes/BaseVisualVertex.cs | 11 ++++++++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs index a614793b..f4827b54 100644 --- a/Source/Core/Rendering/Renderer3D.cs +++ b/Source/Core/Rendering/Renderer3D.cs @@ -641,7 +641,7 @@ namespace CodeImp.DoomBuilder.Rendering if(v.Selected && showselection) { color = General.Colors.Selection3D.ToColorValue(); } else { - color = General.Colors.InfoLine.ToColorValue(); + color = v.HaveHeightOffset ? General.Colors.InfoLine.ToColorValue() : General.Colors.Vertices.ToColorValue(); if(v != highlighted) color.Alpha = 0.6f; } graphics.Shaders.World3D.VertexColor = color; diff --git a/Source/Core/VisualModes/VisualVertex.cs b/Source/Core/VisualModes/VisualVertex.cs index 55fdeb12..364de8f5 100644 --- a/Source/Core/VisualModes/VisualVertex.cs +++ b/Source/Core/VisualModes/VisualVertex.cs @@ -43,6 +43,7 @@ namespace CodeImp.DoomBuilder.VisualModes protected bool selected; protected bool changed; protected bool ceilingVertex; + protected bool haveOffset; //Properties internal Matrix Position { get { return position; } } @@ -50,6 +51,7 @@ namespace CodeImp.DoomBuilder.VisualModes public bool Selected { get { return selected; } set { selected = value; } } public bool Changed { get { return changed; } set { changed |= value; } } public bool CeilingVertex { get { return ceilingVertex; } } + public bool HaveHeightOffset { get { return haveOffset; } } public VisualVertex(Vertex v, bool ceilingVertex) { vertex = v; diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index 9a0897cf..85b03ef5 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -562,9 +562,6 @@ namespace CodeImp.DoomBuilder.BuilderModes i.OnDelete(); } - // Update cache values - //General.Map.IsChanged = true; - PostAction(); } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualVertex.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualVertex.cs index edba0c22..1062be96 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualVertex.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualVertex.cs @@ -44,10 +44,15 @@ namespace CodeImp.DoomBuilder.BuilderModes if(vertex.Fields.ContainsKey(key)) { z = vertex.Fields.GetValue(key, 0f); - if(z == height && neighboursHaveSameHeight(height)) //don't create garbage data! + if(z == height && neighboursHaveSameHeight(height)) { //don't create garbage data! vertex.Fields.Remove(key); + haveOffset = false; + } else { + haveOffset = true; + } } else { z = height; + haveOffset = false; } Vector3D pos = new Vector3D(vertex.Position.x, vertex.Position.y, z); @@ -96,13 +101,13 @@ namespace CodeImp.DoomBuilder.BuilderModes if(ceilingVertex) { height = sectors[0].CeilHeight; for(int i = 1; i < sectors.Length; i++) { - if(sectors[i].Sidedefs.Count == 3 && sectors[i].CeilHeight < height) + if(sectors[i].CeilHeight < height) height = sectors[i].CeilHeight; } } else { height = sectors[0].FloorHeight; for(int i = 1; i < sectors.Length; i++) { - if(sectors[i].Sidedefs.Count == 3 && sectors[i].FloorHeight > height) + if(sectors[i].FloorHeight > height) height = sectors[i].FloorHeight; } }