Hello , I am creating some shapes by passing the start and end of a line coordinates. How do I add color inside the resulting closed polygon I obtain? Thank you.
import * as THREE from “three”;
import { useRef } from ‘react’;
import { useLayoutEffect } from ‘react’;
export default function Line({ start, end}) {
const ref = useRef();
useLayoutEffect(() => {
ref.current.geometry.setFromPoints(
[start, end].map((point) => new THREE.Vector3(…point))
);
}, [start, end]);
return (
<line ref={ref}>
<bufferGeometry />
<lineBasicMaterial color="black" linewidth = "0.1" />
</line>
);
}