mirror of
https://git.sr.ht/~rabbits/macintosh_cookbook
synced 2024-06-04 16:29:31 +00:00
Started structures
This commit is contained in:
parent
8a8366f39d
commit
08267abe89
|
@ -13,6 +13,11 @@ interface
|
|||
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);
|
||||
procedure SetPyramid3D (var shape: Shape3D; x, y, z, w, h, d, ax, az: Fixed);
|
||||
{parts}
|
||||
procedure AddLink3D (var shape: Shape3D; a, b: Integer);
|
||||
procedure AddTri3D (var shape: Shape3D; x, y, z, w, h: Fixed);
|
||||
procedure AddRect3D (var shape: Shape3D; x, y, z, w, h: Fixed);
|
||||
procedure AddCircle3D (var shape: Shape3D; x, y, z, r: Fixed);
|
||||
|
||||
implementation
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ interface
|
|||
length, verticesLength, facesLength: Integer;
|
||||
vertices: array[1..64] of Point3D;
|
||||
edges: array[1..64] of Link3D;
|
||||
faces: array[1..6] of Face3D;
|
||||
faces: array[1..16] of Face3D;
|
||||
end;
|
||||
|
||||
Shape3DPtr = ^Shape3D;
|
||||
|
|
|
@ -4,7 +4,21 @@ interface
|
|||
uses
|
||||
FixMath, Graf3D, Graf3DScene, Graf3DPrimitives;
|
||||
|
||||
procedure SetStairs3D (var shape: Shape3D; x, y, z, w, h, d: Fixed);
|
||||
|
||||
implementation
|
||||
|
||||
procedure SetStairs3D (var shape: Shape3D; x, y, z, w, h, d: Fixed);
|
||||
var
|
||||
hq: Fixed;
|
||||
begin
|
||||
hq := FixDiv(h, 4);
|
||||
|
||||
AddRect3D(shape, x, y - h div 2, z + d div 4, w, h div 4);
|
||||
AddRect3D(shape, x, y - h div 2 + FixMul(hq, 1), z + d div 4 - FixMul(hq, 1), w, h div 4);
|
||||
AddRect3D(shape, x, y - h div 2 + FixMul(hq, 2), z + d div 4 - FixMul(hq, 2), w, h div 4);
|
||||
AddRect3D(shape, x, y - h div 2 + FixMul(hq, 3), z + d div 4 - FixMul(hq, 3), w, h div 4);
|
||||
|
||||
end;
|
||||
|
||||
end.
|
|
@ -10,43 +10,21 @@ program ExampleScene;
|
|||
wed1, box1, cyl1: Shape3D;
|
||||
tri1, rec1, cir1: Shape3D;
|
||||
|
||||
sta1: Shape3D;
|
||||
|
||||
begin
|
||||
|
||||
{scene}
|
||||
|
||||
SetScene3D(scene);
|
||||
|
||||
SetWedge3D(wed2, -100, 0, -200, 100, 100, 100);
|
||||
SetBox3D(box2, 0, 0, -200, 100, 100, 100);
|
||||
SetCyl3D(cyl2, 100, 0, -200, 100, 100, 100, 50);
|
||||
SetWedge3D(wed1, -100, 0, -100, 100, 100, 100);
|
||||
SetBox3D(box1, 0, 0, -100, 100, 100, 100);
|
||||
SetCyl3D(cyl1, 100, 0, -100, 100, 100, 100, 50);
|
||||
|
||||
SetWedge3D(wed1, -100, 0, 0, 100, 100, 100);
|
||||
SetBox3D(box1, 0, 0, 0, 100, 100, 100);
|
||||
SetCyl3D(cyl1, 100, 0, 0, 100, 100, 100, 50);
|
||||
SetStairs3D(sta1, 0, 0, 0, 100, 100, 100);
|
||||
|
||||
SetWedge3D(wed3, -100, 0, 200, 100, 100, 100);
|
||||
SetBox3D(box3, 0, 0, 200, 100, 100, 100);
|
||||
SetCyl3D(cyl3, 100, 0, 200, 100, 100, 100, 50);
|
||||
|
||||
AddShape3D(scene, @wed2);
|
||||
AddShape3D(scene, @box2);
|
||||
AddShape3D(scene, @cyl2);
|
||||
|
||||
AddShape3D(scene, @wed1);
|
||||
AddShape3D(scene, @box1);
|
||||
AddShape3D(scene, @cyl1);
|
||||
|
||||
AddShape3D(scene, @wed3);
|
||||
AddShape3D(scene, @box3);
|
||||
AddShape3D(scene, @cyl3);
|
||||
|
||||
TurnXShape3D(@wed2);
|
||||
TurnXShape3D(@box2);
|
||||
TurnXShape3D(@cyl2);
|
||||
|
||||
TurnYShape3D(@wed3);
|
||||
TurnYShape3D(@box3);
|
||||
TurnYShape3D(@cyl3);
|
||||
AddShape3D(scene, @sta1);
|
||||
|
||||
InitWindow;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user