2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* particles.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 12:16:55 +00:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
2022-01-13 08:45:09 +00:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2014-02-10 01:10:30 +00:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2018-09-04 09:30:04 +00:00
|
|
|
#ifndef PARTICLES_H
|
|
|
|
#define PARTICLES_H
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-09-11 16:13:45 +00:00
|
|
|
#include "core/rid.h"
|
2014-02-10 01:10:30 +00:00
|
|
|
#include "scene/3d/visual_instance.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "scene/resources/material.h"
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
class Particles : public GeometryInstance {
|
2017-04-07 02:36:37 +00:00
|
|
|
private:
|
|
|
|
GDCLASS(Particles, GeometryInstance);
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
public:
|
2017-04-07 02:36:37 +00:00
|
|
|
enum DrawOrder {
|
|
|
|
DRAW_ORDER_INDEX,
|
|
|
|
DRAW_ORDER_LIFETIME,
|
|
|
|
DRAW_ORDER_VIEW_DEPTH,
|
|
|
|
};
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
enum {
|
|
|
|
MAX_DRAW_PASSES = 4
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
RID particles;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-06-25 11:01:15 +00:00
|
|
|
bool one_shot;
|
2017-04-07 02:36:37 +00:00
|
|
|
int amount;
|
|
|
|
float lifetime;
|
|
|
|
float pre_process_time;
|
|
|
|
float explosiveness_ratio;
|
|
|
|
float randomness_ratio;
|
2017-04-09 01:38:11 +00:00
|
|
|
float speed_scale;
|
2017-11-17 02:09:00 +00:00
|
|
|
AABB visibility_aabb;
|
2017-04-07 02:36:37 +00:00
|
|
|
bool local_coords;
|
|
|
|
int fixed_fps;
|
|
|
|
bool fractional_delta;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
Ref<Material> process_material;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
DrawOrder draw_order;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-05-04 12:20:36 +00:00
|
|
|
Vector<Ref<Mesh>> draw_passes;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2016-03-08 23:00:52 +00:00
|
|
|
protected:
|
2014-02-10 01:10:30 +00:00
|
|
|
static void _bind_methods();
|
2017-08-07 22:01:30 +00:00
|
|
|
void _notification(int p_what);
|
2017-04-07 02:36:37 +00:00
|
|
|
virtual void _validate_property(PropertyInfo &property) const;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
public:
|
2017-11-17 02:09:00 +00:00
|
|
|
AABB get_aabb() const;
|
2017-01-07 21:25:37 +00:00
|
|
|
PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
void set_emitting(bool p_emitting);
|
2014-02-10 01:10:30 +00:00
|
|
|
void set_amount(int p_amount);
|
2017-04-07 02:36:37 +00:00
|
|
|
void set_lifetime(float p_lifetime);
|
2017-08-11 19:10:05 +00:00
|
|
|
void set_one_shot(bool p_one_shot);
|
2017-04-07 02:36:37 +00:00
|
|
|
void set_pre_process_time(float p_time);
|
|
|
|
void set_explosiveness_ratio(float p_ratio);
|
|
|
|
void set_randomness_ratio(float p_ratio);
|
2017-11-17 02:09:00 +00:00
|
|
|
void set_visibility_aabb(const AABB &p_aabb);
|
2017-04-07 02:36:37 +00:00
|
|
|
void set_use_local_coordinates(bool p_enable);
|
|
|
|
void set_process_material(const Ref<Material> &p_material);
|
2017-04-09 01:38:11 +00:00
|
|
|
void set_speed_scale(float p_scale);
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
bool is_emitting() const;
|
2017-04-07 02:36:37 +00:00
|
|
|
int get_amount() const;
|
|
|
|
float get_lifetime() const;
|
2017-06-25 11:01:15 +00:00
|
|
|
bool get_one_shot() const;
|
2017-04-07 02:36:37 +00:00
|
|
|
float get_pre_process_time() const;
|
|
|
|
float get_explosiveness_ratio() const;
|
|
|
|
float get_randomness_ratio() const;
|
2017-11-17 02:09:00 +00:00
|
|
|
AABB get_visibility_aabb() const;
|
2017-04-07 02:36:37 +00:00
|
|
|
bool get_use_local_coordinates() const;
|
|
|
|
Ref<Material> get_process_material() const;
|
2017-04-09 01:38:11 +00:00
|
|
|
float get_speed_scale() const;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
void set_fixed_fps(int p_count);
|
|
|
|
int get_fixed_fps() const;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
void set_fractional_delta(bool p_enable);
|
|
|
|
bool get_fractional_delta() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
void set_draw_order(DrawOrder p_order);
|
|
|
|
DrawOrder get_draw_order() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
void set_draw_passes(int p_count);
|
|
|
|
int get_draw_passes() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
void set_draw_pass_mesh(int p_pass, const Ref<Mesh> &p_mesh);
|
|
|
|
Ref<Mesh> get_draw_pass_mesh(int p_pass) const;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-04-09 01:38:11 +00:00
|
|
|
virtual String get_configuration_warning() const;
|
|
|
|
|
2017-06-25 11:01:15 +00:00
|
|
|
void restart();
|
|
|
|
|
2017-11-17 02:09:00 +00:00
|
|
|
AABB capture_aabb() const;
|
2017-04-07 02:36:37 +00:00
|
|
|
Particles();
|
|
|
|
~Particles();
|
|
|
|
};
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
VARIANT_ENUM_CAST(Particles::DrawOrder)
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-09-04 09:30:04 +00:00
|
|
|
#endif // PARTICLES_H
|