@ 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

@ -82,6 +82,20 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// This changes the height // This changes the height
protected abstract void ChangeHeight(int amount); 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 #endregion
#region ================== Events #region ================== Events

View file

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

View file

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

View file

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

View file

@ -122,6 +122,12 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
verts[i].v = pos.y; 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 // Determine render pass
if(level.alpha < 255) if(level.alpha < 255)
this.RenderPass = RenderPass.Alpha; this.RenderPass = RenderPass.Alpha;
@ -151,20 +157,11 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// This changes the height // This changes the height
protected override void ChangeHeight(int amount) protected override void ChangeHeight(int amount)
{
if((extrafloor == null) || extrafloor.VavoomType)
{ {
mode.CreateUndo("Change floor height", UndoGroup.FloorHeightChange, level.sector.FixedIndex); mode.CreateUndo("Change floor height", UndoGroup.FloorHeightChange, level.sector.FixedIndex);
level.sector.FloorHeight += amount; level.sector.FloorHeight += amount;
mode.SetActionResult("Changed floor height to " + level.sector.FloorHeight + "."); 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 + ".");
}
}
// This performs a fast test in object picking // This performs a fast test in object picking
public override bool PickFastReject(Vector3D from, Vector3D to, Vector3D dir) public override bool PickFastReject(Vector3D from, Vector3D to, Vector3D dir)

View file

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