fixed black sectors in Visual Mode when sector brightness > 255

This commit is contained in:
codeimp 2009-01-16 10:28:28 +00:00
parent 9c0bd91ce6
commit 3130e2047d
7 changed files with 19 additions and 22 deletions

View file

@ -93,11 +93,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(Thing.Sector != null)
{
// Use sector brightness for color shading
sectorcolor = new PixelColor(255, unchecked((byte)Thing.Sector.Brightness),
unchecked((byte)Thing.Sector.Brightness),
unchecked((byte)Thing.Sector.Brightness));
byte brightness = (byte)General.Clamp(Thing.Sector.Brightness, 0, 255);
sectorcolor = new PixelColor(255, brightness, brightness, brightness);
}
// Check if the texture is loaded
sprite.LoadImage();
isloaded = sprite.IsImageLoaded;

View file

@ -68,6 +68,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
WorldVertex[] verts;
WorldVertex v;
Sector s = base.Sector.Sector;
byte brightness = (byte)General.Clamp(s.Brightness, 0, 255);
// Load floor texture
base.Texture = General.Map.Data.GetFlatImage(s.LongCeilTexture);
@ -87,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, unchecked((byte)s.Brightness),
unchecked((byte)s.Brightness),
unchecked((byte)s.Brightness));
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
verts[i].c = pc.ToInt();
//verts[i].c = -1;

View file

@ -67,6 +67,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
WorldVertex[] verts;
Sector s = base.Sector.Sector;
byte brightness = (byte)General.Clamp(s.Brightness, 0, 255);
// Load floor texture
base.Texture = General.Map.Data.GetFlatImage(s.LongFloorTexture);
@ -86,9 +87,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, unchecked((byte)s.Brightness),
unchecked((byte)s.Brightness),
unchecked((byte)s.Brightness));
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
verts[i].c = pc.ToInt();
//verts[i].c = -1;

View file

@ -65,6 +65,8 @@ 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);
// Calculate size of this wall part
float geotop = (float)Sidedef.Other.Sector.FloorHeight;
float geobottom = (float)Sidedef.Sector.FloorHeight;
@ -133,9 +135,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Use sector brightness for color shading
PixelColor pc = new PixelColor(255, unchecked((byte)Sidedef.Sector.Brightness),
unchecked((byte)Sidedef.Sector.Brightness),
unchecked((byte)Sidedef.Sector.Brightness));
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
// Make vertices
WorldVertex[] verts = new WorldVertex[6];

View file

@ -68,6 +68,8 @@ 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);
// Calculate size of this wall part
float geotop = (float)Math.Min(Sidedef.Sector.CeilHeight, Sidedef.Other.Sector.CeilHeight);
float geobottom = (float)Math.Max(Sidedef.Sector.FloorHeight, Sidedef.Other.Sector.FloorHeight);
@ -143,9 +145,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Use sector brightness for color shading
PixelColor pc = new PixelColor(255, unchecked((byte)Sidedef.Sector.Brightness),
unchecked((byte)Sidedef.Sector.Brightness),
unchecked((byte)Sidedef.Sector.Brightness));
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
// Make vertices
WorldVertex[] verts = new WorldVertex[6];

View file

@ -65,6 +65,8 @@ 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);
// Calculate size of this wall part
float geotop = (float)Sidedef.Sector.CeilHeight;
float geobottom = (float)Sidedef.Sector.FloorHeight;
@ -133,9 +135,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Use sector brightness for color shading
PixelColor pc = new PixelColor(255, unchecked((byte)Sidedef.Sector.Brightness),
unchecked((byte)Sidedef.Sector.Brightness),
unchecked((byte)Sidedef.Sector.Brightness));
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
// Make vertices
WorldVertex[] verts = new WorldVertex[6];

View file

@ -65,6 +65,8 @@ 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);
// Calculate size of this wall part
float geotop = (float)Sidedef.Sector.CeilHeight;
float geobottom = (float)Sidedef.Other.Sector.CeilHeight;
@ -133,9 +135,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Use sector brightness for color shading
PixelColor pc = new PixelColor(255, unchecked((byte)Sidedef.Sector.Brightness),
unchecked((byte)Sidedef.Sector.Brightness),
unchecked((byte)Sidedef.Sector.Brightness));
PixelColor pc = new PixelColor(255, brightness, brightness, brightness);
// Make vertices
WorldVertex[] verts = new WorldVertex[6];