mirror of
https://git.sr.ht/~rabbits/macintosh_cookbook
synced 2024-06-04 16:29:31 +00:00
Added wedges
This commit is contained in:
parent
bdabb91185
commit
9b725cd77b
|
@ -16,7 +16,7 @@ program ExampleScene;
|
|||
isDown: Boolean;
|
||||
{scene}
|
||||
scene: Scene3D;
|
||||
box1, box2, pyr1: Shape3D;
|
||||
box1, box2, pyr1, pyr2, wed1, wed2: Shape3D;
|
||||
|
||||
{>>}
|
||||
procedure WindowInit;
|
||||
|
@ -103,11 +103,15 @@ begin
|
|||
{scene}
|
||||
|
||||
SetScene3D(scene);
|
||||
SetBox3D(box1, 0, 0, 0, 100, 100, 100);
|
||||
SetPyramid3D(pyr1, 150, 0, 0, 100, 100, 100);
|
||||
SetBox3D(box1, -300, 0, 0, 100, 100, 100);
|
||||
SetPyramid3D(pyr1, -150, 0, 0, 100, 100, 100);
|
||||
SetWedge3D(wed1, 150, 0, 0, 100, 100, 100, 0);
|
||||
SetWedge3D(wed2, 0, 0, 0, 100, 100, 100, 50);
|
||||
|
||||
AddShape3D(scene, @box1);
|
||||
AddShape3D(scene, @pyr1);
|
||||
AddShape3D(scene, @wed1);
|
||||
AddShape3D(scene, @wed2);
|
||||
|
||||
Redraw;
|
||||
MainLoop;
|
||||
|
|
|
@ -30,6 +30,7 @@ interface
|
|||
procedure SetLk3D (var lk3D: Link3D; a, b: Point3D);
|
||||
procedure SetBox3D (var shape: Shape3D; x, y, z, w, h, d: Fixed);
|
||||
procedure SetPyramid3D (var shape: Shape3D; x, y, z, w, h, d: Fixed);
|
||||
procedure SetWedge3D (var shape: Shape3D; x, y, z, w, h, d, a: Fixed);
|
||||
procedure DrawLink3D (link: Link3D);
|
||||
procedure DrawShape3D (shape: Shape3DPtr);
|
||||
procedure DrawScene3D (scene: Scene3D);
|
||||
|
@ -78,6 +79,26 @@ implementation
|
|||
shape.length := 12;
|
||||
end;
|
||||
|
||||
procedure SetWedge3D (var shape: Shape3D; x, y, z, w, h, d, a: Fixed);
|
||||
begin
|
||||
SetPt3D(shape.vertices[1], Long2Fix(x + a), Long2Fix(y + h div 2), Long2Fix(z - d div 2));
|
||||
SetPt3D(shape.vertices[2], Long2Fix(x + a), Long2Fix(y + h div 2), Long2Fix(z + d div 2));
|
||||
SetPt3D(shape.vertices[3], Long2Fix(x + w div 2), Long2Fix(y - h div 2), Long2Fix(z + d div 2));
|
||||
SetPt3D(shape.vertices[4], Long2Fix(x + w div 2), Long2Fix(y - h div 2), Long2Fix(z - d div 2));
|
||||
SetPt3D(shape.vertices[5], Long2Fix(x - w div 2), Long2Fix(y - h div 2), Long2Fix(z - d div 2));
|
||||
SetPt3D(shape.vertices[6], Long2Fix(x - w div 2), Long2Fix(y - h div 2), Long2Fix(z + d div 2));
|
||||
SetLk3D(shape.edges[1], shape.vertices[1], shape.vertices[2]);
|
||||
SetLk3D(shape.edges[2], shape.vertices[1], shape.vertices[4]);
|
||||
SetLk3D(shape.edges[3], shape.vertices[1], shape.vertices[5]);
|
||||
SetLk3D(shape.edges[4], shape.vertices[2], shape.vertices[3]);
|
||||
SetLk3D(shape.edges[5], shape.vertices[2], shape.vertices[6]);
|
||||
SetLk3D(shape.edges[6], shape.vertices[3], shape.vertices[4]);
|
||||
SetLk3D(shape.edges[7], shape.vertices[4], shape.vertices[5]);
|
||||
SetLk3D(shape.edges[8], shape.vertices[5], shape.vertices[6]);
|
||||
SetLk3D(shape.edges[9], shape.vertices[6], shape.vertices[3]);
|
||||
shape.length := 9;
|
||||
end;
|
||||
|
||||
procedure SetPyramid3D (var shape: Shape3D; x, y, z, w, h, d: Fixed);
|
||||
begin
|
||||
SetPt3D(shape.vertices[1], Long2Fix(x), Long2Fix(y + h div 2), Long2Fix(z));
|
||||
|
|
Loading…
Reference in New Issue
Block a user