Exception when adding second point light
Opened this issue · 1 comments
when I add a second point light I get an exception
Stack Trace:
#0 List.[]= (dart:core-patch/growable_array.dart:157)
#1 WebGLRenderer.setupLights (package:three/src/renderers/web_gl_renderer.dart:5885:19)
#2 WebGLRenderer.setProgram (package:three/src/renderers/web_gl_renderer.dart:5201:17)
#3 WebGLRenderer.renderBuffer (package:three/src/renderers/web_gl_renderer.dart:3647:23)
#4 WebGLRenderer.renderObjects (package:three/src/renderers/web_gl_renderer.dart:4293:18)
#5 WebGLRenderer._render (package:three/src/renderers/web_gl_renderer.dart:4167:17)
#6 WebGLRenderer.render (package:three/src/renderers/web_gl_renderer.dart:4013:49)
#7 Frame.render (http://127.0.0.1:8080/metropolis.dart:291:20)
#8 Game.run. (http://127.0.0.1:8080/game.dart:11:51)
#9 _rootRunUnary (dart:async/zone.dart:730)
#10 _RootZone.runUnary (dart:async/zone.dart:864)
#11 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
#12 _Future._propagateToListeners (dart:async/future_impl.dart:571)
#13 _Future._complete (dart:async/future_impl.dart:317)
#14 _SyncCompleter.complete (dart:async/future_impl.dart:44)
#15 Window.animationFrame. (dart:html:29269)
Exception: RangeError: 1
this source is where the issue is:
if (pointDistances==null) { pointDistances = new List(); pointDistances.add(0); }
if (pointDistances.length == 0) {pointDistances.add(0);}
pointDistances[ pointLength ] = distance;
Looking at it my guess is that the issue stems from this being taken from javascript. In javascript "pointDistances[ pointsLength] = distance " would create the index when pointsLength > greater than pointsDistances.length but in dart this throws a range exception. I'd make the change and contribute myself but work restrictions prevent it at the moment.
I guess this one can be closed.