diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-25 00:01:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-25 00:01:47 +0200 |
commit | 56752e32a6144c906cb8c0ffe689b11c4295938f (patch) | |
tree | ea78185e2dbb1451644e4b28cae5b7ede821d9b9 /scene/resources/particles_material.h | |
parent | d0a2a4c98195eb8a43713286b5b865dfbed05163 (diff) | |
parent | 17ad6df56d6c60b8fb7cff772d47a12e1d0e0599 (diff) |
Merge pull request #61238 from Calinou/particlesmaterial-add-fade-on-contact-collision-mode
Add "Hide on Contact" collision mode to ParticlesMaterial
Diffstat (limited to 'scene/resources/particles_material.h')
-rw-r--r-- | scene/resources/particles_material.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/scene/resources/particles_material.h b/scene/resources/particles_material.h index 116d8b7d06..2e94e7e01a 100644 --- a/scene/resources/particles_material.h +++ b/scene/resources/particles_material.h @@ -93,6 +93,14 @@ public: SUB_EMITTER_MAX }; + // When extending, make sure not to overflow the size of the MaterialKey below. + enum CollisionMode { + COLLISION_DISABLED, + COLLISION_RIGID, + COLLISION_HIDE_ON_CONTACT, + COLLISION_MAX + }; + private: union MaterialKey { // The bit size of the struct must be kept below or equal to 32 bits. @@ -106,7 +114,7 @@ private: uint32_t has_emission_color : 1; uint32_t sub_emitter : 2; uint32_t attractor_enabled : 1; - uint32_t collision_enabled : 1; + uint32_t collision_mode : 2; uint32_t collision_scale : 1; uint32_t turbulence_enabled : 1; }; @@ -153,7 +161,7 @@ private: mk.emission_shape = emission_shape; mk.has_emission_color = emission_shape >= EMISSION_SHAPE_POINTS && emission_color_texture.is_valid(); mk.sub_emitter = sub_emitter_mode; - mk.collision_enabled = collision_enabled; + mk.collision_mode = collision_mode; mk.attractor_enabled = attractor_interaction_enabled; mk.collision_scale = collision_scale; mk.turbulence_enabled = turbulence_enabled; @@ -300,7 +308,7 @@ private: //do not save emission points here bool attractor_interaction_enabled = false; - bool collision_enabled = false; + CollisionMode collision_mode; bool collision_scale = false; float collision_friction = 0.0f; float collision_bounce = 0.0f; @@ -385,8 +393,8 @@ public: void set_attractor_interaction_enabled(bool p_enable); bool is_attractor_interaction_enabled() const; - void set_collision_enabled(bool p_enabled); - bool is_collision_enabled() const; + void set_collision_mode(CollisionMode p_collision_mode); + CollisionMode get_collision_mode() const; void set_collision_use_scale(bool p_scale); bool is_collision_using_scale() const; @@ -425,5 +433,6 @@ VARIANT_ENUM_CAST(ParticlesMaterial::Parameter) VARIANT_ENUM_CAST(ParticlesMaterial::ParticleFlags) VARIANT_ENUM_CAST(ParticlesMaterial::EmissionShape) VARIANT_ENUM_CAST(ParticlesMaterial::SubEmitterMode) +VARIANT_ENUM_CAST(ParticlesMaterial::CollisionMode) #endif // PARTICLES_MATERIAL_H |