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 16:32:38 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-02-14 16:55:46 +0300
commitf6107af4cf4d907495e2e9c18e5866fd1d420650 (patch)
treeebac5a9d08145af572e5400c0697156797b73130 /source/blender/gpu
parentc8e661706fcdd88f1cf371f2e5e4eb76bf09fda3 (diff)
Cycles: change Index output of Hair and Particle Info to Random, in 0..1 range.
These are used for randomization, so it's convenient if the index is already hashed and consistent with the Object Info node.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_draw.c4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl4
2 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 427e179f29a..d7e744951c4 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -41,11 +41,11 @@
#include "GPU_glew.h"
#include "BLI_blenlib.h"
+#include "BLI_hash.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
-#include "BLI_hash.h"
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
@@ -1884,7 +1884,7 @@ static int gpu_get_particle_info(GPUParticleInfo *pi)
if (ind >= 0) {
ParticleData *p = &dob->particle_system->particles[ind];
- pi->scalprops[0] = ind;
+ pi->scalprops[0] = BLI_hash_int_01(ind);
pi->scalprops[1] = GMS.gscene->r.cfra - p->time;
pi->scalprops[2] = p->lifetime;
pi->scalprops[3] = p->size;
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index d589c8765e6..5fe14e76a90 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -190,10 +190,10 @@ void geom(
void particle_info(
vec4 sprops, vec3 loc, vec3 vel, vec3 avel,
- out float index, out float age, out float life_time, out vec3 location,
+ out float random, out float age, out float life_time, out vec3 location,
out float size, out vec3 velocity, out vec3 angular_velocity)
{
- index = sprops.x;
+ random = sprops.x;
age = sprops.y;
life_time = sprops.z;
size = sprops.w;