-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Particle System emission shapes gizmo #86902
base: master
Are you sure you want to change the base?
Conversation
94e1901
to
4363ca4
Compare
c9a3e02
to
e659548
Compare
e659548
to
cb39d7a
Compare
715a117
to
970796b
Compare
7cbb484
to
abffa04
Compare
5615a63
to
b5d6302
Compare
cb575de
to
e3daec7
Compare
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
d2bc5e0
to
0afe343
Compare
Thanks a lot for the style feedback @AThousandShips! |
0afe343
to
1afc432
Compare
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.cpp
Outdated
Show resolved
Hide resolved
@paddy-exe The 4.4 merge window is open, now would be a good time to finalize this PR. |
c19cb27
to
c71e2c4
Compare
c8ca5dc
to
2f1391c
Compare
Co-authored-by: Kasper Frandsen <kasper.arnklit@gmail.com>
2f1391c
to
46b896d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description is very good, if there was any doubt.
46b896d
to
5749512
Compare
5749512
to
a6d6e33
Compare
You need to rebase the branch on latest |
|
||
#include "particles_3d_emission_shape_gizmo_plugin.h" | ||
|
||
#include "core/math/transform_3d.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include "core/math/transform_3d.h" |
Unnecessary
Vector3 s[2] = { gi.xform(ray_from), gi.xform(ray_from + ray_dir * 4096) }; | ||
|
||
Vector3 ra, rb; | ||
float d; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float d; | |
float d = 0.0f; |
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap()); | ||
} | ||
d = MAX(d, 0.001); | ||
// Times 2 because of using the half_height for drawing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Times 2 because of using the half_height for drawing | |
// Times 2 because of using the half_height for drawing. |
if (Object::cast_to<GPUParticles3D>(p_gizmo->get_node_3d())) { | ||
GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_gizmo->get_node_3d()); | ||
|
||
if (particles->get_process_material() != nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (particles->get_process_material() != nullptr) { | |
if (particles->get_process_material().is_valid()) { |
for (int i = 0; i < 12; i++) { | ||
Vector3 a, b; | ||
box_aabb.get_edge(i, a, b); | ||
// Multiplication by 2 due to the extents being only half of the box size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Multiplication by 2 due to the extents being only half of the box size | |
// Multiplication by 2 due to the extents being only half of the box size. |
// inner top ring cap | ||
points.push_back(basis.xform(Vector3(inner_a.x, half_ring_height, inner_a.y))); | ||
points.push_back(basis.xform(Vector3(inner_b.x, half_ring_height, inner_b.y))); | ||
// inner bottom ring cap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// inner bottom ring cap | |
// Inner bottom ring cap. |
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * ring_radius; | ||
Point2 inner_a = Vector2(Math::sin(ra), Math::cos(ra)) * ring_inner_radius; | ||
|
||
// outer 90 degrees vertical lines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// outer 90 degrees vertical lines | |
// Outer 90 degrees vertical lines. |
points.push_back(basis.xform(Vector3(a.x, half_ring_height, a.y))); | ||
points.push_back(basis.xform(Vector3(a.x, -half_ring_height, a.y))); | ||
|
||
// inner 90 degrees vertical lines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// inner 90 degrees vertical lines | |
// Inner 90 degrees vertical lines. |
Vector3 s_scale = mat->get_emission_shape_scale(); | ||
|
||
Vector3 ra, rb; | ||
float d; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float d; | |
float d = 0.0f; |
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap()); | ||
} | ||
d = MAX(d, 0.001); | ||
// Times 2 because of using the half_height for drawing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Times 2 because of using the half_height for drawing | |
// Times 2 because of using the half_height for drawing. |
This Pull Request visualises the emission shapes from the GPU and CPU Particle Systems.
Closes godotengine/godot-proposals#7826
Showcase
Features
CPUParticles
Node or theParticleProcessMaterial
resource of aGPUParticles
Node properties are changed in any way so the changes can be synced and redrawn by the gizmo pluginTODO
Massive thanks to @Arnklit for helping me with this Pull Request.