diff --git a/Source/Core/Rendering/IRenderer3D.cs b/Source/Core/Rendering/IRenderer3D.cs index 9da503a5..56cc12c2 100644 --- a/Source/Core/Rendering/IRenderer3D.cs +++ b/Source/Core/Rendering/IRenderer3D.cs @@ -45,6 +45,8 @@ namespace CodeImp.DoomBuilder.Rendering ProjectedFrustum2D Frustum2D { get; } bool DrawThingCages { get; set; } bool FullBrightness { get; set; } + bool ShowSelection { get; set; } + bool ShowHighlight { get; set; } // General methods void PositionAndLookAt(Vector3D pos, Vector3D lookat); diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs index e64642dc..47c0bfcf 100644 --- a/Source/Core/Rendering/Renderer3D.cs +++ b/Source/Core/Rendering/Renderer3D.cs @@ -83,6 +83,8 @@ namespace CodeImp.DoomBuilder.Rendering private float highlightglowinv; private ColorImage highlightimage; private ColorImage selectionimage; + private bool showselection; + private bool showhighlight; // Geometry to be rendered. // Each Dictionary in the array is a render pass. @@ -106,6 +108,8 @@ namespace CodeImp.DoomBuilder.Rendering public ProjectedFrustum2D Frustum2D { get { return frustum; } } public bool DrawThingCages { get { return renderthingcages; } set { renderthingcages = value; } } public bool FullBrightness { get { return fullbrightness; } set { fullbrightness = value; } } + public bool ShowSelection { get { return showselection; } set { showselection = value; } } + public bool ShowHighlight { get { return showhighlight; } set { showhighlight = value; } } #endregion @@ -120,6 +124,8 @@ namespace CodeImp.DoomBuilder.Rendering SetupThingCage(); SetupTextures(); renderthingcages = true; + showselection = true; + showhighlight = true; // Dummy frustum frustum = new ProjectedFrustum2D(new Vector2D(), 0.0f, 0.0f, PROJ_NEAR_PLANE, @@ -533,7 +539,7 @@ namespace CodeImp.DoomBuilder.Rendering foreach(VisualThing t in thingsbydistance) { // Determine the shader pass we want to use for this object - int wantedshaderpass = ((t == highlighted) || t.Selected) ? highshaderpass : shaderpass; + int wantedshaderpass = (((t == highlighted) && showhighlight) || (t.Selected && showselection)) ? highshaderpass : shaderpass; // Switch shader pass? if(currentshaderpass != wantedshaderpass) @@ -550,7 +556,7 @@ namespace CodeImp.DoomBuilder.Rendering // Setup color if(currentshaderpass == highshaderpass) { - Color4 highcolor = CalculateHighlightColor((t == highlighted), t.Selected); + Color4 highcolor = CalculateHighlightColor((t == highlighted) && showhighlight, t.Selected && showselection); graphics.Shaders.World3D.SetHighlightColor(highcolor.ToArgb()); highcolor.Alpha = 1.0f; graphics.Shaders.World3D.SetModulateColor(highcolor.ToArgb()); @@ -634,7 +640,7 @@ namespace CodeImp.DoomBuilder.Rendering if(sector != null) { // Determine the shader pass we want to use for this object - int wantedshaderpass = ((g == highlighted) || g.Selected) ? highshaderpass : shaderpass; + int wantedshaderpass = (((g == highlighted) && showhighlight) || (g.Selected && showselection)) ? highshaderpass : shaderpass; // Switch shader pass? if(currentshaderpass != wantedshaderpass) @@ -647,12 +653,12 @@ namespace CodeImp.DoomBuilder.Rendering // Set the colors to use if(!graphics.Shaders.Enabled) { - graphics.Device.SetTexture(2, g.Selected ? selectionimage.Texture : null); - graphics.Device.SetTexture(3, (g == highlighted) ? highlightimage.Texture : null); + graphics.Device.SetTexture(2, (g.Selected && showselection) ? selectionimage.Texture : null); + graphics.Device.SetTexture(3, ((g == highlighted) && showhighlight) ? highlightimage.Texture : null); } else { - graphics.Shaders.World3D.SetHighlightColor(CalculateHighlightColor((g == highlighted), g.Selected).ToArgb()); + graphics.Shaders.World3D.SetHighlightColor(CalculateHighlightColor((g == highlighted) && showhighlight, (g.Selected && showselection)).ToArgb()); graphics.Shaders.World3D.ApplySettings(); } @@ -702,7 +708,7 @@ namespace CodeImp.DoomBuilder.Rendering if(t.GeometryBuffer != null) { // Determine the shader pass we want to use for this object - int wantedshaderpass = ((t == highlighted) || t.Selected) ? highshaderpass : shaderpass; + int wantedshaderpass = (((t == highlighted) && showhighlight) || (t.Selected && showselection)) ? highshaderpass : shaderpass; // Switch shader pass? if(currentshaderpass != wantedshaderpass) @@ -715,12 +721,12 @@ namespace CodeImp.DoomBuilder.Rendering // Set the colors to use if(!graphics.Shaders.Enabled) { - graphics.Device.SetTexture(2, t.Selected ? selectionimage.Texture : null); - graphics.Device.SetTexture(3, (t == highlighted) ? highlightimage.Texture : null); + graphics.Device.SetTexture(2, (t.Selected && showselection) ? selectionimage.Texture : null); + graphics.Device.SetTexture(3, ((t == highlighted) && showhighlight) ? highlightimage.Texture : null); } else { - graphics.Shaders.World3D.SetHighlightColor(CalculateHighlightColor((t == highlighted), t.Selected).ToArgb()); + graphics.Shaders.World3D.SetHighlightColor(CalculateHighlightColor((t == highlighted) && showhighlight, (t.Selected && showselection)).ToArgb()); } // Create the matrix for positioning / rotation diff --git a/Source/Plugins/BuilderModes/General/BuilderPlug.cs b/Source/Plugins/BuilderModes/General/BuilderPlug.cs index d2773c56..1ba0d9d7 100644 --- a/Source/Plugins/BuilderModes/General/BuilderPlug.cs +++ b/Source/Plugins/BuilderModes/General/BuilderPlug.cs @@ -78,6 +78,7 @@ namespace CodeImp.DoomBuilder.BuilderModes private float highlightrange; private float highlightthingsrange; private float splitlinedefsrange; + private bool usehighlight; #endregion @@ -112,6 +113,7 @@ namespace CodeImp.DoomBuilder.BuilderModes public float HighlightRange { get { return highlightrange; } } public float HighlightThingsRange { get { return highlightthingsrange; } } public float SplitLinedefsRange { get { return splitlinedefsrange; } } + public bool UseHighlight { get { return usehighlight; } set { usehighlight = value; } } #endregion @@ -126,6 +128,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // Settings showvisualthings = 2; usegravity = false; + usehighlight = true; LoadSettings(); // Load menus form and register it diff --git a/Source/Plugins/BuilderModes/Resources/Actions.cfg b/Source/Plugins/BuilderModes/Resources/Actions.cfg index 2bf2359d..26976b90 100644 --- a/Source/Plugins/BuilderModes/Resources/Actions.cfg +++ b/Source/Plugins/BuilderModes/Resources/Actions.cfg @@ -595,6 +595,16 @@ togglebrightness allowscroll = true; } +togglehighlight +{ + title = "Toggle Highlight"; + category = "visual"; + description = "Toggles the highlight of the targeted object in visual mode."; + allowkeys = true; + allowmouse = true; + allowscroll = true; +} + resettexture { title = "Reset Texture Offsets"; diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs index 2fc9247f..c93c468f 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs @@ -595,6 +595,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // Start drag now uvdragging = true; + mode.Renderer.ShowSelection = false; + mode.Renderer.ShowHighlight = false; UpdateDragUV(); } } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index 2d742bc9..7106a31e 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -495,7 +495,8 @@ namespace CodeImp.DoomBuilder.BuilderModes renderer.SetFogMode(true); // Set target for highlighting - renderer.SetHighlightedObject(target.picked); + if(BuilderPlug.Me.UseHighlight) + renderer.SetHighlightedObject(target.picked); // Begin with geometry renderer.StartGeometry(); @@ -865,6 +866,8 @@ namespace CodeImp.DoomBuilder.BuilderModes { PreActionNoChange(); GetTargetEventReceiver(true).OnSelectEnd(); + Renderer.ShowSelection = true; + Renderer.ShowHighlight = true; PostAction(); } @@ -1086,7 +1089,15 @@ namespace CodeImp.DoomBuilder.BuilderModes string onoff = renderer.FullBrightness ? "ON" : "OFF"; General.Interface.DisplayStatus(StatusType.Action, "Full Brightness is now " + onoff + "."); } - + + [BeginAction("togglehighlight")] + public void ToggleHighlight() + { + BuilderPlug.Me.UseHighlight = !BuilderPlug.Me.UseHighlight; + string onoff = BuilderPlug.Me.UseHighlight ? "ON" : "OFF"; + General.Interface.DisplayStatus(StatusType.Action, "Highlight is now " + onoff + "."); + } + [BeginAction("resettexture")] public void ResetTexture() {