summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2021-08-18 16:50:38 +0300
committerYuri Sizov <yuris@humnom.net>2021-08-18 17:53:46 +0300
commitb88a41a16114c02088720453511bf0376a7f7568 (patch)
treefabb7f9e494e4042c2594f46781c239fd048fcdb /scene
parent2a9c4a59dfd2d0f25e2789d8339f91f97f5dd2bb (diff)
Adjust the material key bit size for ParticlesMaterial
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/particles_material.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/resources/particles_material.h b/scene/resources/particles_material.h
index ac7a500f73..1e1821024e 100644
--- a/scene/resources/particles_material.h
+++ b/scene/resources/particles_material.h
@@ -61,6 +61,7 @@ public:
PARAM_MAX
};
+ // When extending, make sure not to overflow the size of the MaterialKey below.
enum ParticleFlags {
PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY,
PARTICLE_FLAG_ROTATE_Y,
@@ -68,6 +69,7 @@ public:
PARTICLE_FLAG_MAX
};
+ // When extending, make sure not to overflow the size of the MaterialKey below.
enum EmissionShape {
EMISSION_SHAPE_POINT,
EMISSION_SHAPE_SPHERE,
@@ -78,6 +80,7 @@ public:
EMISSION_SHAPE_MAX
};
+ // When extending, make sure not to overflow the size of the MaterialKey below.
enum SubEmitterMode {
SUB_EMITTER_DISABLED,
SUB_EMITTER_CONSTANT,
@@ -88,11 +91,13 @@ public:
private:
union MaterialKey {
+ // The bit size of the struct must be kept below or equal to 32 bits.
+ // Consider this when extending ParticleFlags, EmissionShape, or SubEmitterMode.
struct {
uint32_t texture_mask : 16;
uint32_t texture_color : 1;
uint32_t particle_flags : 4;
- uint32_t emission_shape : 2;
+ uint32_t emission_shape : 3;
uint32_t invalid_key : 1;
uint32_t has_emission_color : 1;
uint32_t sub_emitter : 2;