import { ColorCompat } from "../math/index.js";
export class MaterialCompat {
    type = "Material";
    transparent = false;
    opacity = 1;
    side = "FrontSide";
    constructor(parameters = {}) {
        this.transparent = parameters.transparent ?? false;
        this.opacity = parameters.opacity ?? 1;
        this.side = parameters.side ?? "FrontSide";
    }
}
export class MeshBasicMaterialCompat extends MaterialCompat {
    type = "MeshBasicMaterial";
    color = new ColorCompat();
}
export class MeshLambertMaterialCompat extends MaterialCompat {
    type = "MeshLambertMaterial";
    approximation = "ThreeCompat diffuse lighting approximation";
}
export class MeshPhongMaterialCompat extends MaterialCompat {
    type = "MeshPhongMaterial";
    shininess = 30;
    approximation = "ThreeCompat specular lighting approximation";
}
export class MeshStandardMaterialCompat extends MaterialCompat {
    type = "MeshStandardMaterial";
    roughness = 0.5;
    metalness = 0;
}
export class MeshPhysicalMaterialCompat extends MeshStandardMaterialCompat {
    type = "MeshPhysicalMaterial";
    clearcoat = 0;
    transmission = 0;
    ior = 1.5;
}
export class ShaderMaterialCompat extends MaterialCompat {
    type = "ShaderMaterial";
    uniforms = {};
    vertexShader = "";
    fragmentShader = "";
}
export class PointsMaterialCompat extends MaterialCompat {
    type = "PointsMaterial";
    size = 1;
    sizeAttenuation = true;
    constructor(parameters = {}) {
        super(parameters);
        this.size = validateNonNegative(parameters.size ?? 1, "PointsMaterial size");
        this.sizeAttenuation = parameters.sizeAttenuation ?? true;
    }
}
export class LineBasicMaterialCompat extends MaterialCompat {
    type = "LineBasicMaterial";
    linewidth = 1;
}
export class SpriteMaterialCompat extends MaterialCompat {
    type = "SpriteMaterial";
    rotation = 0;
    sizeAttenuation = true;
    constructor(parameters = {}) {
        super(parameters);
        if (!Number.isFinite(parameters.rotation ?? 0))
            throw new RangeError("SpriteMaterial rotation must be finite.");
        this.rotation = parameters.rotation ?? 0;
        this.sizeAttenuation = parameters.sizeAttenuation ?? true;
    }
}
export const THREE_COMPAT_COMPAT_MATERIAL_TYPES = [
    "MeshBasicMaterial",
    "MeshLambertMaterial",
    "MeshPhongMaterial",
    "MeshStandardMaterial",
    "MeshPhysicalMaterial",
    "ShaderMaterial",
    "PointsMaterial",
    "LineBasicMaterial",
    "SpriteMaterial"
];
function validateNonNegative(value, label) {
    if (!Number.isFinite(value) || value < 0)
        throw new RangeError(`${label} must be finite and non-negative.`);
    return value;
}
//# sourceMappingURL=index.js.map