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