mirror of
https://git.sr.ht/~rabbits/macintosh_cookbook
synced 2025-01-14 20:30:31 +00:00
Added shape budget
This commit is contained in:
parent
d8a070b5d7
commit
de90f4e649
@ -5,6 +5,7 @@ interface
|
|||||||
FixMath, Graf3D;
|
FixMath, Graf3D;
|
||||||
|
|
||||||
const
|
const
|
||||||
|
LIMIT_SHAPES = 30;
|
||||||
LIMIT_VERTICES = 32;
|
LIMIT_VERTICES = 32;
|
||||||
LIMIT_EDGES = 40;
|
LIMIT_EDGES = 40;
|
||||||
LIMIT_FACES = 8;
|
LIMIT_FACES = 8;
|
||||||
@ -37,7 +38,7 @@ interface
|
|||||||
|
|
||||||
Scene3D = record
|
Scene3D = record
|
||||||
length: Integer;
|
length: Integer;
|
||||||
shapes: array[1..30] of Shape3DPtr;
|
shapes: array[1..LIMIT_SHAPES] of Shape3DPtr;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Scene3DPtr = ^Scene3D;
|
Scene3DPtr = ^Scene3D;
|
||||||
@ -59,6 +60,7 @@ interface
|
|||||||
|
|
||||||
procedure InitWindow;
|
procedure InitWindow;
|
||||||
procedure SetScene3D (var scene: Scene3D);
|
procedure SetScene3D (var scene: Scene3D);
|
||||||
|
procedure AddShape3D (var scene: scene3D; shape: Shape3DPtr);
|
||||||
{scene}
|
{scene}
|
||||||
procedure SetVertice3D (var vertice: Point3D; x, y, z: Longint);
|
procedure SetVertice3D (var vertice: Point3D; x, y, z: Longint);
|
||||||
procedure SetEdge3D (var edge: Edge3D; a, b: Point3DPtr);
|
procedure SetEdge3D (var edge: Edge3D; a, b: Point3DPtr);
|
||||||
@ -68,7 +70,6 @@ interface
|
|||||||
procedure AddEdge3D (var shape: Shape3D; a, b: Integer);
|
procedure AddEdge3D (var shape: Shape3D; a, b: Integer);
|
||||||
procedure AddFace3D (var shape: Shape3D; a, b, c: Integer);
|
procedure AddFace3D (var shape: Shape3D; a, b, c: Integer);
|
||||||
{ transforms }
|
{ transforms }
|
||||||
procedure AddShape3D (var scene: scene3D; shape: Shape3DPtr);
|
|
||||||
procedure MoveShape3D (shape: Shape3DPtr; x, y, z: LongInt);
|
procedure MoveShape3D (shape: Shape3DPtr; x, y, z: LongInt);
|
||||||
procedure ScaleShape3D (shape: Shape3DPtr; x, y, z: LongInt);
|
procedure ScaleShape3D (shape: Shape3DPtr; x, y, z: LongInt);
|
||||||
procedure TurnXShape3D (shape: Shape3DPtr);
|
procedure TurnXShape3D (shape: Shape3DPtr);
|
||||||
@ -132,6 +133,8 @@ implementation
|
|||||||
|
|
||||||
procedure AddShape3D (var scene: scene3D; shape: Shape3DPtr);
|
procedure AddShape3D (var scene: scene3D; shape: Shape3DPtr);
|
||||||
begin
|
begin
|
||||||
|
if scene.length > LIMIT_SHAPES - 1 then
|
||||||
|
SceneError('Shapes limit reached');
|
||||||
scene.length := scene.length + 1;
|
scene.length := scene.length + 1;
|
||||||
scene.shapes[scene.length] := shape;
|
scene.shapes[scene.length] := shape;
|
||||||
end;
|
end;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user