mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
Trying to figure out matrix black magic
This commit is contained in:
parent
01ccfa56f3
commit
2c9235e4ea
3 changed files with 17 additions and 11 deletions
|
@ -56,10 +56,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// (when resized or display adapter was changed)
|
||||
public void ReloadResource()
|
||||
{
|
||||
WorldVertex v0 = new WorldVertex(0.0f, 0.0f, 0.5f);
|
||||
WorldVertex v1 = new WorldVertex(1.0f, 0.0f, 0.5f);
|
||||
WorldVertex v2 = new WorldVertex(1.0f, 8.0f, 0.5f);
|
||||
WorldVertex v3 = new WorldVertex(0.0f, 8.0f, 0.5f);
|
||||
WorldVertex v0 = new WorldVertex(0.0f, 0.0f, 32.5f);
|
||||
WorldVertex v1 = new WorldVertex(1.0f, 0.0f, 32.5f);
|
||||
WorldVertex v2 = new WorldVertex(1.0f, 8.0f, 32.5f);
|
||||
WorldVertex v3 = new WorldVertex(0.0f, 8.0f, 32.5f);
|
||||
|
||||
//WorldVertex v0 = new WorldVertex(0.0f, 0.0f, 0.5f);
|
||||
//WorldVertex v1 = new WorldVertex(32.0f, 0.0f, 0.5f);
|
||||
|
|
|
@ -109,14 +109,13 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
|
||||
public virtual void Update() {}
|
||||
|
||||
public void SetPosition(Vector3D pos, Plane plane, float angle)
|
||||
public void SetPosition(Vector3D v1, Vector3D v2, Plane plane, float angle)
|
||||
{
|
||||
Vector3D lookatpoint = new Vector3D(pos.x+128.0f, pos.y+128.0f, plane.GetZ(pos.x + 128.0f, pos.y + 128.0f));
|
||||
Matrix translate = Matrix.Translation(pos.x, pos.y, pos.z);
|
||||
Matrix rotate = Matrix.RotationZ(angle);
|
||||
Matrix planerotate = Matrix.LookAt(new Vector3f(pos.x, pos.y, pos.z), new Vector3f(lookatpoint.x, lookatpoint.y, lookatpoint.z+0.1f), new Vector3f(0.0f, 1.0f, 0.0f));
|
||||
//Matrix translate = Matrix.Translation(pos.x, pos.y, pos.z);
|
||||
//Matrix rotate = Matrix.RotationZ(angle);
|
||||
Matrix planerotate = Matrix.LookAt(RenderDevice.V3(v1), RenderDevice.V3(v2), RenderDevice.V3(plane.Normal));
|
||||
|
||||
Matrix xrotate = Matrix.RotationX(90.0f);
|
||||
//Matrix xrotate = Matrix.RotationX(90.0f);
|
||||
//Vector3 v = new Vector3(plane.Normal.x, plane.Normal.y, plane.Normal.z);
|
||||
// Matrix rotate = Matrix.RotationAxis(v, angle);
|
||||
//position = Matrix.Multiply(translate, planerotate);
|
||||
|
|
|
@ -138,12 +138,16 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
{
|
||||
float angle;
|
||||
Vector3D pos;
|
||||
Vector3D v1, v2;
|
||||
|
||||
if (sidedef.IsFront)
|
||||
{
|
||||
pos = sidedef.Line.End.Position;
|
||||
pos.z = plane.GetZ(pos);
|
||||
|
||||
v1 = sidedef.Line.Start.Position;
|
||||
v2 = sidedef.Line.End.Position;
|
||||
|
||||
angle = sidedef.Line.Angle + (float)Math.PI / 2.0f;
|
||||
if (angle > (float)Math.PI * 2.0f)
|
||||
angle -= 2.0f * (float)Math.PI;
|
||||
|
@ -153,12 +157,15 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
pos = sidedef.Line.Start.Position;
|
||||
pos.z = plane.GetZ(pos);
|
||||
|
||||
v1 = sidedef.Line.End.Position;
|
||||
v2 = sidedef.Line.Start.Position;
|
||||
|
||||
angle = sidedef.Line.Angle - (float)Math.PI / 2.0f;
|
||||
if (angle < 0.0f)
|
||||
angle += 2.0f * (float)Math.PI;
|
||||
}
|
||||
|
||||
SetPosition(pos, level.plane, angle);
|
||||
SetPosition(v1, new Vector3D(0.0f, 0.0f, -1.0f), level.plane, angle);
|
||||
}
|
||||
|
||||
internal VisualSidedefSlope GetSmartPivotHandle(VisualSidedefSlope starthandle)
|
||||
|
|
Loading…
Reference in a new issue