mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
- Added feature to toggle target highlight color on/off in Visual Mode.
- Highlight and selection colors are now hidden while dragging textures.
This commit is contained in:
parent
c543acd524
commit
6bcc670676
6 changed files with 46 additions and 12 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -595,6 +595,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Start drag now
|
||||
uvdragging = true;
|
||||
mode.Renderer.ShowSelection = false;
|
||||
mode.Renderer.ShowHighlight = false;
|
||||
UpdateDragUV();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue