unit DDrawUtils;

interface

uses
  dvector3f,
  DEng,
  DDraw;

procedure DrawGrid(Eng: TEngine; Cells: LongInt = 20);
procedure DrawAxisLines(Eng: TEngine; const P: TVec3f; Size: Single = 1);
procedure DrawStarLines(Eng: TEngine; const P: TVec3f; Size: Single = 1);

implementation

procedure DrawGrid(Eng: TEngine; Cells: LongInt = 20);
var
  I, A, B: LongInt;
begin
  Cells := Cells div 2 + 1;
  for I := - Cells to Cells do begin
    Eng.Draw.Line(Vec3f(I, -Cells, 0), Vec3f(I, Cells, 0));
    Eng.Draw.Line(Vec3f(-Cells, I, 0), Vec3f(Cells, I, 0));
  end;
end;

procedure DrawAxisLines(Eng: TEngine; const P: TVec3f; Size: Single = 1);
begin
  Eng.Draw.RGBA(255, 0, 0, 255).Line(P, Vec3f(P.X + Size, P.Y, P.Z));
  Eng.Draw.RGBA(0, 255, 0, 255).Line(P, Vec3f(P.X, P.Y + Size, P.Z));
  Eng.Draw.RGBA(0, 0, 255, 255).Line(P, Vec3f(P.X, P.Y, P.Z + Size));
end;

procedure DrawStarLines(Eng: TEngine; const P: TVec3f; Size: Single = 1);
begin
  Eng.Draw.Line(Vec3f(P.X - Size, P.Y, P.Z), Vec3f(P.X + Size, P.Y, P.Z));
  Eng.Draw.Line(Vec3f(P.X, P.Y - Size, P.Z), Vec3f(P.X, P.Y + Size, P.Z));
  Eng.Draw.Line(Vec3f(P.X, P.Y, P.Z - Size), Vec3f(P.X, P.Y, P.Z + Size));
end;

end.
