2025-03-25 17:34:20 +05:30
import * as THREE from "three" ;
import * as CONSTANTS from '../../../../types/world/worldConstants' ;
import * as Types from "../../../../types/world/worldTypes" ;
function addLineToScene (
start : Types.Vector3 ,
end : Types.Vector3 ,
colour : Types.Color ,
userData : Types.UserData ,
floorPlanGroupLine : Types.RefGroup
) : void {
////////// A function that creates and adds lines based on the start, end, and colour from the params, Also adds the userData in the mesh userData //////////
const path = new THREE . CatmullRomCurve3 ( [ start , end ] ) ;
const geometry = new THREE . TubeGeometry ( path , CONSTANTS . lineConfig . tubularSegments , CONSTANTS . lineConfig . radius , CONSTANTS . lineConfig . radialSegments , false ) ;
const material = new THREE . MeshBasicMaterial ( { color : colour } ) ;
const mesh = new THREE . Mesh ( geometry , material ) ;
floorPlanGroupLine . current . add ( mesh ) ;
mesh . userData . linePoints = userData ;
}
export default addLineToScene ;