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.cpp48
1 files changed, 23 insertions, 25 deletions
diff --git a/intern/cycles/render/particles.cpp b/intern/cycles/render/particles.cpp
index 1a35d60fb4b..e4be3306d7e 100644
--- a/intern/cycles/render/particles.cpp
+++ b/intern/cycles/render/particles.cpp
@@ -14,15 +14,16 @@
* limitations under the License.
*/
-#include "device.h"
-#include "particles.h"
-#include "scene.h"
+#include "device/device.h"
+#include "render/particles.h"
+#include "render/scene.h"
-#include "util_foreach.h"
-#include "util_logging.h"
-#include "util_map.h"
-#include "util_progress.h"
-#include "util_vector.h"
+#include "util/util_foreach.h"
+#include "util/util_hash.h"
+#include "util/util_logging.h"
+#include "util/util_map.h"
+#include "util/util_progress.h"
+#include "util/util_vector.h"
CCL_NAMESPACE_BEGIN
@@ -52,7 +53,7 @@ ParticleSystemManager::~ParticleSystemManager()
{
}
-void ParticleSystemManager::device_update_particles(Device *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,
@@ -61,14 +62,10 @@ void ParticleSystemManager::device_update_particles(Device *device, DeviceScene
for(size_t j = 0; j < scene->particle_systems.size(); j++)
num_particles += scene->particle_systems[j]->particles.size();
- float4 *particles = dscene->particles.resize(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++) {
@@ -77,13 +74,15 @@ void ParticleSystemManager::device_update_particles(Device *device, DeviceScene
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(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++;
@@ -91,7 +90,7 @@ void ParticleSystemManager::device_update_particles(Device *device, DeviceScene
}
}
- device->tex_alloc("__particles", dscene->particles);
+ dscene->particles.copy_to_device();
}
void ParticleSystemManager::device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
@@ -112,10 +111,9 @@ void ParticleSystemManager::device_update(Device *device, DeviceScene *dscene, S
need_update = false;
}
-void ParticleSystemManager::device_free(Device *device, DeviceScene *dscene)
+void ParticleSystemManager::device_free(Device *, DeviceScene *dscene)
{
- device->tex_free(dscene->particles);
- dscene->particles.clear();
+ dscene->particles.free();
}
void ParticleSystemManager::tag_update(Scene * /*scene*/)