mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +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.
|
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
|
- Info panel should be collapsable
|
||||||
|
|
||||||
- Create menus for different modes
|
- Create menus for different modes
|
||||||
|
|
|
@ -477,6 +477,16 @@ togglegravity
|
||||||
allowscroll = true;
|
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
|
placevisualstart
|
||||||
{
|
{
|
||||||
title = "Place Visual Mode Camera";
|
title = "Place Visual Mode Camera";
|
||||||
|
|
|
@ -353,7 +353,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
[BeginAction("visualselect", BaseAction = true)]
|
[BeginAction("visualselect", BaseAction = true)]
|
||||||
public void BeginSelect()
|
public void BeginSelect()
|
||||||
{
|
{
|
||||||
General.WriteLogLine("BeginSelect");
|
|
||||||
PickTargetUnlocked();
|
PickTargetUnlocked();
|
||||||
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectBegin();
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectBegin();
|
||||||
}
|
}
|
||||||
|
@ -361,7 +360,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
[EndAction("visualselect", BaseAction = true)]
|
[EndAction("visualselect", BaseAction = true)]
|
||||||
public void EndSelect()
|
public void EndSelect()
|
||||||
{
|
{
|
||||||
General.WriteLogLine("EndSelect");
|
|
||||||
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectEnd();
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,6 +535,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
BuilderPlug.Me.UseGravity = !BuilderPlug.Me.UseGravity;
|
BuilderPlug.Me.UseGravity = !BuilderPlug.Me.UseGravity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BeginAction("togglebrightness")]
|
||||||
|
public void ToggleBrightness()
|
||||||
|
{
|
||||||
|
renderer.FullBrightness = !renderer.FullBrightness;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
// Properties
|
// Properties
|
||||||
ProjectedFrustum2D Frustum2D { get; }
|
ProjectedFrustum2D Frustum2D { get; }
|
||||||
bool DrawThingCages { get; set; }
|
bool DrawThingCages { get; set; }
|
||||||
|
bool FullBrightness { get; set; }
|
||||||
|
|
||||||
// General methods
|
// General methods
|
||||||
void PositionAndLookAt(Vector3D pos, Vector3D lookat);
|
void PositionAndLookAt(Vector3D pos, Vector3D lookat);
|
||||||
|
|
|
@ -58,6 +58,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
private Matrix view2d;
|
private Matrix view2d;
|
||||||
private Matrix world;
|
private Matrix world;
|
||||||
private Vector3D cameraposition;
|
private Vector3D cameraposition;
|
||||||
|
private int shaderpass;
|
||||||
|
|
||||||
|
// Options
|
||||||
|
private bool fullbrightness;
|
||||||
|
|
||||||
// Window size
|
// Window size
|
||||||
private Size windowsize;
|
private Size windowsize;
|
||||||
|
@ -94,6 +98,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
|
|
||||||
public ProjectedFrustum2D Frustum2D { get { return frustum; } }
|
public ProjectedFrustum2D Frustum2D { get { return frustum; } }
|
||||||
public bool DrawThingCages { get { return renderthingcages; } set { renderthingcages = value; } }
|
public bool DrawThingCages { get { return renderthingcages; } set { renderthingcages = value; } }
|
||||||
|
public bool FullBrightness { get { return fullbrightness; } set { fullbrightness = value; } }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -376,6 +381,9 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
world = Matrix.Identity;
|
world = Matrix.Identity;
|
||||||
ApplyMatrices3D();
|
ApplyMatrices3D();
|
||||||
|
|
||||||
|
// Determine shader pass to use
|
||||||
|
if(fullbrightness) shaderpass = 1; else shaderpass = 0;
|
||||||
|
|
||||||
// Create crosshair vertices
|
// Create crosshair vertices
|
||||||
if(crosshairverts == null)
|
if(crosshairverts == null)
|
||||||
CreateCrosshairVerts(new Size(General.Map.Data.Crosshair3D.Width, General.Map.Data.Crosshair3D.Height));
|
CreateCrosshairVerts(new Size(General.Map.Data.Crosshair3D.Width, General.Map.Data.Crosshair3D.Height));
|
||||||
|
@ -419,7 +427,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
// SOLID PASS
|
// SOLID PASS
|
||||||
world = Matrix.Identity;
|
world = Matrix.Identity;
|
||||||
ApplyMatrices3D();
|
ApplyMatrices3D();
|
||||||
graphics.Shaders.World3D.BeginPass(0);
|
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||||
RenderSinglePass((int)RenderPass.Solid);
|
RenderSinglePass((int)RenderPass.Solid);
|
||||||
graphics.Shaders.World3D.EndPass();
|
graphics.Shaders.World3D.EndPass();
|
||||||
|
|
||||||
|
@ -427,7 +435,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
world = Matrix.Identity;
|
world = Matrix.Identity;
|
||||||
ApplyMatrices3D();
|
ApplyMatrices3D();
|
||||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, true);
|
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, true);
|
||||||
graphics.Shaders.World3D.BeginPass(0);
|
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||||
RenderSinglePass((int)RenderPass.Mask);
|
RenderSinglePass((int)RenderPass.Mask);
|
||||||
graphics.Shaders.World3D.EndPass();
|
graphics.Shaders.World3D.EndPass();
|
||||||
|
|
||||||
|
@ -439,7 +447,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
graphics.Device.SetRenderState(RenderState.ZWriteEnable, false);
|
graphics.Device.SetRenderState(RenderState.ZWriteEnable, false);
|
||||||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||||
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
|
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
|
||||||
graphics.Shaders.World3D.BeginPass(0);
|
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||||
RenderSinglePass((int)RenderPass.Alpha);
|
RenderSinglePass((int)RenderPass.Alpha);
|
||||||
graphics.Shaders.World3D.EndPass();
|
graphics.Shaders.World3D.EndPass();
|
||||||
|
|
||||||
|
@ -450,7 +458,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
world = Matrix.Identity;
|
world = Matrix.Identity;
|
||||||
ApplyMatrices3D();
|
ApplyMatrices3D();
|
||||||
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.One);
|
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.One);
|
||||||
graphics.Shaders.World3D.BeginPass(0);
|
graphics.Shaders.World3D.BeginPass(shaderpass);
|
||||||
RenderSinglePass((int)RenderPass.Additive);
|
RenderSinglePass((int)RenderPass.Additive);
|
||||||
graphics.Shaders.World3D.EndPass();
|
graphics.Shaders.World3D.EndPass();
|
||||||
|
|
||||||
|
@ -475,7 +483,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
graphics.Device.SetTexture(0, General.Map.Data.ThingBox.Texture);
|
graphics.Device.SetTexture(0, General.Map.Data.ThingBox.Texture);
|
||||||
graphics.Shaders.World3D.Texture1 = 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)
|
foreach(VisualThing t in thingsbydistance)
|
||||||
{
|
{
|
||||||
// Setup matrix
|
// Setup matrix
|
||||||
|
|
|
@ -56,21 +56,38 @@ PixelData vs_main(VertexData vd)
|
||||||
return pd;
|
return pd;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pixel shader
|
// Normal pixel shader
|
||||||
float4 ps_main(PixelData pd) : COLOR
|
float4 ps_main(PixelData pd) : COLOR
|
||||||
{
|
{
|
||||||
float4 tcolor = tex2D(texturesamp, pd.uv);
|
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;
|
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 for shader model 2.0
|
||||||
technique SM20
|
technique SM20
|
||||||
{
|
{
|
||||||
|
// Normal
|
||||||
pass p0
|
pass p0
|
||||||
{
|
{
|
||||||
VertexShader = compile vs_2_0 vs_main();
|
VertexShader = compile vs_2_0 vs_main();
|
||||||
PixelShader = compile ps_2_0 ps_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