import { Quaternion, Vector3 } from "../../math/index.js";
export class TransformComponent {
    position;
    rotation;
    scale;
    constructor(position = Vector3.zero.clone(), rotation = Quaternion.identity.clone(), scale = Vector3.one.clone()) {
        this.position = position instanceof Vector3 ? position.toArray() : [...position];
        const normalizedRotation = rotation instanceof Quaternion ? rotation.normalize() : new Quaternion(rotation[0], rotation[1], rotation[2], rotation[3]).normalize();
        this.rotation = [normalizedRotation.x, normalizedRotation.y, normalizedRotation.z, normalizedRotation.w];
        this.scale = scale instanceof Vector3 ? scale.toArray() : [...scale];
    }
    toJSON() {
        return {
            position: [...this.position],
            rotation: [...this.rotation],
            scale: [...this.scale]
        };
    }
    toMath() {
        return {
            position: new Vector3(this.position[0], this.position[1], this.position[2]),
            rotation: new Quaternion(this.rotation[0], this.rotation[1], this.rotation[2], this.rotation[3]),
            scale: new Vector3(this.scale[0], this.scale[1], this.scale[2])
        };
    }
}
//# sourceMappingURL=TransformComponent.js.map