diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-08-31 23:38:59 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-08-31 23:38:59 +0400 |
commit | 9e3fa15d4b3e22127471a7451a49b594cf6275a0 (patch) | |
tree | 5891c5922401980fbb0843a60abd45278278f0c5 /intern/cycles/render/particles.cpp | |
parent | f0d247748408bd10f49c54d3a28a925e37683c4b (diff) |
Added a bunch of additional particle state attributes to the Cycles particle info node:
* Location: Basically the same as the location from Object Info node for object instances on particles, but in principle there could be additional offsets for dupli objects, so included for completeness.
* Size: Single float scale of the particle. Also directly translates to object scale for current dupli objects, but handy to have as a single float to start with instead of a scale vector (currently not even exposed in Object Info).
* Rotation: This is a quaternion, which are not yet supported by Cycles nodes. The float4 is copied to internal Cycles data and stored in the particles texture data, but the node doesn't have a socket for it yet and the data is not yet written to the stack. Code is just commented out so could be enabled quickly if/when rotation support is added to cycles.
* Velocity: Linear velocity vector of particles.
* Angular Velocity: Angular velocity around principle axes.
The texture data is currently packed tightly into the particles texture, which saves a few bytes, but requires an additional texture lookup for some vector attributes which spread over two float4s. Could also add another float4 to particle size to avoid this.
Diffstat (limited to 'intern/cycles/render/particles.cpp')
-rw-r--r-- | intern/cycles/render/particles.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/intern/cycles/render/particles.cpp b/intern/cycles/render/particles.cpp index 539a2333506..c3e4b9510de 100644 --- a/intern/cycles/render/particles.cpp +++ b/intern/cycles/render/particles.cpp @@ -74,7 +74,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++; |