This update prevents the uniform cache from storing a reference to argument arrays directly. The problem can be seen in the following example:
var array = [1, 2, 3];
uniform.setValue(array); // Uniform caches a direct reference to array!
array[0] = 5;
uniform.setValue(array); // Uniform not updated because the new value is already in the cache!
The update creates a separate array to cache the value, and manually copies values over to prevent this.
I also changed the reference to SCENEJS_uLightAttenuation in the FS to use the more common x, y, z accessors, rather than array notation. I think it's more clear, but let me know if you think otherwise.
This update prevents the uniform cache from storing a reference to argument arrays directly. The problem can be seen in the following example:
The update creates a separate array to cache the value, and manually copies values over to prevent this.
I also changed the reference to
SCENEJS_uLightAttenuation
in the FS to use the more common x, y, z accessors, rather than array notation. I think it's more clear, but let me know if you think otherwise.