mirror of
https://git.sr.ht/~rabbits/macintosh_cookbook
synced 2025-01-18 01:29:42 +00:00
Cleaned up primitives
This commit is contained in:
parent
d08f838eec
commit
96a0102d6f
@ -4,22 +4,22 @@ interface
|
||||
uses
|
||||
FixMath, Graf3D, Graf3DScene;
|
||||
|
||||
{2d}
|
||||
procedure SetTri3D (var shape: Shape3D; x, y, z, w, h: Fixed);
|
||||
procedure SetRec3D (var shape: Shape3D; x, y, z, w, d: Fixed);
|
||||
procedure SetCir3D (var shape: Shape3D; x, y, z, r: Fixed);
|
||||
{3d}
|
||||
procedure SetWed3D (var shape: Shape3D; x, y, z, w, h, d: Fixed);
|
||||
procedure SetBox3D (var shape: Shape3D; x, y, z, w, h, d: Fixed);
|
||||
procedure SetCyl3D (var shape: Shape3D; x, y, z, w, h, d, r: Fixed);
|
||||
{parts}
|
||||
procedure AddTri3D (var shape: Shape3D; x, y, z, w, h: Longint);
|
||||
procedure AddRec3D (var shape: Shape3D; x, y, z, w, h: Longint);
|
||||
procedure AddCir3D (var shape: Shape3D; x, y, z, d: Longint);
|
||||
{2d}
|
||||
procedure SetTri3D (var shape: Shape3D; x, y, z, w, h: Longint);
|
||||
procedure SetRec3D (var shape: Shape3D; x, y, z, w, d: Longint);
|
||||
procedure SetCir3D (var shape: Shape3D; x, y, z, r: Longint);
|
||||
{3d}
|
||||
procedure SetWed3D (var shape: Shape3D; x, y, z, w, h, d: Longint);
|
||||
procedure SetBox3D (var shape: Shape3D; x, y, z, w, h, d: Longint);
|
||||
procedure SetCyl3D (var shape: Shape3D; x, y, z, w, h, d, r: Longint);
|
||||
|
||||
implementation
|
||||
|
||||
procedure AddTri3D (var shape: Shape3D; x, y, z, w, h: Fixed);
|
||||
procedure AddTri3D (var shape: Shape3D; x, y, z, w, h: Longint);
|
||||
begin
|
||||
AddVertice3D(shape, x, y + h div 2, z);
|
||||
AddVertice3D(shape, x + w div 2, y - h div 2, z);
|
||||
@ -30,7 +30,7 @@ implementation
|
||||
AddFace3D(shape, shape.verticesLength - 2, shape.verticesLength - 1, shape.verticesLength);
|
||||
end;
|
||||
|
||||
procedure AddRec3D (var shape: Shape3D; x, y, z, w, h: Fixed);
|
||||
procedure AddRec3D (var shape: Shape3D; x, y, z, w, h: Longint);
|
||||
begin
|
||||
AddVertice3D(shape, x + w div 2, y + h div 2, z);
|
||||
AddVertice3D(shape, x + w div 2, y - h div 2, z);
|
||||
@ -44,7 +44,7 @@ implementation
|
||||
AddFace3D(shape, shape.verticesLength - 3, shape.verticesLength - 2, shape.verticesLength);
|
||||
end;
|
||||
|
||||
procedure AddCir3D (var shape: Shape3D; x, y, z, d: Fixed);
|
||||
procedure AddCir3D (var shape: Shape3D; x, y, z, d: Longint);
|
||||
var
|
||||
voff, eoff, foff: Integer; { vertices offset}
|
||||
i, segs: Integer;
|
||||
@ -72,33 +72,22 @@ implementation
|
||||
end;
|
||||
|
||||
{publics}
|
||||
procedure SetTri3D (var shape: Shape3D; x, y, z, w, h: Fixed);
|
||||
procedure SetTri3D (var shape: Shape3D; x, y, z, w, h: Longint);
|
||||
begin
|
||||
AddTri3D(shape, x, y, z, w, h);
|
||||
end;
|
||||
|
||||
procedure SetRec3D (var shape: Shape3D; x, y, z, w, d: Fixed);
|
||||
procedure SetRec3D (var shape: Shape3D; x, y, z, w, d: Longint);
|
||||
begin
|
||||
AddRec3D(shape, x, y, z, w, d);
|
||||
end;
|
||||
|
||||
procedure SetCir3D (var shape: Shape3D; x, y, z, r: Fixed);
|
||||
procedure SetCir3D (var shape: Shape3D; x, y, z, r: Longint);
|
||||
begin
|
||||
AddCir3D(shape, x, y, z, r);
|
||||
end;
|
||||
|
||||
procedure SetBox3D (var shape: Shape3D; x, y, z, w, h, d: Fixed);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
SetPt3D(shape.origin, Long2Fix(x), Long2Fix(y), Long2Fix(z));
|
||||
AddRec3D(shape, x, y, z + d div 2, w, h);
|
||||
AddRec3D(shape, x, y, z - d div 2, w, h);
|
||||
for i := 1 to 4 do
|
||||
AddEdge3D(shape, i, i + 4);
|
||||
end;
|
||||
|
||||
procedure SetWed3D (var shape: Shape3D; x, y, z, w, h, d: Fixed);
|
||||
procedure SetWed3D (var shape: Shape3D; x, y, z, w, h, d: Longint);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -109,7 +98,18 @@ implementation
|
||||
AddEdge3D(shape, i, i + 3);
|
||||
end;
|
||||
|
||||
procedure SetCyl3D (var shape: Shape3D; x, y, z, w, h, d, r: Fixed);
|
||||
procedure SetBox3D (var shape: Shape3D; x, y, z, w, h, d: Longint);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
SetPt3D(shape.origin, Long2Fix(x), Long2Fix(y), Long2Fix(z));
|
||||
AddRec3D(shape, x, y, z + d div 2, w, h);
|
||||
AddRec3D(shape, x, y, z - d div 2, w, h);
|
||||
for i := 1 to 4 do
|
||||
AddEdge3D(shape, i, i + 4);
|
||||
end;
|
||||
|
||||
procedure SetCyl3D (var shape: Shape3D; x, y, z, w, h, d, r: Longint);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
|
Loading…
x
Reference in New Issue
Block a user