import '../../../scene/scene.js';
import '@zephyr3d/base';
import '../../../values.js';
import '../../../render/render_queue.js';
import '../../../render/primitive.js';
import '@zephyr3d/device';
import '../../../material/shader/helper.js';
import '../../../material/lambert.js';
import '../../../material/blinn.js';
import '../../../material/unlit.js';
import { ParticleMaterial } from '../../../material/particle.js';
import '../../../material/meshmaterial.js';
import '../../../material/grassmaterial.js';
import '../../../material/terrain-cm.js';
import '../../../material/pbrmr.js';
import '../../../material/pbrsg.js';
import '../../../material/pbrblueprint.js';
import '../../../material/sprite.js';
import '../../../material/sprite_std.js';
import { defineProps } from '../types.js';
import '../../blueprint/material/texture.js';
import '../../../render/rendergraph/forward_plus_builder.js';
import '../../../render/sky.js';
import '../../../render/clipmap.js';
import '../../../shaders/atmosphere.js';
import { GraphNode } from '../../../scene/graph_node.js';
import '../../../shadow/shadowmapper.js';
import '../../../scene/mesh.js';
import '../../../scene/basesprite.js';
import '../../../scene/water.js';
import '../../../scene/scene_node.js';
import { ParticleSystem } from '../../../scene/particlesys.js';
import '../../../scene/batchgroup.js';
import '../../../scene/terrain-cm/terrain-cm.js';
import '../../../scene/terrain-cm/grass.js';
import '../../../scene/raycast_visitor.js';

