mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
First and very hacky attempt at rendering flat rotation/offsets in classic editing modes.
This commit is contained in:
parent
960065111a
commit
37993cde49
1 changed files with 46 additions and 0 deletions
|
@ -375,6 +375,29 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
vertices[i].u = vertices[i].u * sw;
|
||||
vertices[i].v = -vertices[i].v * sh;
|
||||
}
|
||||
|
||||
foreach (Sidedef side in s.Sidedefs)
|
||||
{
|
||||
if (side.Line.IsFlatAlignment && !side.Line.IsFlagSet("2048") && side.Line.Tag == 0 && side.Line.Front.Sector == s)
|
||||
{
|
||||
bool useoffsets = side.Line.IsFlagSet("8192");
|
||||
float xoffset = useoffsets ? side.Line.Front.OffsetX : -side.Line.Start.Position.x;
|
||||
float yoffset = useoffsets ? -side.Line.Front.OffsetY : -side.Line.Start.Position.y;
|
||||
float rotation = General.ClampAngle(90f - side.Line.Angle * Angle2D.PIDEG);
|
||||
|
||||
// Affine offset, this got me a few headaches of why both rotation and offset didn't worked at same time
|
||||
float rotationrad = rotation / Angle2D.PIDEG;
|
||||
float cos = (float)Math.Cos(rotationrad);
|
||||
float sin = (float)Math.Sin(rotationrad);
|
||||
float rx = cos * xoffset - sin * yoffset;
|
||||
float ry = sin * xoffset + cos * yoffset;
|
||||
xoffset = rx;
|
||||
yoffset = -ry;
|
||||
Vector2D offset = new Vector2D(xoffset, yoffset);
|
||||
|
||||
SetupSurfaceVertices(vertices, s, img, offset, new Vector2D(1.0f, 1.0f), rotation, -1, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -427,6 +450,29 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
vertices[i].u = vertices[i].u * sw;
|
||||
vertices[i].v = -vertices[i].v * sh;
|
||||
}
|
||||
|
||||
foreach (Sidedef side in s.Sidedefs)
|
||||
{
|
||||
if (side.Line.IsFlatAlignment && !side.Line.IsFlagSet("4096") && side.Line.Tag == 0 && side.Line.Front.Sector == s)
|
||||
{
|
||||
bool useoffsets = side.Line.IsFlagSet("8192");
|
||||
float xoffset = useoffsets ? side.Line.Front.OffsetX : -side.Line.Start.Position.x;
|
||||
float yoffset = useoffsets ? -side.Line.Front.OffsetY : -side.Line.Start.Position.y;
|
||||
float rotation = General.ClampAngle(90f - side.Line.Angle * Angle2D.PIDEG);
|
||||
|
||||
// Affine offset, this got me a few headaches of why both rotation and offset didn't worked at same time
|
||||
float rotationrad = rotation / Angle2D.PIDEG;
|
||||
float cos = (float)Math.Cos(rotationrad);
|
||||
float sin = (float)Math.Sin(rotationrad);
|
||||
float rx = cos * xoffset - sin * yoffset;
|
||||
float ry = sin * xoffset + cos * yoffset;
|
||||
xoffset = rx;
|
||||
yoffset = -ry;
|
||||
Vector2D offset = new Vector2D(xoffset, yoffset);
|
||||
|
||||
SetupSurfaceVertices(vertices, s, img, offset, new Vector2D(1.0f, 1.0f), rotation, -1, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue