I am trying to pass an array of floats as a uniforms, I get the follwoing error when updating the array to real values:
Failed to execute 'uniform1fv' on 'WebGL2RenderingContext': The provided value cannot be converted to a sequence. at PureArrayUniform.setValueV1fArray [as setValue
uniforms: { ...
//DATA
time: { type: "float", value: 0.0 },
gazePointsLen: { type: "int", value: 0 },
gazePoints: { value: new Array(1000) },
},
if (!!p.g && p.time < currentTime) {
gazePoints.push(p.g[0]);
gazePoints.push(p.g[1]);
gazePoints.push(p.g[2]);
gazePoints.push(p.time);
}
});
//ensure the array is 1000 length
for (let i = 0; gazePoints.length < 1000; i++) {
gazePoints.push(0.0001);
}
heatmapPass.heatmapMaterial.uniforms.gazePointsLen = sessionGaze.length;
heatmapPass.heatmapMaterial.uniforms.gazePoints = gazePoints;
heatmapPass.heatmapMaterial.uniforms.time = currentTime;
heatmapPass.heatmapMaterial.needsUpdate = true;
in the shader
uniform float gazePoints[array_len];
vec3 pt1 =vec3(gazePoints[0], gazePoints[1], gazePoints[2]);
...
Here are the console logs
Using the uniform ‘time’ doesnt not work either, i cant update the uniforms it seems.