mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
"Toggle Full Brightness" action now works in Classic modes.
This commit is contained in:
parent
b703a6569e
commit
640b874bd3
7 changed files with 29 additions and 14 deletions
|
@ -52,7 +52,7 @@ shortcuts
|
|||
buildermodes_fliplinedefs = 70;
|
||||
buildermodes_joinsectors = 74;
|
||||
buildermodes_removepoint = 8;
|
||||
buildermodes_brightnessmode = 66;
|
||||
buildermodes_brightnessmode = 65602;
|
||||
buildermodes_mergesectors = 65610;
|
||||
buildermodes_splitlinedefs = 0;
|
||||
buildermodes_visualmode = 87;
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
float Scale { get; }
|
||||
int VertexSize { get; }
|
||||
ViewMode ViewMode { get; }
|
||||
bool FullBrightness { get; set; } //mxd
|
||||
|
||||
// View methods
|
||||
Vector2D DisplayToMap(Vector2D mousepos);
|
||||
|
|
|
@ -88,6 +88,9 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Geometry plotter
|
||||
private Plotter plotter;
|
||||
|
||||
//mxd. Options
|
||||
private bool fullbrightness;
|
||||
|
||||
// Vertices to present the textures
|
||||
private VertexBuffer screenverts;
|
||||
private FlatVertex[] backimageverts;
|
||||
|
@ -140,7 +143,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
public int VertexSize { get { return vertexsize; } }
|
||||
public ViewMode ViewMode { get { return viewmode; } }
|
||||
public SurfaceManager Surfaces { get { return surfaces; } }
|
||||
public RectangleF Viewport { get { return viewport; } } //mxd
|
||||
public RectangleF Viewport { get { return viewport; } } //mxd
|
||||
public bool FullBrightness { get { return fullbrightness; } set { fullbrightness = value; } } //mxd
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -1319,7 +1323,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
// Draw
|
||||
graphics.Shaders.Display2D.Begin();
|
||||
graphics.Shaders.Display2D.BeginPass(2);
|
||||
graphics.Shaders.Display2D.BeginPass(1); //mxd
|
||||
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, text.NumFaces >> 1);
|
||||
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, text.NumFaces);
|
||||
graphics.Shaders.Display2D.EndPass();
|
||||
|
@ -1467,25 +1471,23 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
//mxd
|
||||
public void RenderArrow(Line3D line, PixelColor c) {
|
||||
float scaler = 20f / scale;
|
||||
//foreach(Line3D l in lines) {
|
||||
|
||||
RenderLine(line.v1, line.v2, 0.8f, c, true);
|
||||
float angle = line.GetAngle();
|
||||
//arrowhead
|
||||
RenderLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle - 0.46f), line.v2.y + scaler * (float)Math.Cos(angle - 0.46f)), 0.8f, c, true);
|
||||
RenderLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle + 0.46f), line.v2.y + scaler * (float)Math.Cos(angle + 0.46f)), 0.8f, c, true);
|
||||
//}
|
||||
}
|
||||
|
||||
//mxd
|
||||
public void PlotArrow(Line3D line, PixelColor c) {
|
||||
float scaler = 16f / scale;
|
||||
//foreach(Line3D l in lines) {
|
||||
|
||||
PlotLine(line.v1, line.v2, c);
|
||||
float angle = line.GetAngle();
|
||||
//arrowhead
|
||||
PlotLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle - 0.46f), line.v2.y + scaler * (float)Math.Cos(angle - 0.46f)), c);
|
||||
PlotLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle + 0.46f), line.v2.y + scaler * (float)Math.Cos(angle + 0.46f)), c);
|
||||
//}
|
||||
}
|
||||
|
||||
// This renders a line with given color
|
||||
|
|
|
@ -653,6 +653,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
{
|
||||
if(!resourcesunloaded)
|
||||
{
|
||||
int pass = General.Map.Renderer2D.FullBrightness ? 2 : 1; //mxd
|
||||
graphics.Shaders.Display2D.Begin();
|
||||
foreach(KeyValuePair<ImageData, List<SurfaceEntry>> imgsurfaces in surfaces)
|
||||
{
|
||||
|
@ -660,7 +661,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Shaders.Display2D.Texture1 = imgsurfaces.Key.Texture;
|
||||
if(!graphics.Shaders.Enabled) graphics.Device.SetTexture(0, imgsurfaces.Key.Texture);
|
||||
|
||||
graphics.Shaders.Display2D.BeginPass(1);
|
||||
graphics.Shaders.Display2D.BeginPass(pass);
|
||||
|
||||
// Go for all surfaces
|
||||
VertexBuffer lastbuffer = null;
|
||||
|
|
|
@ -111,12 +111,12 @@ float4 ps_normal(PixelData pd) : COLOR
|
|||
return float4(c.rgb, c.a * rendersettings.w) * pd.color;
|
||||
}
|
||||
|
||||
// Pixel shader for text
|
||||
float4 ps_text(PixelData pd) : COLOR
|
||||
//mxd. Pixel shader for full bright drawing
|
||||
float4 ps_fullbright(PixelData pd) : COLOR
|
||||
{
|
||||
// Take this pixel's color
|
||||
float4 c = tex2D(texture1linear, pd.uv);
|
||||
return float4(c.rgb, c.a * rendersettings.w) * pd.color;
|
||||
return float4(c.rgb, c.a * rendersettings.w);
|
||||
}
|
||||
|
||||
// Technique for shader model 2.0
|
||||
|
@ -134,9 +134,9 @@ technique SM20
|
|||
PixelShader = compile ps_2_0 ps_normal();
|
||||
}
|
||||
|
||||
pass p2
|
||||
pass p2 //mxd
|
||||
{
|
||||
VertexShader = compile vs_2_0 vs_transform();
|
||||
PixelShader = compile ps_2_0 ps_text();
|
||||
PixelShader = compile ps_2_0 ps_fullbright();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,6 +226,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
paintselectpressed = false;
|
||||
}
|
||||
|
||||
//mxd
|
||||
[BeginAction("togglebrightness")]
|
||||
protected virtual void ToggleBrightness() {
|
||||
renderer.FullBrightness = !renderer.FullBrightness;
|
||||
string onoff = renderer.FullBrightness ? "ON" : "OFF";
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Full Brightness is now " + onoff + ".");
|
||||
|
||||
// Redraw display to show changes
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -856,7 +856,7 @@ togglegravity
|
|||
togglebrightness
|
||||
{
|
||||
title = "Toggle Full Brightness";
|
||||
category = "visual";
|
||||
category = "tools";
|
||||
description = "Toggles the use of sector brightness on and off. When sector brightness is off, the world is displayed fully bright, without lighting effects.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
|
|
Loading…
Reference in a new issue