summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorCaptainProton42 <john.wigg@gmx.net>2021-09-25 17:35:56 +0200
committerCaptainProton42 <john.wigg@gmx.net>2021-09-26 00:30:37 +0200
commitdd70daafba90c8e3e08f391e9114f084fe6eaa71 (patch)
treeb4598fa4a62c224a523522a5716a6a6ac5eedbc4 /servers
parent46cc0af5c509f33b65cc57e45e777b2d2a0a303f (diff)
Fix GPUParticles3D generate AABB
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.cpp6
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.h1
2 files changed, 2 insertions, 5 deletions
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
index ec0d25376f..1f258cd1fe 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
@@ -4352,10 +4352,8 @@ AABB RendererStorageRD::particles_get_current_aabb(RID p_particles) {
total_amount *= particles->trail_bind_poses.size();
}
- Vector<ParticleData> data;
- data.resize(total_amount);
-
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());
Transform3D inv = particles->emission_transform.affine_inverse();
@@ -4363,7 +4361,7 @@ AABB RendererStorageRD::particles_get_current_aabb(RID p_particles) {
if (buffer.size()) {
bool first = true;
- const ParticleData *particle_data = (const ParticleData *)data.ptr();
+ const ParticleData *particle_data = reinterpret_cast<const ParticleData *>(buffer.ptr());
for (int i = 0; i < total_amount; i++) {
if (particle_data[i].active) {
Vector3 pos = Vector3(particle_data[i].xform[12], particle_data[i].xform[13], particle_data[i].xform[14]);
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.h b/servers/rendering/renderer_rd/renderer_storage_rd.h
index 02395a884f..4950b7d5e5 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.h
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.h
@@ -621,7 +621,6 @@ private:
float color[4];
float custom[3];
float lifetime;
- uint32_t pad[3];
};
struct ParticlesFrameParams {