mirror of
https://git.sr.ht/~rabbits/macintosh_cookbook
synced 2025-01-03 09:30:21 +00:00
Created camera record
This commit is contained in:
parent
37feadd9dc
commit
c4d46b9cee
@ -25,8 +25,8 @@ interface
|
||||
|
||||
Shape3D = record
|
||||
origin: Point3D;
|
||||
verticesLength:Integer;
|
||||
edgesLength:Integer;
|
||||
verticesLength: Integer;
|
||||
edgesLength: Integer;
|
||||
facesLength: Integer;
|
||||
vertices: array[1..LIMIT_VERTICES] of Point3D;
|
||||
edges: array[1..LIMIT_EDGES] of Edge3D;
|
||||
@ -42,13 +42,16 @@ interface
|
||||
|
||||
Scene3DPtr = ^Scene3D;
|
||||
|
||||
Camera3D = record
|
||||
pitch, yaw, roll: Longint;
|
||||
end;
|
||||
|
||||
var
|
||||
drawingRect: Rect; {A window Size}
|
||||
viewWidth, viewHeight, padLeft, padTop: Integer;
|
||||
myPort: GrafPort;
|
||||
myPort3D: Port3D;
|
||||
pa, pb: Point3D;
|
||||
hangle, vangle: Longint;
|
||||
camera: Camera3D;
|
||||
{cursor}
|
||||
cursor, prev: Point;
|
||||
isDown: Boolean;
|
||||
@ -245,19 +248,15 @@ implementation
|
||||
LookAt(Long2Fix(-viewWidth), Long2Fix(viewheight), Long2Fix(viewWidth), Long2Fix(-viewHeight));
|
||||
ViewAngle(Long2Fix(50));
|
||||
Identity;
|
||||
Yaw(Long2Fix(hangle));
|
||||
Pitch(Long2Fix(vangle)); { roll and pitch the plane }
|
||||
Yaw(Long2Fix(camera.yaw));
|
||||
Pitch(Long2Fix(camera.pitch));
|
||||
DrawScene3D(scene);
|
||||
end;
|
||||
|
||||
procedure WhenDownChanged;
|
||||
var
|
||||
hoff, voff: Integer;
|
||||
begin
|
||||
hoff := prev.h - cursor.h;
|
||||
hangle := hangle + hoff;
|
||||
voff := prev.v - cursor.v;
|
||||
vangle := vangle + voff;
|
||||
camera.yaw := camera.yaw + prev.h - cursor.h;
|
||||
camera.pitch := camera.pitch + prev.v - cursor.v;
|
||||
Redraw;
|
||||
GetMouse(prev);
|
||||
end;
|
||||
|
@ -1,7 +1,7 @@
|
||||
program ExampleScene;
|
||||
program ScenePrimitives;
|
||||
|
||||
uses
|
||||
FixMath, Graf3D, Graf3DScene, Graf3DPrimitives, Graf3DStructures;
|
||||
FixMath, Graf3D, Graf3DScene, Graf3DPrimitives;
|
||||
|
||||
var
|
||||
tri1, rec1, cir1: Shape3D; {2d}
|
||||
|
Loading…
Reference in New Issue
Block a user