/*! perf: only here import three.js, others(e.g. meta3d-pipeline-webgl1-three) shouln't import three.js again
* 
*/

import { service } from "meta3d-three-api-protocol/src/service/ServiceType"
import { state } from "meta3d-three-api-protocol/src/state/StateType"
import { getExtensionService as getExtensionServiceMeta3D, createExtensionState as createExtensionStateMeta3D, getExtensionLife as getLifeMeta3D } from "meta3d-type"
import {
    BufferAttribute, Color, CubeTexture, FrontSide, Layers, Matrix3, Matrix4, NoBlending, Sphere, Texture, Vector3,
    Quaternion, WebGLRenderer,
    WebGLRenderTarget,
    ClampToEdgeWrapping,
    DoubleSide,
    InterpolateDiscrete,
    InterpolateLinear,
    NoColorSpace,
    LinearFilter,
    LinearMipmapLinearFilter,
    LinearMipmapNearestFilter,
    MathUtils,
    MirroredRepeatWrapping,
    NearestFilter,
    NearestMipmapLinearFilter,
    NearestMipmapNearestFilter,
    PropertyBinding,
    RGBAFormat,
    RepeatWrapping,
    Scene,
    Source,
    SRGBColorSpace,
    CompressedTexture,
    DepthTexture,

    PlaneGeometry,
    ShaderMaterial,
    Uniform,
    Mesh,
    PerspectiveCamera,

    AnimationClip,
    Bone,
    Box3,
    BufferGeometry,
    DirectionalLight,
    FileLoader,
    Group,
    ImageBitmapLoader,
    InstancedMesh,
    InterleavedBuffer,
    InterleavedBufferAttribute,
    Interpolant,
    Line,
    LineBasicMaterial,
    LineLoop,
    LineSegments,
    Loader,
    LoaderUtils,
    Material,
    MeshBasicMaterial,
    MeshPhysicalMaterial,
    MeshStandardMaterial,
    NumberKeyframeTrack,
    Object3D,
    OrthographicCamera,
    PointLight,
    Points,
    PointsMaterial,
    QuaternionKeyframeTrack,
    Skeleton,
    SkinnedMesh,
    SpotLight,
    TextureLoader,
    Vector2,
    VectorKeyframeTrack,


    TriangleFanDrawMode,
    TriangleStripDrawMode,
    TrianglesDrawMode,

    UVMapping,
    CubeReflectionMapping,
    CubeRefractionMapping,
    EquirectangularReflectionMapping,
    EquirectangularRefractionMapping,
    CubeUVReflectionMapping,

    TangentSpaceNormalMap,
    ObjectSpaceNormalMap,

    HalfFloatType,
    Float32BufferAttribute,
    UniformsUtils,
    Clock,

    LinearSRGBColorSpace,
    CompressedArrayTexture,
    Data3DTexture,
    DataTexture,
    DisplayP3ColorSpace,
    FloatType,
    LinearDisplayP3ColorSpace,
    RedFormat,
    RGB_ETC1_Format,
    RGB_ETC2_Format,
    RGB_PVRTC_4BPPV1_Format,
    RGB_S3TC_DXT1_Format,
    RGBA_ASTC_4x4_Format,
    RGBA_ASTC_6x6_Format,
    RGBA_BPTC_Format,
    RGBA_ETC2_EAC_Format,
    RGBA_PVRTC_4BPPV1_Format,
    RGBA_S3TC_DXT5_Format,
    RGFormat,
    UnsignedByteType,

    Raycaster,
    Ray,
    RGBADepthPacking,
    MeshDepthMaterial,
    AdditiveBlending,
    Triangle,
} from "three";

