@ Fixed 3D floor textures that were swapped between floor/ceiling

@ Fixed middle texture offsets on doublesided lines
This commit is contained in:
codeimp 2010-09-16 19:38:46 +00:00
parent 6c68a5635e
commit 429b36e765
6 changed files with 48 additions and 43 deletions

View file

@ -81,6 +81,20 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// This changes the height
protected abstract void ChangeHeight(int amount);
// This swaps triangles so that the plane faces the other way
protected void SwapTriangleVertices(WorldVertex[] verts)
{
// Swap some vertices to flip all triangles
for(int i = 0; i < verts.Length; i += 3)
{
// Swap
WorldVertex v = verts[i];
verts[i] = verts[i + 1];
verts[i + 1] = v;
}
}
#endregion

View file

@ -197,14 +197,14 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// Create a floor
VisualFloor vf = (i < extrafloors.Count) ? extrafloors[i] : new VisualFloor(mode, this);
if(vf.Setup(ef.Floor, ef))
if(vf.Setup(ef.Ceiling, ef))
base.AddGeometry(vf);
if(i >= extrafloors.Count)
extrafloors.Add(vf);
// Create a ceiling
VisualCeiling vc = (i < extraceilings.Count) ? extraceilings[i] : new VisualCeiling(mode, this);
if(vc.Setup(ef.Ceiling, ef))
if(vc.Setup(ef.Floor, ef))
base.AddGeometry(vc);
if(i >= extraceilings.Count)
extraceilings.Add(vc);

View file

@ -85,20 +85,29 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
sd.Ceiling.CopyProperties(floor);
sd.Floor.CopyProperties(ceiling);
floor.type = SectorLevelType.Floor;
floor.plane = floor.plane.GetInverted();
floor.plane = sd.Ceiling.plane.GetInverted();
ceiling.type = SectorLevelType.Ceiling;
ceiling.plane = ceiling.plane.GetInverted();
ceiling.plane = sd.Floor.plane.GetInverted();
// A 3D floor's color is always that of the sector it is placed in
floor.color = 0;
}
else
{
vavoomtype = true;
sd.Ceiling.CopyProperties(ceiling);
sd.Floor.CopyProperties(floor);
/*
sd.Ceiling.CopyProperties(floor);
sd.Floor.CopyProperties(ceiling);
*/
floor.type = SectorLevelType.Ceiling;
floor.plane = sd.Ceiling.plane;
ceiling.type = SectorLevelType.Floor;
ceiling.plane = sd.Floor.plane;
alpha = 255;
// A 3D floor's color is always that of the sector it is placed in
ceiling.color = 0;
}
// A 3D floor's color is always that of the sector it is placed in
floor.color = 0;
// Apply alpha
floor.alpha = alpha;

View file

@ -126,14 +126,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// The sector triangulation created clockwise triangles that
// are right up for the floor. For the ceiling we must flip
// the triangles upside down.
// Swap some vertices to flip all triangles
for(int i = 0; i < verts.Length; i += 3)
{
// Swap
v = verts[i];
verts[i] = verts[i + 1];
verts[i + 1] = v;
}
if((extrafloor == null) || extrafloor.VavoomType)
SwapTriangleVertices(verts);
// Determine render pass
if(level.alpha < 255)
@ -165,18 +159,9 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// This changes the height
protected override void ChangeHeight(int amount)
{
if((extrafloor == null) || extrafloor.VavoomType)
{
mode.CreateUndo("Change ceiling height", UndoGroup.CeilingHeightChange, level.sector.FixedIndex);
level.sector.CeilHeight += amount;
mode.SetActionResult("Changed ceiling height to " + level.sector.CeilHeight + ".");
}
else
{
mode.CreateUndo("Change floor height", UndoGroup.FloorHeightChange, level.sector.FixedIndex);
level.sector.FloorHeight += amount;
mode.SetActionResult("Changed floor height to " + level.sector.FloorHeight + ".");
}
mode.CreateUndo("Change ceiling height", UndoGroup.CeilingHeightChange, level.sector.FixedIndex);
level.sector.CeilHeight += amount;
mode.SetActionResult("Changed ceiling height to " + level.sector.CeilHeight + ".");
}
// This performs a fast test in object picking

View file

@ -121,6 +121,12 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
verts[i].u = pos.x;
verts[i].v = pos.y;
}
// The sector triangulation created clockwise triangles that
// are right up for the floor. For the ceiling we must flip
// the triangles upside down.
if((extrafloor != null) && !extrafloor.VavoomType)
SwapTriangleVertices(verts);
// Determine render pass
if(level.alpha < 255)
@ -152,18 +158,9 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// This changes the height
protected override void ChangeHeight(int amount)
{
if((extrafloor == null) || extrafloor.VavoomType)
{
mode.CreateUndo("Change floor height", UndoGroup.FloorHeightChange, level.sector.FixedIndex);
level.sector.FloorHeight += amount;
mode.SetActionResult("Changed floor height to " + level.sector.FloorHeight + ".");
}
else
{
mode.CreateUndo("Change ceiling height", UndoGroup.CeilingHeightChange, level.sector.FixedIndex);
level.sector.CeilHeight += amount;
mode.SetActionResult("Changed ceiling height to " + level.sector.CeilHeight + ".");
}
mode.CreateUndo("Change floor height", UndoGroup.FloorHeightChange, level.sector.FixedIndex);
level.sector.FloorHeight += amount;
mode.SetActionResult("Changed floor height to " + level.sector.FloorHeight + ".");
}
// This performs a fast test in object picking

View file

@ -203,9 +203,9 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// Determine top portion height
if(Sidedef.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag))
textop = geobottom + tsz.y;
textop = geobottom + tof.y + tsz.y;
else
textop = geotop;
textop = geotop + tof.y;
// Calculate bottom portion height
texbottom = textop - tsz.y;