From 87e9c9fa25b21bec3a658dcebc6c765a511d838e Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 27 Aug 2023 11:44:43 +0300 Subject: [WGL/P] Slight code reorganisation, moved buffer logic for black holes in BlackHole and exported count limits as global variables --- Year 2/Computer Graphics with WebGL/Project/star.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Year 2/Computer Graphics with WebGL/Project/star.js') diff --git a/Year 2/Computer Graphics with WebGL/Project/star.js b/Year 2/Computer Graphics with WebGL/Project/star.js index a98c3cf..1931c7f 100644 --- a/Year 2/Computer Graphics with WebGL/Project/star.js +++ b/Year 2/Computer Graphics with WebGL/Project/star.js @@ -1,6 +1,9 @@ starsBuf = []; Star = function(center, size) { + if (starsBuf.length == STAR_MAX_COUNT) + throw "Error: cannot add more stars, limit of " + STAR_MAX_COUNT + " reached!" + this.sphere = new Sphere(center, size); this.sphere.color = [0.956,0.5,0.215]; this.index = starsBuf.push([]) - 1; -- cgit v1.3.1-26-gb76a