1426cd3b3a
As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see". Backported from #70885.
135 lines
4.6 KiB
C++
135 lines
4.6 KiB
C++
/**************************************************************************/
|
|
/* particles_2d.h */
|
|
/**************************************************************************/
|
|
/* This file is part of: */
|
|
/* GODOT ENGINE */
|
|
/* https://godotengine.org */
|
|
/**************************************************************************/
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
/* */
|
|
/* 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. */
|
|
/**************************************************************************/
|
|
|
|
#ifndef PARTICLES_2D_H
|
|
#define PARTICLES_2D_H
|
|
|
|
#include "core/rid.h"
|
|
#include "scene/2d/node_2d.h"
|
|
#include "scene/resources/texture.h"
|
|
|
|
class Particles2D : public Node2D {
|
|
private:
|
|
GDCLASS(Particles2D, Node2D);
|
|
|
|
public:
|
|
enum DrawOrder {
|
|
DRAW_ORDER_INDEX,
|
|
DRAW_ORDER_LIFETIME,
|
|
};
|
|
|
|
private:
|
|
RID particles;
|
|
|
|
bool one_shot;
|
|
int amount;
|
|
float lifetime;
|
|
float pre_process_time;
|
|
float explosiveness_ratio;
|
|
float randomness_ratio;
|
|
float speed_scale;
|
|
Rect2 visibility_rect;
|
|
bool local_coords;
|
|
int fixed_fps;
|
|
bool fractional_delta;
|
|
|
|
#ifdef TOOLS_ENABLED
|
|
bool show_visibility_rect;
|
|
#endif
|
|
|
|
Ref<Material> process_material;
|
|
|
|
DrawOrder draw_order;
|
|
|
|
Ref<Texture> texture;
|
|
Ref<Texture> normal_map;
|
|
|
|
void _update_particle_emission_transform();
|
|
|
|
protected:
|
|
static void _bind_methods();
|
|
virtual void _validate_property(PropertyInfo &property) const;
|
|
void _notification(int p_what);
|
|
|
|
public:
|
|
void set_emitting(bool p_emitting);
|
|
void set_amount(int p_amount);
|
|
void set_lifetime(float p_lifetime);
|
|
void set_one_shot(bool p_enable);
|
|
void set_pre_process_time(float p_time);
|
|
void set_explosiveness_ratio(float p_ratio);
|
|
void set_randomness_ratio(float p_ratio);
|
|
void set_visibility_rect(const Rect2 &p_visibility_rect);
|
|
void set_use_local_coordinates(bool p_enable);
|
|
void set_process_material(const Ref<Material> &p_material);
|
|
void set_speed_scale(float p_scale);
|
|
|
|
#ifdef TOOLS_ENABLED
|
|
void set_show_visibility_rect(bool p_show_visibility_rect);
|
|
#endif
|
|
|
|
bool is_emitting() const;
|
|
int get_amount() const;
|
|
float get_lifetime() const;
|
|
bool get_one_shot() const;
|
|
float get_pre_process_time() const;
|
|
float get_explosiveness_ratio() const;
|
|
float get_randomness_ratio() const;
|
|
Rect2 get_visibility_rect() const;
|
|
bool get_use_local_coordinates() const;
|
|
Ref<Material> get_process_material() const;
|
|
float get_speed_scale() const;
|
|
|
|
void set_fixed_fps(int p_count);
|
|
int get_fixed_fps() const;
|
|
|
|
void set_fractional_delta(bool p_enable);
|
|
bool get_fractional_delta() const;
|
|
|
|
void set_draw_order(DrawOrder p_order);
|
|
DrawOrder get_draw_order() const;
|
|
|
|
void set_texture(const Ref<Texture> &p_texture);
|
|
Ref<Texture> get_texture() const;
|
|
|
|
void set_normal_map(const Ref<Texture> &p_normal_map);
|
|
Ref<Texture> get_normal_map() const;
|
|
|
|
virtual String get_configuration_warning() const;
|
|
|
|
void restart();
|
|
Rect2 capture_rect() const;
|
|
Particles2D();
|
|
~Particles2D();
|
|
};
|
|
|
|
VARIANT_ENUM_CAST(Particles2D::DrawOrder)
|
|
|
|
#endif // PARTICLES_2D_H
|