Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/render/particles.cpp')
-rw-r--r--intern/cycles/render/particles.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/intern/cycles/render/particles.cpp b/intern/cycles/render/particles.cpp
index 3ee620c9d01..e4be3306d7e 100644
--- a/intern/cycles/render/particles.cpp
+++ b/intern/cycles/render/particles.cpp
@@ -62,14 +62,10 @@ void ParticleSystemManager::device_update_particles(Device *, DeviceScene *dscen
for(size_t j = 0; j < scene->particle_systems.size(); j++)
num_particles += scene->particle_systems[j]->particles.size();
- float4 *particles = dscene->particles.alloc(PARTICLE_SIZE*num_particles);
+ KernelParticle *kparticles = dscene->particles.alloc(num_particles);
/* dummy particle */
- particles[0] = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
- particles[1] = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
- particles[2] = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
- particles[3] = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
- particles[4] = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ memset(kparticles, 0, sizeof(KernelParticle));
int i = 1;
for(size_t j = 0; j < scene->particle_systems.size(); j++) {
@@ -78,13 +74,15 @@ void ParticleSystemManager::device_update_particles(Device *, DeviceScene *dscen
for(size_t k = 0; k < psys->particles.size(); k++) {
/* pack in texture */
Particle& pa = psys->particles[k];
- int offset = i*PARTICLE_SIZE;
- particles[offset] = make_float4(__uint_as_float(pa.index), pa.age, pa.lifetime, pa.size);
- particles[offset+1] = pa.rotation;
- particles[offset+2] = make_float4(pa.location.x, pa.location.y, pa.location.z, pa.velocity.x);
- particles[offset+3] = make_float4(pa.velocity.y, pa.velocity.z, pa.angular_velocity.x, pa.angular_velocity.y);
- particles[offset+4] = make_float4(pa.angular_velocity.z, 0.0f, 0.0f, 0.0f);
+ kparticles[i].index = pa.index;
+ kparticles[i].age = pa.age;
+ kparticles[i].lifetime = pa.lifetime;
+ kparticles[i].size = pa.size;
+ kparticles[i].rotation = pa.rotation;
+ kparticles[i].location = float3_to_float4(pa.location);
+ kparticles[i].velocity = float3_to_float4(pa.velocity);
+ kparticles[i].angular_velocity = float3_to_float4(pa.angular_velocity);
i++;