export let getExtensionService: getExtensionServiceMeta3D<service> = (_api) => {
    return {
        WebGLRenderer: WebGLRenderer,
        WebGLRenderTarget: WebGLRenderTarget,
        BufferAttribute: BufferAttribute,
        Color: Color,
        CubeTexture: CubeTexture,
        FrontSide: FrontSide,
        Layers: Layers,
        Matrix3: Matrix3,
        Matrix4: Matrix4,
        NoBlending: NoBlending,
        Sphere: Sphere,
        Texture: Texture,
        Vector3: Vector3,
        Quaternion: Quaternion,
        ClampToEdgeWrapping: ClampToEdgeWrapping,
        DoubleSide: DoubleSide,
        InterpolateDiscrete: InterpolateDiscrete,
        InterpolateLinear: InterpolateLinear,
        NoColorSpace: NoColorSpace,
        LinearFilter: LinearFilter,
        LinearMipmapLinearFilter: LinearMipmapLinearFilter,
        LinearMipmapNearestFilter: LinearMipmapNearestFilter,
        MathUtils: MathUtils,
        MirroredRepeatWrapping: MirroredRepeatWrapping,
        NearestFilter: NearestFilter,
        NearestMipmapLinearFilter: NearestMipmapLinearFilter,
        NearestMipmapNearestFilter: NearestMipmapNearestFilter,
        PropertyBinding: PropertyBinding,
        RGBAFormat: RGBAFormat,
        RepeatWrapping: RepeatWrapping,
        Scene: Scene,
        Source: Source,
        SRGBColorSpace: SRGBColorSpace,
        CompressedTexture: CompressedTexture,
        DepthTexture: DepthTexture,
        PlaneGeometry: PlaneGeometry,
        ShaderMaterial: ShaderMaterial,
        Uniform: Uniform,
        Mesh: Mesh,
        PerspectiveCamera: PerspectiveCamera,


        AnimationClip: AnimationClip,
        Bone: Bone,
        Box3: Box3,
        BufferGeometry: BufferGeometry,
        DirectionalLight: DirectionalLight,
        FileLoader: FileLoader,
        Group: Group,
        ImageBitmapLoader: ImageBitmapLoader,
        InstancedMesh: InstancedMesh,
        InterleavedBuffer: InterleavedBuffer,
        InterleavedBufferAttribute: InterleavedBufferAttribute,
        Interpolant: Interpolant,
        Line: Line,
        LineBasicMaterial: LineBasicMaterial,
        LineLoop: LineLoop,
        LineSegments: LineSegments,
        Loader: Loader,
        LoaderUtils: LoaderUtils,
        Material: Material,
        MeshBasicMaterial: MeshBasicMaterial,
        MeshPhysicalMaterial: MeshPhysicalMaterial,
        MeshStandardMaterial: MeshStandardMaterial,
        NumberKeyframeTrack: NumberKeyframeTrack,
        Object3D: Object3D,
        OrthographicCamera: OrthographicCamera,
        PointLight: PointLight,
        Points: Points,
        PointsMaterial: PointsMaterial,
        QuaternionKeyframeTrack: QuaternionKeyframeTrack,
        Skeleton: Skeleton,
        SkinnedMesh: SkinnedMesh,
        SpotLight: SpotLight,
        TextureLoader: TextureLoader,
        Vector2: Vector2,
        VectorKeyframeTrack: VectorKeyframeTrack,

        TriangleFanDrawMode: TriangleFanDrawMode,
        TriangleStripDrawMode: TriangleStripDrawMode,
        TrianglesDrawMode: TrianglesDrawMode,

        UVMapping: UVMapping,
        CubeReflectionMapping: CubeReflectionMapping,
        CubeRefractionMapping: CubeRefractionMapping,
        EquirectangularReflectionMapping: EquirectangularReflectionMapping,
        EquirectangularRefractionMapping: EquirectangularRefractionMapping,
        CubeUVReflectionMapping: CubeUVReflectionMapping,

        TangentSpaceNormalMap: TangentSpaceNormalMap,
        ObjectSpaceNormalMap: ObjectSpaceNormalMap,

        HalfFloatType: HalfFloatType,
        Float32BufferAttribute: Float32BufferAttribute,
        UniformsUtils: UniformsUtils,
        Clock: Clock,

        LinearSRGBColorSpace: LinearSRGBColorSpace,
        CompressedArrayTexture,
        Data3DTexture,
        DataTexture,
        DisplayP3ColorSpace,
        FloatType,
        LinearDisplayP3ColorSpace,
        RedFormat,
        RGB_ETC1_Format,
        RGB_ETC2_Format,
        RGB_PVRTC_4BPPV1_Format,
        RGB_S3TC_DXT1_Format,
        RGBA_ASTC_4x4_Format,
        RGBA_ASTC_6x6_Format,
        RGBA_BPTC_Format,
        RGBA_ETC2_EAC_Format,
        RGBA_PVRTC_4BPPV1_Format,
        RGBA_S3TC_DXT5_Format,
        RGFormat,
        UnsignedByteType,

        Raycaster,
        Ray,
        RGBADepthPacking,
        MeshDepthMaterial,
        AdditiveBlending,
        Triangle,
    }
}

export let createExtensionState: createExtensionStateMeta3D<state> = () => {
    return null
}

export let getExtensionLife: getLifeMeta3D<service> = (api, extensionProtocolName) => {
    return {
    }
}
