I am working with an array of Vector3s that represents a curved shape in 3D space. While I have successfully rendered an outline of the curve in Three.js using THREE.Geometry
and THREE.Line
, I am now looking to fill it with color.
My attempts to use THREE.ShapeGeometry
and THREE.Mesh
were not successful, as it appears that THREE.ShapeGeometry
is designed for 2D planes only (ignoring z-coordinates). Additionally, manually defining faces within THREE.Geometry
did not yield the desired outcome.
I would appreciate advice on the correct approach to achieving this.
Code:
geom.vertices = curve.getPoints(100);
for (var i = 0; i < 97; i++) {
geom.faces.push(new THREE.Face3(i, i + 1, i + 2));
}
var material = new THREE.MeshNormalMaterial();
obj = new THREE.Mesh(geom, material);
scene.add(obj);