mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Changed sector brightness levels in Visual Mode to closer simulate Doom's brightness levels
This commit is contained in:
parent
5874496ab2
commit
2bbaf80b5a
7 changed files with 36 additions and 42 deletions
|
@ -155,6 +155,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This calculates brightness level
|
||||
internal static int CalculateBrightness(int level)
|
||||
{
|
||||
float flevel = level;
|
||||
if(level < 192) flevel = (192.0f - (float)(192 - level) * 1.5f); // simulate doom light levels
|
||||
byte blevel = (byte)General.Clamp((int)flevel, 0, 255);
|
||||
PixelColor c = new PixelColor(255, blevel, blevel, blevel);
|
||||
return c.ToInt();
|
||||
}
|
||||
|
||||
// This adds a selected object
|
||||
internal void AddSelectedObject(IVisualEventReceiver obj)
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
WorldVertex[] verts;
|
||||
WorldVertex v;
|
||||
Sector s = base.Sector.Sector;
|
||||
byte brightness = (byte)General.Clamp(s.Brightness, 0, 255);
|
||||
int brightness = BaseVisualMode.CalculateBrightness(s.Brightness);
|
||||
|
||||
// Load floor texture
|
||||
base.Texture = General.Map.Data.GetFlatImage(s.LongCeilTexture);
|
||||
|
@ -89,9 +89,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
for(int i = 0; i < s.Triangles.Vertices.Count; i++)
|
||||
{
|
||||
// Use sector brightness for color shading
|
||||
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
|
||||
verts[i].c = pc.ToInt();
|
||||
//verts[i].c = -1;
|
||||
verts[i].c = brightness;
|
||||
|
||||
// Grid aligned texture coordinates
|
||||
if(base.Texture.IsImageLoaded)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
||||
|
||||
/*
|
||||
|
@ -68,7 +68,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
WorldVertex[] verts;
|
||||
Sector s = base.Sector.Sector;
|
||||
byte brightness = (byte)General.Clamp(s.Brightness, 0, 255);
|
||||
int brightness = BaseVisualMode.CalculateBrightness(s.Brightness);
|
||||
|
||||
// Load floor texture
|
||||
base.Texture = General.Map.Data.GetFlatImage(s.LongFloorTexture);
|
||||
|
@ -88,9 +88,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
for(int i = 0; i < s.Triangles.Vertices.Count; i++)
|
||||
{
|
||||
// Use sector brightness for color shading
|
||||
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
|
||||
verts[i].c = pc.ToInt();
|
||||
//verts[i].c = -1;
|
||||
verts[i].c = brightness;
|
||||
|
||||
// Grid aligned texture coordinates
|
||||
if(base.Texture.IsImageLoaded)
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This builds the geometry. Returns false when no geometry created.
|
||||
public override bool Setup()
|
||||
{
|
||||
byte brightness = (byte)General.Clamp(Sidedef.Sector.Brightness, 0, 255);
|
||||
int brightness = BaseVisualMode.CalculateBrightness(Sidedef.Sector.Brightness);
|
||||
|
||||
// Calculate size of this wall part
|
||||
float geotop = (float)Sidedef.Other.Sector.FloorHeight;
|
||||
|
@ -134,17 +134,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
v2 = Sidedef.Line.Start.Position;
|
||||
}
|
||||
|
||||
// Use sector brightness for color shading
|
||||
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
|
||||
|
||||
// Make vertices
|
||||
WorldVertex[] verts = new WorldVertex[6];
|
||||
verts[0] = new WorldVertex(v1.x, v1.y, geobottom, pc.ToInt(), t1.x, t2.y);
|
||||
verts[1] = new WorldVertex(v1.x, v1.y, geotop, pc.ToInt(), t1.x, t1.y);
|
||||
verts[2] = new WorldVertex(v2.x, v2.y, geotop, pc.ToInt(), t2.x, t1.y);
|
||||
verts[0] = new WorldVertex(v1.x, v1.y, geobottom, brightness, t1.x, t2.y);
|
||||
verts[1] = new WorldVertex(v1.x, v1.y, geotop, brightness, t1.x, t1.y);
|
||||
verts[2] = new WorldVertex(v2.x, v2.y, geotop, brightness, t2.x, t1.y);
|
||||
verts[3] = verts[0];
|
||||
verts[4] = verts[2];
|
||||
verts[5] = new WorldVertex(v2.x, v2.y, geobottom, pc.ToInt(), t2.x, t2.y);
|
||||
verts[5] = new WorldVertex(v2.x, v2.y, geobottom, brightness, t2.x, t2.y);
|
||||
|
||||
// Keep properties
|
||||
base.top = geotop;
|
||||
|
|
|
@ -69,8 +69,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public override bool Setup()
|
||||
{
|
||||
WorldVertex[] verts;
|
||||
|
||||
byte brightness = (byte)General.Clamp(Sidedef.Sector.Brightness, 0, 255);
|
||||
|
||||
int brightness = BaseVisualMode.CalculateBrightness(Sidedef.Sector.Brightness);
|
||||
|
||||
// Calculate size of this wall part
|
||||
float geotop = (float)Math.Min(Sidedef.Sector.CeilHeight, Sidedef.Other.Sector.CeilHeight);
|
||||
|
@ -146,17 +146,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
v2 = Sidedef.Line.Start.Position;
|
||||
}
|
||||
|
||||
// Use sector brightness for color shading
|
||||
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
|
||||
|
||||
// Make vertices
|
||||
verts = new WorldVertex[6];
|
||||
verts[0] = new WorldVertex(v1.x, v1.y, texbottom, pc.ToInt(), t1.x, t2.y);
|
||||
verts[1] = new WorldVertex(v1.x, v1.y, textop, pc.ToInt(), t1.x, t1.y);
|
||||
verts[2] = new WorldVertex(v2.x, v2.y, textop, pc.ToInt(), t2.x, t1.y);
|
||||
verts[0] = new WorldVertex(v1.x, v1.y, texbottom, brightness, t1.x, t2.y);
|
||||
verts[1] = new WorldVertex(v1.x, v1.y, textop, brightness, t1.x, t1.y);
|
||||
verts[2] = new WorldVertex(v2.x, v2.y, textop, brightness, t2.x, t1.y);
|
||||
verts[3] = verts[0];
|
||||
verts[4] = verts[2];
|
||||
verts[5] = new WorldVertex(v2.x, v2.y, texbottom, pc.ToInt(), t2.x, t2.y);
|
||||
verts[5] = new WorldVertex(v2.x, v2.y, texbottom, brightness, t2.x, t2.y);
|
||||
|
||||
// Keep properties
|
||||
base.top = textop;
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This builds the geometry. Returns false when no geometry created.
|
||||
public override bool Setup()
|
||||
{
|
||||
byte brightness = (byte)General.Clamp(Sidedef.Sector.Brightness, 0, 255);
|
||||
int brightness = BaseVisualMode.CalculateBrightness(Sidedef.Sector.Brightness);
|
||||
|
||||
// Calculate size of this wall part
|
||||
float geotop = (float)Sidedef.Sector.CeilHeight;
|
||||
|
@ -134,17 +134,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
v2 = Sidedef.Line.Start.Position;
|
||||
}
|
||||
|
||||
// Use sector brightness for color shading
|
||||
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
|
||||
|
||||
// Make vertices
|
||||
WorldVertex[] verts = new WorldVertex[6];
|
||||
verts[0] = new WorldVertex(v1.x, v1.y, geobottom, pc.ToInt(), t1.x, t2.y);
|
||||
verts[1] = new WorldVertex(v1.x, v1.y, geotop, pc.ToInt(), t1.x, t1.y);
|
||||
verts[2] = new WorldVertex(v2.x, v2.y, geotop, pc.ToInt(), t2.x, t1.y);
|
||||
verts[0] = new WorldVertex(v1.x, v1.y, geobottom, brightness, t1.x, t2.y);
|
||||
verts[1] = new WorldVertex(v1.x, v1.y, geotop, brightness, t1.x, t1.y);
|
||||
verts[2] = new WorldVertex(v2.x, v2.y, geotop, brightness, t2.x, t1.y);
|
||||
verts[3] = verts[0];
|
||||
verts[4] = verts[2];
|
||||
verts[5] = new WorldVertex(v2.x, v2.y, geobottom, pc.ToInt(), t2.x, t2.y);
|
||||
verts[5] = new WorldVertex(v2.x, v2.y, geobottom, brightness, t2.x, t2.y);
|
||||
|
||||
// Keep properties
|
||||
base.top = geotop;
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This builds the geometry. Returns false when no geometry created.
|
||||
public override bool Setup()
|
||||
{
|
||||
byte brightness = (byte)General.Clamp(Sidedef.Sector.Brightness, 0, 255);
|
||||
int brightness = BaseVisualMode.CalculateBrightness(Sidedef.Sector.Brightness);
|
||||
|
||||
// Calculate size of this wall part
|
||||
float geotop = (float)Sidedef.Sector.CeilHeight;
|
||||
|
@ -134,17 +134,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
v2 = Sidedef.Line.Start.Position;
|
||||
}
|
||||
|
||||
// Use sector brightness for color shading
|
||||
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
|
||||
|
||||
// Make vertices
|
||||
WorldVertex[] verts = new WorldVertex[6];
|
||||
verts[0] = new WorldVertex(v1.x, v1.y, geobottom, pc.ToInt(), t1.x, t2.y);
|
||||
verts[1] = new WorldVertex(v1.x, v1.y, geotop, pc.ToInt(), t1.x, t1.y);
|
||||
verts[2] = new WorldVertex(v2.x, v2.y, geotop, pc.ToInt(), t2.x, t1.y);
|
||||
verts[0] = new WorldVertex(v1.x, v1.y, geobottom, brightness, t1.x, t2.y);
|
||||
verts[1] = new WorldVertex(v1.x, v1.y, geotop, brightness, t1.x, t1.y);
|
||||
verts[2] = new WorldVertex(v2.x, v2.y, geotop, brightness, t2.x, t1.y);
|
||||
verts[3] = verts[0];
|
||||
verts[4] = verts[2];
|
||||
verts[5] = new WorldVertex(v2.x, v2.y, geobottom, pc.ToInt(), t2.x, t2.y);
|
||||
verts[5] = new WorldVertex(v2.x, v2.y, geobottom, brightness, t2.x, t2.y);
|
||||
|
||||
// Keep properties
|
||||
base.top = geotop;
|
||||
|
|
Loading…
Reference in a new issue