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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-02-14 19:02:28 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-02-14 23:45:57 +0300
commitb5fe00d1ac43c16ec8f74d3ad7689599dfb2ef00 (patch)
treee2dcae056cde3c6eaa3bcaf2c1b9117a0a5e87a1 /intern/cycles/kernel/osl
parentf6107af4cf4d907495e2e9c18e5866fd1d420650 (diff)
Cycles: restore Particle Info Index for now, keep it next to Random.
It seems to be useful still in cases where the particle are distributed in a particular order or pattern, to colorize them along with that. This isn't really well defined, but might as well avoid breaking backwards compatibility for now.
Diffstat (limited to 'intern/cycles/kernel/osl')
-rw-r--r--intern/cycles/kernel/osl/osl_services.cpp9
-rw-r--r--intern/cycles/kernel/osl/osl_services.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
index c4128e84f5c..ae4c521659c 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -82,6 +82,7 @@ ustring OSLRenderServices::u_geom_dupli_generated("geom:dupli_generated");
ustring OSLRenderServices::u_geom_dupli_uv("geom:dupli_uv");
ustring OSLRenderServices::u_material_index("material:index");
ustring OSLRenderServices::u_object_random("object:random");
+ustring OSLRenderServices::u_particle_index("particle:index");
ustring OSLRenderServices::u_particle_random("particle:random");
ustring OSLRenderServices::u_particle_age("particle:age");
ustring OSLRenderServices::u_particle_lifetime("particle:lifetime");
@@ -652,11 +653,17 @@ bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderD
}
/* Particle Attributes */
+ else if(name == u_particle_index) {
+ int particle_id = object_particle_id(kg, sd->object);
+ float f = particle_index(kg, particle_id);
+ return set_attribute_float(f, type, derivatives, val);
+ }
else if(name == u_particle_random) {
int particle_id = object_particle_id(kg, sd->object);
- float f = particle_random(kg, particle_id);
+ float f = hash_int_01(particle_index(kg, particle_id));
return set_attribute_float(f, type, derivatives, val);
}
+
else if(name == u_particle_age) {
int particle_id = object_particle_id(kg, sd->object);
float f = particle_age(kg, particle_id);
diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h
index 2f2dc124a98..d96048e26f2 100644
--- a/intern/cycles/kernel/osl/osl_services.h
+++ b/intern/cycles/kernel/osl/osl_services.h
@@ -146,6 +146,7 @@ public:
static ustring u_geom_dupli_uv;
static ustring u_material_index;
static ustring u_object_random;
+ static ustring u_particle_index;
static ustring u_particle_random;
static ustring u_particle_age;
static ustring u_particle_lifetime;