import * as THREE from 'three';
import * as CONSTANTS from '../../../../types/world/worldConstants';
import * as Types from "../../../../types/world/worldTypes";

function addPillar(
    referencePole: Types.RefMesh,
    floorGroup: Types.RefGroup
): void {

    //////////  Add Pillars to the scene based on the reference. current poles position and scale  //////////

    if (referencePole.current) {
        let pole: THREE.Mesh;
        const geometry = referencePole.current.userData.geometry.clone();
        const material = new THREE.MeshStandardMaterial({ color: CONSTANTS.columnConfig.defaultColor });
        pole = new THREE.Mesh(geometry, material);
        pole.rotateX(Math.PI / 2);
        pole.name = "Pole";
        pole.position.set(referencePole.current.userData.position.x, referencePole.current.userData.position.y, referencePole.current.userData.position.z);
        floorGroup.current.add(pole);
    }
}

export default addPillar;