mirror of
https://git.sr.ht/~rabbits/macintosh_cookbook
synced 2025-01-03 09:30:21 +00:00
Fixed issue with pyramid
This commit is contained in:
parent
4323d18443
commit
bdabb91185
@ -6,6 +6,7 @@ program ExampleScene;
|
||||
var
|
||||
w: WindowPtr; {A window to draw in}
|
||||
r: Rect; {A window Size}
|
||||
viewWidth, viewHeight, padLeft, padTop: Integer;
|
||||
myPort: GrafPort;
|
||||
myPort3D: Port3D;
|
||||
pa, pb: Point3D;
|
||||
@ -20,7 +21,7 @@ program ExampleScene;
|
||||
{>>}
|
||||
procedure WindowInit;
|
||||
begin
|
||||
SetRect(r, 100, 50, 300, 250);
|
||||
SetRect(r, padLeft, padTop, viewWidth + padLeft, viewHeight + padTop);
|
||||
w := NewWindow(nil, r, 'Graf3DPrimitives', true, zoomDocProc, WindowPtr(-1), false, 0);
|
||||
SetPort(w);
|
||||
end;
|
||||
@ -30,7 +31,7 @@ program ExampleScene;
|
||||
var
|
||||
size: Rect;
|
||||
begin
|
||||
SetRect(size, 0, 0, 200, 200);
|
||||
SetRect(size, 0, 0, viewWidth, viewWidth);
|
||||
FillRect(size, white);
|
||||
end;
|
||||
|
||||
@ -40,7 +41,7 @@ program ExampleScene;
|
||||
i: Integer;
|
||||
begin
|
||||
ClearScreen;
|
||||
LookAt(Long2Fix(-200), Long2Fix(200), Long2Fix(200), Long2Fix(-200));
|
||||
LookAt(Long2Fix(-viewWidth), Long2Fix(viewheight), Long2Fix(viewWidth), Long2Fix(-viewHeight));
|
||||
ViewAngle(Long2Fix(50));
|
||||
Identity;
|
||||
Yaw(Long2Fix(hangle));
|
||||
@ -89,6 +90,11 @@ program ExampleScene;
|
||||
|
||||
begin
|
||||
|
||||
viewWidth := 300;
|
||||
viewHeight := 250;
|
||||
padLeft := 100;
|
||||
padTop := 100;
|
||||
|
||||
WindowInit;
|
||||
InitGrf3D(nil);
|
||||
Open3DPort(@myPort3D);
|
||||
@ -98,11 +104,9 @@ begin
|
||||
|
||||
SetScene3D(scene);
|
||||
SetBox3D(box1, 0, 0, 0, 100, 100, 100);
|
||||
SetBox3D(box2, 0, 0, 150, 100, 40, 100);
|
||||
SetPyramid3D(pyr1, 0, 100, 0, 100, 100, 100);
|
||||
SetPyramid3D(pyr1, 150, 0, 0, 100, 100, 100);
|
||||
|
||||
AddShape3D(scene, @box1);
|
||||
AddShape3D(scene, @box2);
|
||||
AddShape3D(scene, @pyr1);
|
||||
|
||||
Redraw;
|
||||
|
@ -92,7 +92,7 @@ implementation
|
||||
SetLk3D(shape.edges[5], shape.vertices[2], shape.vertices[3]);
|
||||
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[1]);
|
||||
SetLk3D(shape.edges[8], shape.vertices[5], shape.vertices[2]);
|
||||
shape.length := 8;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user