/** @internal */ function getParticleNodeClass() {
    return {
        ctor: ParticleSystem,
        name: 'ParticleSystem',
        parent: GraphNode,
        createFunc (ctx) {
            const node = new ParticleSystem(ctx.scene);
            node.parent = ctx;
            return {
                obj: node
            };
        },
        getProps () {
            return defineProps([
                {
                    name: 'WorldSpace',
                    description: 'If true, particle positions will be calculated in world space',
                    type: 'bool',
                    default: true,
                    get (value) {
                        value.bool[0] = this.worldSpace;
                    },
                    set (value) {
                        this.worldSpace = value.bool[0];
                    }
                },
                {
                    name: 'MaxParticleCount',
                    description: 'Maximum particle count',
                    type: 'int',
                    default: 100,
                    get (value) {
                        value.num[0] = this.maxParticleCount;
                    },
                    set (value) {
                        this.maxParticleCount = value.num[0];
                    }
                },
                {
                    name: 'EmitInterval',
                    description: 'Particle emit interval in millionseconds',
                    type: 'int',
                    default: 100,
                    get (value) {
                        value.num[0] = this.emitInterval;
                    },
                    set (value) {
                        this.emitInterval = value.num[0];
                    }
                },
                {
                    name: 'EmitCount',
                    description: 'How many particles will be emitted at once',
                    type: 'int',
                    default: 1,
                    get (value) {
                        value.num[0] = this.emitCount;
                    },
                    set (value) {
                        this.emitCount = value.num[0];
                    }
                },
                {
                    name: 'Gravity',
                    description: 'Gravity acceleration applied to particles',
                    type: 'vec3',
                    default: [
                        0,
                        0,
                        0
                    ],
                    options: {
                        animatable: true
                    },
                    get (value) {
                        const gravity = this.gravity;
                        value.num[0] = gravity.x;
                        value.num[1] = gravity.y;
                        value.num[2] = gravity.z;
                    },
                    set (value) {
                        this.gravity.setXYZ(value.num[0], value.num[1], value.num[2]);
                    }
                },
                {
                    name: 'Wind',
                    description: 'Wind velocity applied to particles',
                    type: 'vec3',
                    default: [
                        0,
                        0,
                        0
                    ],
                    options: {
                        animatable: true
                    },
                    get (value) {
                        const wind = this.wind;
                        value.num[0] = wind.x;
                        value.num[1] = wind.y;
                        value.num[2] = wind.z;
                    },
                    set (value) {
                        this.wind.setXYZ(value.num[0], value.num[1], value.num[2]);
                    }
                },
                {
                    name: 'Scalar',
                    description: 'Size scale for particles',
                    type: 'float',
                    default: 1,
                    options: {
                        animatable: true
                    },
                    get (value) {
                        value.num[0] = this.scalar;
                    },
                    set (value) {
                        this.scalar = value.num[0];
                    }
                },
                {
                    name: 'Aspect',
                    description: 'Particle aspect ratio',
                    type: 'float',
                    default: 1,
                    options: {
                        animatable: true
                    },
                    get (value) {
                        value.num[0] = this.aspect;
                    },
                    set (value) {
                        this.aspect = value.num[0];
                    }
                },
                {
                    name: 'AirResistence',
                    description: 'If true, particles are slowed by air resistance',
                    type: 'bool',
                    default: false,
                    get (value) {
                        value.bool[0] = this.airResistence;
                    },
                    set (value) {
                        this.airResistence = value.bool[0];
                    }
                },
                {
                    name: 'JitterSpeed',
                    description: 'Speed of random particle jitter',
                    type: 'float',
                    default: 1,
                    options: {
                        animatable: true
                    },
                    get (value) {
                        value.num[0] = this.jitterSpeed;
                    },
                    set (value) {
                        this.jitterSpeed = value.num[0];
                    }
                },
                {
                    name: 'JitterPower',
                    description: 'Strength of random particle jitter',
                    type: 'float',
                    default: 0,
                    options: {
                        animatable: true
                    },
                    get (value) {
                        value.num[0] = this.jitterPower;
                    },
                    set (value) {
                        this.jitterPower = value.num[0];
                    }
                },
                {
                    name: 'EmitterShape',
                    description: 'Shape of the particle emission volume',
                    type: 'string',
                    options: {
                        enum: {
                            labels: [
                                'Point',
                                'Sphere',
                                'Box',
                                'Cylinder',
                                'Cone'
                            ],
                            values: [
                                'point',
                                'sphere',
                                'box',
                                'cylinder',
                                'cone'
                            ]
                        }
                    },
                    default: 'point',
                    get (value) {
                        value.str[0] = this.emitterShape;
                    },
                    set (value) {
                        this.emitterShape = value.str[0];
                    }
                },
                {
                    name: 'EmitterBehavior',
                    description: 'Whether particles spawn on the surface or throughout the volume',
                    type: 'string',
                    options: {
                        enum: {
                            labels: [
                                'Surface',
                                'Volume'
                            ],
                            values: [
                                'surface',
                                'volume'
                            ]
                        }
                    },
                    default: 'surface',
                    get (value) {
                        value.str[0] = this.emitterBehavior;
                    },
                    set (value) {
                        this.emitterBehavior = value.str[0];
                    }
                },
                {
                    name: 'Directional',
                    description: 'If true, emitted particles follow the emitter direction',
                    type: 'bool',
                    default: false,
                    get (value) {
                        value.bool[0] = this.directional;
                    },
                    set (value) {
                        this.directional = value.bool[0];
                    }
                },
                {
                    name: 'Rotation',
                    description: 'Min/Max value of particle rotation',
                    type: 'vec2',
                    default: [
                        0,
                        0
                    ],
                    options: {
                        animatable: true
                    },
                    get (value) {
                        value.num[0] = this.particleRotationMin;
                        value.num[1] = this.particleRotationMax;
                    },
                    set (value) {
                        this.particleRotationMin = value.num[0];
                        this.particleRotationMax = value.num[1];
                    }
                },
                {
                    name: 'ConeRadius',
                    description: 'min/max radius of particle emit cone',
                    type: 'vec2',
                    default: [
                        0,
                        0.1
                    ],
                    options: {
                        animatable: true
                    },
                    get (value) {
                        value.num[0] = this.emitterConeRadiusMin;
                        value.num[1] = this.emitterConeRadiusMax;
                    },
                    set (value) {
                        this.emitterConeRadiusMin = value.num[0];
                        this.emitterConeRadiusMax = value.num[1];
                    }
                },
                {
                    name: 'Velocity',
                    description: 'min/max value of initial speed of particles',
                    type: 'vec2',
                    default: [
                        2,
                        3
                    ],
                    options: {
                        animatable: true
                    },
                    get (value) {
                        value.num[0] = this.particleVelocityMin;
                        value.num[1] = this.particleVelocityMax;
                    },
                    set (value) {
                        this.particleVelocityMin = value.num[0];
                        this.particleVelocityMax = value.num[1];
                    }
                },
                {
                    name: 'Life',
                    description: 'min/max value of particle life in seconds',
                    type: 'vec2',
                    default: [
                        1,
                        1.5
                    ],
                    options: {
                        animatable: true
                    },
                    get (value) {
                        value.num[0] = this.particleLifeMin;
                        value.num[1] = this.particleLifeMax;
                    },
                    set (value) {
                        this.particleLifeMin = value.num[0];
                        this.particleLifeMax = value.num[1];
                    }
                },
                {
                    name: 'Size1',
                    description: 'min/max value of initial size of particles',
                    type: 'vec2',
                    default: [
                        0.4,
                        0.5
                    ],
                    options: {
                        animatable: true
                    },
                    get (value) {
                        value.num[0] = this.particleSize1Min;
                        value.num[1] = this.particleSize1Max;
                    },
                    set (value) {
                        this.particleSize1Min = value.num[0];
                        this.particleSize1Max = value.num[1];
                    }
                },
                {
                    name: 'Size2',
                    description: 'min/max value of end size of particles',
                    type: 'vec2',
                    default: [
                        0,
                        0.1
                    ],
                    options: {
                        animatable: true
                    },
                    get (value) {
                        value.num[0] = this.particleSize2Min;
                        value.num[1] = this.particleSize2Max;
                    },
                    set (value) {
                        this.particleSize2Min = value.num[0];
                        this.particleSize2Max = value.num[1];
                    }
                },
                {
                    name: 'Acceleration',
                    description: 'min/max value of particle speed acceleration',
                    type: 'vec2',
                    default: [
                        -0.01,
                        -0.02
                    ],
                    options: {
                        animatable: true
                    },
                    get (value) {
                        value.num[0] = this.particleAccelMin;
                        value.num[1] = this.particleAccelMax;
                    },
                    set (value) {
                        this.particleAccelMin = value.num[0];
                        this.particleAccelMax = value.num[1];
                    }
                },
                {
                    name: 'Material',
                    description: 'Material object',
                    type: 'object',
                    default: null,
                    options: {
                        objectTypes: [
                            ParticleMaterial
                        ]
                    },
                    get (value) {
                        value.object[0] = this.getMaterial();
                    },
                    set (value) {
                        if (!value.object[0]) {
                            this.material = null;
                        } else if (value.object[0] instanceof ParticleMaterial) {
                            this.material = value.object[0];
                        } else {
                            console.error('Invalid material type');
                        }
                    }
                }
            ]);
        }
    };
}

export { getParticleNodeClass };
//# sourceMappingURL=particle.js.map
