diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /intern/cycles/render/particles.cpp | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'intern/cycles/render/particles.cpp')
-rw-r--r-- | intern/cycles/render/particles.cpp | 109 |
1 files changed, 58 insertions, 51 deletions
diff --git a/intern/cycles/render/particles.cpp b/intern/cycles/render/particles.cpp index 0583556c8a9..8335404b197 100644 --- a/intern/cycles/render/particles.cpp +++ b/intern/cycles/render/particles.cpp @@ -39,86 +39,93 @@ ParticleSystem::~ParticleSystem() void ParticleSystem::tag_update(Scene *scene) { - scene->particle_system_manager->need_update = true; + scene->particle_system_manager->need_update = true; } /* Particle System Manager */ ParticleSystemManager::ParticleSystemManager() { - need_update = true; + need_update = true; } ParticleSystemManager::~ParticleSystemManager() { } -void ParticleSystemManager::device_update_particles(Device *, DeviceScene *dscene, Scene *scene, Progress& progress) +void ParticleSystemManager::device_update_particles(Device *, + DeviceScene *dscene, + Scene *scene, + Progress &progress) { - /* count particles. - * adds one dummy particle at the beginning to avoid invalid lookups, - * in case a shader uses particle info without actual particle data. */ - int num_particles = 1; - for(size_t j = 0; j < scene->particle_systems.size(); j++) - num_particles += scene->particle_systems[j]->particles.size(); - - KernelParticle *kparticles = dscene->particles.alloc(num_particles); - - /* dummy particle */ - memset(kparticles, 0, sizeof(KernelParticle)); - - int i = 1; - for(size_t j = 0; j < scene->particle_systems.size(); j++) { - ParticleSystem *psys = scene->particle_systems[j]; - - for(size_t k = 0; k < psys->particles.size(); k++) { - /* pack in texture */ - Particle& pa = psys->particles[k]; - - 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++; - - if(progress.get_cancel()) return; - } - } - - dscene->particles.copy_to_device(); + /* count particles. + * adds one dummy particle at the beginning to avoid invalid lookups, + * in case a shader uses particle info without actual particle data. */ + int num_particles = 1; + for (size_t j = 0; j < scene->particle_systems.size(); j++) + num_particles += scene->particle_systems[j]->particles.size(); + + KernelParticle *kparticles = dscene->particles.alloc(num_particles); + + /* dummy particle */ + memset(kparticles, 0, sizeof(KernelParticle)); + + int i = 1; + for (size_t j = 0; j < scene->particle_systems.size(); j++) { + ParticleSystem *psys = scene->particle_systems[j]; + + for (size_t k = 0; k < psys->particles.size(); k++) { + /* pack in texture */ + Particle &pa = psys->particles[k]; + + 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++; + + if (progress.get_cancel()) + return; + } + } + + dscene->particles.copy_to_device(); } -void ParticleSystemManager::device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress) +void ParticleSystemManager::device_update(Device *device, + DeviceScene *dscene, + Scene *scene, + Progress &progress) { - if(!need_update) - return; + if (!need_update) + return; - VLOG(1) << "Total " << scene->particle_systems.size() - << " particle systems."; + VLOG(1) << "Total " << scene->particle_systems.size() << " particle systems."; - device_free(device, dscene); + device_free(device, dscene); - progress.set_status("Updating Particle Systems", "Copying Particles to device"); - device_update_particles(device, dscene, scene, progress); + progress.set_status("Updating Particle Systems", "Copying Particles to device"); + device_update_particles(device, dscene, scene, progress); - if(progress.get_cancel()) return; + if (progress.get_cancel()) + return; - need_update = false; + need_update = false; } void ParticleSystemManager::device_free(Device *, DeviceScene *dscene) { - dscene->particles.free(); + dscene->particles.free(); } void ParticleSystemManager::tag_update(Scene * /*scene*/) { - need_update = true; + need_update = true; } CCL_NAMESPACE_END |