@ (G)ZDoom Editing plugin: Support for UDMF light levels, individual texture scaling and offsets on sidedefs

This commit is contained in:
codeimp 2010-09-15 20:41:40 +00:00
parent 7e13e3b45c
commit 094749feb4
11 changed files with 129 additions and 115 deletions

View file

@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{760A9BC7-CB73-4C36-858B-994C14996FCD}</ProjectGuid>
<OutputType>Library</OutputType>
@ -20,6 +20,7 @@
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
@ -29,6 +30,7 @@
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />

View file

@ -160,7 +160,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// This creates vertices from a wall polygon and applies lighting
protected List<WorldVertex> CreatePolygonVertices(WallPolygon poly, TexturePlane tp, SectorData sd)
protected List<WorldVertex> CreatePolygonVertices(WallPolygon poly, TexturePlane tp, SectorData sd, int lightvalue, bool lightabsolute)
{
List<WallPolygon> polygons = new List<WallPolygon>(2);
List<WorldVertex> verts = new List<WorldVertex>();
@ -183,7 +183,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
if(np.Count > 0)
{
// Determine color
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(l.brightnessbelow));
int lightlevel = lightabsolute ? lightvalue : l.brightnessbelow + lightvalue;
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel));
PixelColor wallcolor = PixelColor.Modulate(l.colorbelow, wallbrightness);
np.color = wallcolor.WithAlpha(255).ToInt();

View file

