Cycles fix: don't skip particle device update when there are no particle systems...
[blender.git] / intern / cycles / render / particles.cpp
index 539a233350646d1f3e69e7a6ee11fa62fc2a72b8..9f951d9673f9d24fbe7c165377c01d8cefdbabf4 100644 (file)
@@ -67,6 +67,10 @@ void ParticleSystemManager::device_update_particles(Device *device, DeviceScene
        
        /* 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);
        
        int i = 1;
        foreach(ParticleSystem *psys, scene->particle_systems) {
@@ -74,7 +78,11 @@ void ParticleSystemManager::device_update_particles(Device *device, DeviceScene
                        /* pack in texture */
                        int offset = i*PARTICLE_SIZE;
                        
-                       particles[offset] = make_float4(pa.index, pa.age, pa.lifetime, 0.0f);
+                       particles[offset] = make_float4(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);
                        
                        i++;
                        
@@ -92,9 +100,6 @@ void ParticleSystemManager::device_update(Device *device, DeviceScene *dscene, S
        
        device_free(device, dscene);
 
-       if(scene->particle_systems.size() == 0)
-               return;
-
        progress.set_status("Updating Particle Systems", "Copying Particles to device");
        device_update_particles(device, dscene, scene, progress);