I created a simple point cloud with a few hundred points. I have a texture that’s set up as a spritesheet and I’d like to have each point correspond to a sprite sheet offset. For colors i know that setting vertexColors: THREE.VertexColors
will allow me to individually update the points of the cloud but how do i do that with textures?
this.sprite = loadedTexture;
this.sprite.wrapS = THREE.RepeatWrapping;
this.sprite.wrapT = THREE.RepeatWrapping;
this.sprite.repeat.set( 0.1, 0.1);
this.sprite.offset.x = 0.9;
this.sprite.offset.y = 0.9;
let materials = new THREE.PointsMaterial({
size: 4,
vertexColors: THREE.VertexColors,
map: this.sprite
});
let geometry = new THREE.Geometry();
for (let i = 0; i < this.totalPoints; i++) {
geometry.vertices.push(new THREE.Vector3());
geometry.colors.push(new THREE.Color());
}
this.pointCloud = new THREE.Points(geometry, materials);
this.scene.add(this.pointCloud);