mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Merge pull request #89046 from permelin/fix-particle-aabb-recalc-with-userdata
Fix error in AABB calculation for particles with USERDATA
This commit is contained in:
commit
3be5d9b01a
@ -395,7 +395,7 @@ AABB ParticlesStorage::particles_get_current_aabb(RID p_particles) {
|
||||
bool first = true;
|
||||
|
||||
const uint8_t *data_ptr = (const uint8_t *)buffer.ptr();
|
||||
uint32_t particle_data_size = sizeof(ParticleInstanceData3D) + sizeof(float) * particles->userdata_count;
|
||||
uint32_t particle_data_size = sizeof(ParticleInstanceData3D);
|
||||
|
||||
for (int i = 0; i < total_amount; i++) {
|
||||
const ParticleInstanceData3D &particle_data = *(const ParticleInstanceData3D *)&data_ptr[particle_data_size * i];
|
||||
|
@ -620,8 +620,9 @@ AABB ParticlesStorage::particles_get_current_aabb(RID p_particles) {
|
||||
total_amount *= particles->trail_bind_poses.size();
|
||||
}
|
||||
|
||||
uint32_t particle_data_size = sizeof(ParticleData) + sizeof(float) * 4 * particles->userdata_count;
|
||||
Vector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(particles->particle_buffer);
|
||||
ERR_FAIL_COND_V(buffer.size() != (int)(total_amount * sizeof(ParticleData)), AABB());
|
||||
ERR_FAIL_COND_V(buffer.size() != (int)(total_amount * particle_data_size), AABB());
|
||||
|
||||
Transform3D inv = particles->emission_transform.affine_inverse();
|
||||
|
||||
@ -630,7 +631,6 @@ AABB ParticlesStorage::particles_get_current_aabb(RID p_particles) {
|
||||
bool first = true;
|
||||
|
||||
const uint8_t *data_ptr = (const uint8_t *)buffer.ptr();
|
||||
uint32_t particle_data_size = sizeof(ParticleData) + sizeof(float) * particles->userdata_count;
|
||||
|
||||
for (int i = 0; i < total_amount; i++) {
|
||||
const ParticleData &particle_data = *(const ParticleData *)&data_ptr[particle_data_size * i];
|
||||
|
Loading…
Reference in New Issue
Block a user