Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/scene/3d/particles_3d_editor_plugin.h
9905 views
1
/**************************************************************************/
2
/* particles_3d_editor_plugin.h */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
/**************************************************************************/
30
31
#pragma once
32
33
#include "editor/scene/particles_editor_plugin.h"
34
35
class Particles3DEditorPlugin : public ParticlesEditorPlugin {
36
GDCLASS(Particles3DEditorPlugin, ParticlesEditorPlugin);
37
38
enum {
39
MENU_OPTION_GENERATE_AABB = 300,
40
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE,
41
};
42
43
ConfirmationDialog *generate_aabb = nullptr;
44
SpinBox *generate_seconds = nullptr;
45
46
SceneTreeDialog *emission_tree_dialog = nullptr;
47
ConfirmationDialog *emission_dialog = nullptr;
48
SpinBox *emission_amount = nullptr;
49
OptionButton *emission_fill = nullptr;
50
51
void _generate_aabb();
52
void _node_selected(const NodePath &p_path);
53
54
protected:
55
Vector<Face3> geometry;
56
57
virtual void _menu_callback(int p_idx) override;
58
virtual void _add_menu_options(PopupMenu *p_menu) override;
59
60
bool _generate(Vector<Vector3> &r_points, Vector<Vector3> &r_normals);
61
virtual bool _can_generate_points() const = 0;
62
virtual void _generate_emission_points() = 0;
63
64
public:
65
Particles3DEditorPlugin();
66
};
67
68
class GPUParticles3DEditorPlugin : public Particles3DEditorPlugin {
69
GDCLASS(GPUParticles3DEditorPlugin, Particles3DEditorPlugin);
70
71
protected:
72
Node *_convert_particles() override;
73
74
bool _can_generate_points() const override;
75
void _generate_emission_points() override;
76
77
public:
78
GPUParticles3DEditorPlugin();
79
};
80
81
class CPUParticles3DEditorPlugin : public Particles3DEditorPlugin {
82
GDCLASS(CPUParticles3DEditorPlugin, Particles3DEditorPlugin);
83
84
protected:
85
Node *_convert_particles() override;
86
87
bool _can_generate_points() const override { return true; }
88
void _generate_emission_points() override;
89
90
public:
91
CPUParticles3DEditorPlugin();
92
};
93
94