I'm seeking advice on the best way to handle a large amount of data from a stream in Three.js
, without needing to store it in memory for the entire application's lifespan.
In traditional WebGL
, this is typically achieved with gl_drawArray
. However, I'm unsure which object in Three.js
corresponds to this functionality.
While using ParticleSystem
objects, data must be stored in memory as all points need to be placed within a Geometry
node before being passed to the ParticleSystem
; making this method unsuitable for my needs.
Any guidance you can provide would be greatly appreciated.
Edit:
To clarify, I am trying to render millions of x,y,z
coordinates as individual dots in 3D space. Currently, my process involves:
var geometry = new THREE.Geometry();
while( hasMoreData ){
var vertex = new THREE.Vector3(x,y,z);
geometry.vertices.push(vertex);
}
sphere = new THREE.ParticleSystem(geometry, shaderMaterial);
scene.add(sphere);
However, this approach significantly increases memory consumption, by around 1GB, due to the data persisting in the building of the geometry object. Is there a way to read this data from a file without it remaining in memory?