Added shape budget

This commit is contained in:
neauoire 2020-05-16 21:08:19 +09:00
parent d8a070b5d7
commit de90f4e649

View File

@ -5,6 +5,7 @@ interface
FixMath, Graf3D;
const
LIMIT_SHAPES = 30;
LIMIT_VERTICES = 32;
LIMIT_EDGES = 40;
LIMIT_FACES = 8;
@ -37,7 +38,7 @@ interface
Scene3D = record
length: Integer;
shapes: array[1..30] of Shape3DPtr;
shapes: array[1..LIMIT_SHAPES] of Shape3DPtr;
end;
Scene3DPtr = ^Scene3D;
@ -59,6 +60,7 @@ interface
procedure InitWindow;
procedure SetScene3D (var scene: Scene3D);
procedure AddShape3D (var scene: scene3D; shape: Shape3DPtr);
{scene}
procedure SetVertice3D (var vertice: Point3D; x, y, z: Longint);
procedure SetEdge3D (var edge: Edge3D; a, b: Point3DPtr);
@ -68,7 +70,6 @@ interface
procedure AddEdge3D (var shape: Shape3D; a, b: Integer);
procedure AddFace3D (var shape: Shape3D; a, b, c: Integer);
{ transforms }
procedure AddShape3D (var scene: scene3D; shape: Shape3DPtr);
procedure MoveShape3D (shape: Shape3DPtr; x, y, z: LongInt);
procedure ScaleShape3D (shape: Shape3DPtr; x, y, z: LongInt);
procedure TurnXShape3D (shape: Shape3DPtr);
@ -132,6 +133,8 @@ implementation
procedure AddShape3D (var scene: scene3D; shape: Shape3DPtr);
begin
if scene.length > LIMIT_SHAPES - 1 then
SceneError('Shapes limit reached');
scene.length := scene.length + 1;
scene.shapes[scene.length] := shape;
end;