UltimateZoneBuilder/Source/Core/GZBuilder/Geometry/Line3D.cs
MaxED a35a336527 Added, Things mode: dynamic light things light radii are now rendered (can be disabled by setting "Dynamic light mode" to "Don't show dynamic lights" on the top toolbar).
Internal, Renderer2D.RenderArrows(): only visible lines are now rendered.
Internal, API: renamed public Line3D properties: v1 to Start, v2 to End, color to Color, renderarrowhead to RenderArrowhead.
2015-12-14 12:34:31 +00:00

63 lines
1.5 KiB
C#

using System;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Rendering;
namespace CodeImp.DoomBuilder.GZBuilder.Geometry
{
public class Line3D
{
// Coordinates
public Vector3D Start;
public Vector3D End;
public PixelColor Color;
public readonly bool RenderArrowhead;
// Changed by Renderer2D.RenderArrows()
internal Vector2D Start2D;
internal Vector2D End2D;
internal bool SkipRendering;
// Constructors
public Line3D(Vector3D start, Vector3D end)
{
this.Start = start;
this.End = end;
this.Color = General.Colors.InfoLine;
this.RenderArrowhead = true;
}
public Line3D(Vector3D start, Vector3D end, bool renderArrowhead)
{
this.Start = start;
this.End = end;
this.Color = General.Colors.InfoLine;
this.RenderArrowhead = renderArrowhead;
}
public Line3D(Vector3D start, Vector3D end, PixelColor color)
{
this.Start = start;
this.End = end;
this.Color = color;
this.RenderArrowhead = true;
}
public Line3D(Vector3D start, Vector3D end, PixelColor color, bool renderArrowhead)
{
this.Start = start;
this.End = end;
this.Color = color;
this.RenderArrowhead = renderArrowhead;
}
public Vector3D GetDelta() { return End - Start; }
// This calculates the angle
public float GetAngle()
{
// Calculate and return the angle
Vector2D d = GetDelta();
return -(float)Math.Atan2(-d.y, d.x) + Angle2D.PIHALF;
}
}
}