@ -175,24 +175,18 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// This sets up the basic floor and ceiling, as they would be in normal Doom circumstances
private void BasicSetup()
{
int color = -1, flight = sector.Brightness, clight = sector.Brightness;
bool fabs = true, cabs = true;
// Normal (flat) floor and ceiling planes
floor.plane = new Plane(new Vector3D(0, 0, 1), -sector.FloorHeight);
ceiling.plane = new Plane(new Vector3D(0, 0, -1), sector.CeilHeight);
// Determine colors
try
{
// Fetch ZDoom fields
color = sector.Fields.ContainsKey("lightcolor") ? (int)sector.Fields["lightcolor"].Value : -1;
flight = sector.Fields.ContainsKey("lightfloor") ? (int)sector.Fields["lightfloor"].Value : 0;
fabs = sector.Fields.ContainsKey("lightfloorabsolute") ? (bool)sector.Fields["lightfloorabsolute"].Value : false;
clight = sector.Fields.ContainsKey("lightceiling") ? (int)sector.Fields["lightceiling"].Value : 0;
cabs = sector.Fields.ContainsKey("lightceilingabsolute") ? (bool)sector.Fields["lightceilingabsolute"].Value : false;
}
catch(Exception) { }
// Fetch ZDoom fields
int color = sector.Fields.GetValue("lightcolor", -1);
int flight = sector.Fields.GetValue("lightfloor", 0);
bool fabs = sector.Fields.GetValue("lightfloorabsolute", false);
int clight = sector.Fields.GetValue("lightceiling", 0);
bool cabs = sector.Fields.GetValue("lightceilingabsolute", false);
// Determine colors & light levels
PixelColor lightcolor = PixelColor.FromInt(color);
if(!fabs) flight = sector.Brightness + flight;
if(!cabs) clight = sector.Brightness + clight;

View file

@ -70,21 +70,16 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
WorldVertex[] verts;
WorldVertex v;
Sector s = level.sector;
float xpan, ypan, xscale, yscale, rotate;
Vector2D texscale;
base.Setup(level);
try
{
// Fetch ZDoom fields
xpan = s.Fields.ContainsKey("xpanningceiling") ? (float)s.Fields["xpanningceiling"].Value : 0.0f;
ypan = s.Fields.ContainsKey("ypanningceiling") ? (float)s.Fields["ypanningceiling"].Value : 0.0f;
xscale = s.Fields.ContainsKey("xscaleceiling") ? (float)s.Fields["xscaleceiling"].Value : 1.0f;
yscale = s.Fields.ContainsKey("yscaleceiling") ? (float)s.Fields["yscaleceiling"].Value : 1.0f;
rotate = s.Fields.ContainsKey("rotationceiling") ? (float)s.Fields["rotationceiling"].Value : 0.0f;
}
catch(Exception) { return false; }
// Fetch ZDoom fields
float rotate = Angle2D.DegToRad(s.Fields.GetValue("rotationceiling", 0.0f));
Vector2D offset = new Vector2D(s.Fields.GetValue("xpanningceiling", 0.0f),
s.Fields.GetValue("ypanningceiling", 0.0f));
Vector2D scale = new Vector2D(s.Fields.GetValue("xscaleceiling", 1.0f),
s.Fields.GetValue("yscaleceiling", 1.0f));
// Load floor texture
base.Texture = General.Map.Data.GetFlatImage(s.LongCeilTexture);
@ -105,11 +100,6 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
else
texscale = new Vector2D(1.0f / 64.0f, 1.0f / 64.0f);
// Prepare for math!
rotate = Angle2D.DegToRad(rotate);
Vector2D scale = new Vector2D(xscale, yscale);
Vector2D offset = new Vector2D(xpan, ypan);
// Make vertices
ReadOnlyCollection<Vector2D> triverts = base.Sector.Sector.Triangles.Vertices;
verts = new WorldVertex[triverts.Count];

View file

@ -69,21 +69,16 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
{
WorldVertex[] verts;
Sector s = level.sector;
float xpan, ypan, xscale, yscale, rotate;
Vector2D texscale;
base.Setup(level);
try
{
// Fetch ZDoom fields
xpan = s.Fields.ContainsKey("xpanningfloor") ? (float)s.Fields["xpanningfloor"].Value : 0.0f;
ypan = s.Fields.ContainsKey("ypanningfloor") ? (float)s.Fields["ypanningfloor"].Value : 0.0f;
xscale = s.Fields.ContainsKey("xscalefloor") ? (float)s.Fields["xscalefloor"].Value : 1.0f;
yscale = s.Fields.ContainsKey("yscalefloor") ? (float)s.Fields["yscalefloor"].Value : 1.0f;
rotate = s.Fields.ContainsKey("rotationfloor") ? (float)s.Fields["rotationfloor"].Value : 0.0f;
}
catch(Exception) { return false; }
// Fetch ZDoom fields
float rotate = Angle2D.DegToRad(s.Fields.GetValue("rotationfloor", 0.0f));
Vector2D offset = new Vector2D(s.Fields.GetValue("xpanningfloor", 0.0f),
s.Fields.GetValue("ypanningfloor", 0.0f));
Vector2D scale = new Vector2D(s.Fields.GetValue("xscalefloor", 1.0f),
s.Fields.GetValue("yscalefloor", 1.0f));
// Load floor texture
base.Texture = General.Map.Data.GetFlatImage(s.LongFloorTexture);
@ -104,11 +99,6 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
else
texscale = new Vector2D(1.0f / 64.0f, 1.0f / 64.0f);
// Prepare for math!
rotate = Angle2D.DegToRad(rotate);
Vector2D scale = new Vector2D(xscale, yscale);
Vector2D offset = new Vector2D(xpan, ypan);
// Make vertices
ReadOnlyCollection<Vector2D> triverts = base.Sector.Sector.Triangles.Vertices;
verts = new WorldVertex[triverts.Count];

View file

@ -67,6 +67,14 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
{
Vector2D vl, vr;
int lightvalue = Sidedef.Fields.GetValue("light", 0);
bool lightabsolute = Sidedef.Fields.GetValue("lightabsolute", false);
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_bottom", 1.0f),
Sidedef.Fields.GetValue("scaley_bottom", 1.0f));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_bottom", 0.0f),
Sidedef.Fields.GetValue("offsety_bottom", 0.0f));
// Left and right vertices for this sidedef
if(Sidedef.IsFront)
{
@ -109,6 +117,13 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// Get texture scaled size
Vector2D tsz = new Vector2D(base.Texture.ScaledWidth, base.Texture.ScaledHeight);
tsz = tsz * tscale;
// Get texture offsets
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tof = tof + toffset;
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
tof = tof * base.Texture.Scale;
// Determine texture coordinates plane as they would be in normal circumstances.
// We can then use this plane to find any texture coordinate we need.
@ -127,16 +142,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
tp.trb.y = tp.tlt.y + ((float)Sidedef.Other.Sector.FloorHeight - ((float)Sidedef.Sector.FloorHeight + floorbias));
// Apply texture offset
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
{
tp.tlt += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
tp.trb += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
}
else
{
tp.tlt += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tp.trb += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
}
tp.tlt += tof;
tp.trb += tof;
// Transform pixel coordinates to texture coordinates
tp.tlt /= tsz;
@ -158,7 +165,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
poly.Add(new Vector3D(vr.x, vr.y, sd.Floor.plane.GetZ(vr)));
// Determine initial color
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(sd.Ceiling.brightnessbelow));
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel));
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);
poly.color = wallcolor.WithAlpha(255).ToInt();
@ -173,7 +181,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
bottom = sd.Floor.plane;
// Process the polygon and create vertices
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd);
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd, lightvalue, lightabsolute);
if(verts.Count > 0)
{
base.SetVertices(verts);

View file

@ -70,8 +70,17 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
{
Vector2D vl, vr;
Sidedef sourceside = extrafloor.Linedef.Front;
this.extrafloor = extrafloor;
int lightvalue = Sidedef.Fields.GetValue("light", 0);
bool lightabsolute = Sidedef.Fields.GetValue("lightabsolute", false);
Vector2D tscale = new Vector2D(sourceside.Fields.GetValue("scalex_mid", 1.0f),
sourceside.Fields.GetValue("scaley_mid", 1.0f));
Vector2D toffset1 = new Vector2D(Sidedef.Fields.GetValue("offsetx_mid", 0.0f),
Sidedef.Fields.GetValue("offsety_mid", 0.0f));
Vector2D toffset2 = new Vector2D(sourceside.Fields.GetValue("offsetx_mid", 0.0f),
sourceside.Fields.GetValue("offsety_mid", 0.0f));
// Left and right vertices for this sidedef
if(Sidedef.IsFront)
@ -113,6 +122,13 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// Get texture scaled size
Vector2D tsz = new Vector2D(base.Texture.ScaledWidth, base.Texture.ScaledHeight);
tsz = tsz * tscale;
// Get texture offsets
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tof = tof + toffset1 + toffset2;
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
tof = tof * base.Texture.Scale;
// For Vavoom type 3D floors the ceiling is lower than floor and they are reversed.
// We choose here.
@ -132,20 +148,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
tp.trb.y = tp.tlt.y + (sourcetopheight - sourcebottomheight) + floorbias;
// Apply texture offset
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
{
tp.tlt += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
tp.trb += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
tp.tlt += new Vector2D(sourceside.OffsetX * base.Texture.Scale.x, sourceside.OffsetY * base.Texture.Scale.y);
tp.trb += new Vector2D(sourceside.OffsetX * base.Texture.Scale.x, sourceside.OffsetY * base.Texture.Scale.y);
}
else
{
tp.tlt += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tp.trb += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tp.tlt += new Vector2D(sourceside.OffsetX, sourceside.OffsetY);
tp.trb += new Vector2D(sourceside.OffsetX, sourceside.OffsetY);
}
tp.tlt += tof;
tp.trb += tof;
// Transform pixel coordinates to texture coordinates
tp.tlt /= tsz;
@ -180,7 +184,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
poly.Add(new Vector3D(vr.x, vr.y, fr));
// Determine initial color
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(sd.Ceiling.brightnessbelow));
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel));
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);
poly.color = wallcolor.WithAlpha(255).ToInt();
@ -189,7 +194,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
CropPoly(ref poly, extrafloor.Ceiling.plane, false);
// Process the polygon and create vertices
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd);
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd, lightvalue, lightabsolute);
if(verts.Count > 0)
{
if(extrafloor.Alpha < 255)

View file

@ -74,6 +74,14 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
{
Vector2D vl, vr;
int lightvalue = Sidedef.Fields.GetValue("light", 0);
bool lightabsolute = Sidedef.Fields.GetValue("lightabsolute", false);
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_mid", 1.0f),
Sidedef.Fields.GetValue("scaley_mid", 1.0f));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_mid", 0.0f),
Sidedef.Fields.GetValue("offsety_mid", 0.0f));
// Texture given?
if((Sidedef.MiddleTexture.Length > 0) && (Sidedef.MiddleTexture[0] != '-'))
{
@ -116,9 +124,16 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
base.Texture = General.Map.Data.MissingTexture3D;
setuponloadedtexture = 0;
}
// Get texture scaled size
Vector2D tsz = new Vector2D(base.Texture.ScaledWidth, base.Texture.ScaledHeight);
tsz = tsz * tscale;
// Get texture offsets
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tof = tof + toffset;
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
tof = tof * base.Texture.Scale;
// Determine texture coordinates plane as they would be in normal circumstances.
// We can then use this plane to find any texture coordinate we need.
@ -137,16 +152,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
tp.trb.y = tp.tlt.y + ((float)Sidedef.Sector.CeilHeight - ((float)Sidedef.Sector.FloorHeight + floorbias));
// Apply texture offset
if (General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
{
tp.tlt += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
tp.trb += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
}
else
{
tp.tlt += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tp.trb += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
}
tp.tlt += tof;
tp.trb += tof;
// Transform pixel coordinates to texture coordinates
tp.tlt /= tsz;
@ -172,7 +179,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
poly.Add(new Vector3D(vr.x, vr.y, sd.Floor.plane.GetZ(vr)));
// Determine initial color
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(sd.Ceiling.brightnessbelow));
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel));
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);
poly.color = wallcolor.WithAlpha(255).ToInt();
@ -222,7 +230,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
bottom = osd.Floor.plane;
// Process the polygon and create vertices
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd);
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd, lightvalue, lightabsolute);
if(verts.Count > 0)
{
// Apply alpha to vertices

View file

@ -67,6 +67,14 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
{
Vector2D vl, vr;
int lightvalue = Sidedef.Fields.GetValue("light", 0);
bool lightabsolute = Sidedef.Fields.GetValue("lightabsolute", false);
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_mid", 1.0f),
Sidedef.Fields.GetValue("scaley_mid", 1.0f));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_mid", 0.0f),
Sidedef.Fields.GetValue("offsety_mid", 0.0f));
// Left and right vertices for this sidedef
if(Sidedef.IsFront)
{
@ -107,6 +115,13 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// Get texture scaled size
Vector2D tsz = new Vector2D(base.Texture.ScaledWidth, base.Texture.ScaledHeight);
tsz = tsz * tscale;
// Get texture offsets
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tof = tof + toffset;
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
tof = tof * base.Texture.Scale;
// Determine texture coordinates plane as they would be in normal circumstances.
// We can then use this plane to find any texture coordinate we need.
@ -125,16 +140,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
tp.trb.y = tp.tlt.y + ((float)Sidedef.Sector.CeilHeight - ((float)Sidedef.Sector.FloorHeight + floorbias));
// Apply texture offset
if (General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
{
tp.tlt += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
tp.trb += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
}
else
{
tp.tlt += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tp.trb += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
}
tp.tlt += tof;
tp.trb += tof;
// Transform pixel coordinates to texture coordinates
tp.tlt /= tsz;
@ -169,12 +176,13 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
poly.Add(new Vector3D(vr.x, vr.y, fr));
// Determine initial color
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(sd.Ceiling.brightnessbelow));
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel));
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);
poly.color = wallcolor.WithAlpha(255).ToInt();
// Process the polygon and create vertices
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd);
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd, lightvalue, lightabsolute);
if(verts.Count > 0)
{
base.SetVertices(verts);

View file

@ -68,6 +68,14 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
{
Vector2D vl, vr;
int lightvalue = Sidedef.Fields.GetValue("light", 0);
bool lightabsolute = Sidedef.Fields.GetValue("lightabsolute", false);
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_top", 1.0f),
Sidedef.Fields.GetValue("scaley_top", 1.0f));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_top", 0.0f),
Sidedef.Fields.GetValue("offsety_top", 0.0f));
// Left and right vertices for this sidedef
if(Sidedef.IsFront)
{
@ -110,6 +118,13 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// Get texture scaled size
Vector2D tsz = new Vector2D(base.Texture.ScaledWidth, base.Texture.ScaledHeight);
tsz = tsz * tscale;
// Get texture offsets
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tof = tof + toffset;
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
tof = tof * base.Texture.Scale;
// Determine texture coordinates plane as they would be in normal circumstances.
// We can then use this plane to find any texture coordinate we need.
@ -128,16 +143,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
tp.trb.y = tp.tlt.y + ((float)Sidedef.Sector.CeilHeight - ((float)Sidedef.Other.Sector.CeilHeight + ceilbias));
// Apply texture offset
if (General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
{
tp.tlt += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
tp.trb += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
}
else
{
tp.tlt += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tp.trb += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
}
tp.tlt += tof;
tp.trb += tof;
// Transform pixel coordinates to texture coordinates
tp.tlt /= tsz;
@ -159,7 +166,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
poly.Add(new Vector3D(vr.x, vr.y, sd.Floor.plane.GetZ(vr)));
// Determine initial color
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(sd.Ceiling.brightnessbelow));
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel));
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);
poly.color = wallcolor.WithAlpha(255).ToInt();
@ -173,7 +181,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
bottom = osd.Ceiling.plane;
// Process the polygon and create vertices
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd);
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd, lightvalue, lightabsolute);
if(verts.Count > 0)
{
base.SetVertices(verts);

Binary file not shown.