mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
added full brightness toggle feature in visual mode
This commit is contained in:
parent
349cf877f9
commit
f351822859
6 changed files with 50 additions and 14 deletions
|
@ -3,10 +3,6 @@ quality over quantity. It is done when it's done.
|
|||
The order and included items may also change any time.
|
||||
=========================================================
|
||||
|
||||
- Offsets in info panel are not updated when dragging textue or changing texture offsets.
|
||||
|
||||
- Full brightness option in Visual Mode
|
||||
|
||||
- Info panel should be collapsable
|
||||
|
||||
- Create menus for different modes
|
||||
|
|
|
@ -477,6 +477,16 @@ togglegravity
|
|||
allowscroll = true;
|
||||
}
|
||||
|
||||
togglebrightness
|
||||
{
|
||||
title = "Toggle Full Brightness";
|
||||
category = "visual";
|
||||
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;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
placevisualstart
|
||||
{
|
||||
title = "Place Visual Mode Camera";
|
||||
|
|
|
@ -349,11 +349,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
#endregion
|
||||
|
||||
#region ================== Actions
|
||||
|
||||
|
||||
[BeginAction("visualselect", BaseAction = true)]
|
||||
public void BeginSelect()
|
||||
{
|
||||
General.WriteLogLine("BeginSelect");
|
||||
PickTargetUnlocked();
|
||||
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectBegin();
|
||||
}
|
||||
|
@ -361,7 +360,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
[EndAction("visualselect", BaseAction = true)]
|
||||
public void EndSelect()
|
||||
{
|
||||
General.WriteLogLine("EndSelect");
|
||||
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectEnd();
|
||||
}
|
||||
|
||||
|
@ -536,6 +534,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
BuilderPlug.Me.UseGravity = !BuilderPlug.Me.UseGravity;
|
||||
}
|
||||
|
||||
[BeginAction("togglebrightness")]
|
||||
public void ToggleBrightness()
|
||||
{
|
||||
renderer.FullBrightness = !renderer.FullBrightness;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Properties
|
||||
ProjectedFrustum2D Frustum2D { get; }
|
||||
bool DrawThingCages { get; set; }
|
||||
bool FullBrightness { get; set; }
|
||||
|
||||
// General methods
|
||||
void PositionAndLookAt(Vector3D pos, Vector3D lookat);
|
||||
|
|
|
@ -58,6 +58,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
private Matrix view2d;
|
||||
private Matrix world;
|
||||
private Vector3D cameraposition;
|
||||
private int shaderpass;
|
||||
|
||||
// Options
|
||||
private bool fullbrightness;
|
||||
|
||||
// Window size
|
||||
private Size windowsize;
|
||||
|
@ -94,6 +98,7 @@ 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; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -376,6 +381,9 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
world = Matrix.Identity;
|
||||
ApplyMatrices3D();
|
||||
|
||||
// Determine shader pass to use
|
||||
if(fullbrightness) shaderpass = 1; else shaderpass = 0;
|
||||
|
||||
// Create crosshair vertices
|
||||
if(crosshairverts == null)
|
||||
CreateCrosshairVerts(new Size(General.Map.Data.Crosshair3D.Width, General.Map.Data.Crosshair3D.Height));
|
||||
|
@ -419,7 +427,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// SOLID PASS
|
||||
world = Matrix.Identity;
|
||||
ApplyMatrices3D();
|
||||
graphics.Shaders.World3D.BeginPass(0);
|
||||
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||
RenderSinglePass((int)RenderPass.Solid);
|
||||
graphics.Shaders.World3D.EndPass();
|
||||
|
||||
|
@ -427,7 +435,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
world = Matrix.Identity;
|
||||
ApplyMatrices3D();
|
||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, true);
|
||||
graphics.Shaders.World3D.BeginPass(0);
|
||||
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||
RenderSinglePass((int)RenderPass.Mask);
|
||||
graphics.Shaders.World3D.EndPass();
|
||||
|
||||
|
@ -439,7 +447,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetRenderState(RenderState.ZWriteEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
|
||||
graphics.Shaders.World3D.BeginPass(0);
|
||||
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||
RenderSinglePass((int)RenderPass.Alpha);
|
||||
graphics.Shaders.World3D.EndPass();
|
||||
|
||||
|
@ -450,7 +458,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
world = Matrix.Identity;
|
||||
ApplyMatrices3D();
|
||||
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.One);
|
||||
graphics.Shaders.World3D.BeginPass(0);
|
||||
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||
RenderSinglePass((int)RenderPass.Additive);
|
||||
graphics.Shaders.World3D.EndPass();
|
||||
|
||||
|
@ -475,7 +483,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetTexture(0, General.Map.Data.ThingBox.Texture);
|
||||
graphics.Shaders.World3D.Texture1 = General.Map.Data.ThingBox.Texture;
|
||||
|
||||
graphics.Shaders.World3D.BeginPass(0);
|
||||
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||
foreach(VisualThing t in thingsbydistance)
|
||||
{
|
||||
// Setup matrix
|
||||
|
|
|
@ -56,21 +56,38 @@ PixelData vs_main(VertexData vd)
|
|||
return pd;
|
||||
}
|
||||
|
||||
// Pixel shader
|
||||
// Normal pixel shader
|
||||
float4 ps_main(PixelData pd) : COLOR
|
||||
{
|
||||
float4 tcolor = tex2D(texturesamp, pd.uv);
|
||||
|
||||
// Blend texture color and vertex color
|
||||
// Blend texture color, vertex color and modulation color
|
||||
return tcolor * pd.color * modulatecolor;
|
||||
}
|
||||
|
||||
// Full-bright pixel shader
|
||||
float4 ps_fullbright(PixelData pd) : COLOR
|
||||
{
|
||||
float4 tcolor = tex2D(texturesamp, pd.uv);
|
||||
|
||||
// Blend texture color and modulation color
|
||||
return tcolor * modulatecolor;
|
||||
}
|
||||
|
||||
// Technique for shader model 2.0
|
||||
technique SM20
|
||||
{
|
||||
// Normal
|
||||
pass p0
|
||||
{
|
||||
VertexShader = compile vs_2_0 vs_main();
|
||||
PixelShader = compile ps_2_0 ps_main();
|
||||
}
|
||||
|
||||
// Full brightness mode
|
||||
pass p1
|
||||
{
|
||||
VertexShader = compile vs_2_0 vs_main();
|
||||
PixelShader = compile ps_2_0 ps_fullbright();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue