This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/draw/modes/shaders/particle_strand_vert.glsl
Sergey Sharybin 5cea8bf435 Draw manager: Initial implementation of key points visualization
Does all points all the time, ignoring the setting in viewport header.
This is to be addressed by the next commit.
2018-05-09 14:59:48 +02:00

35 lines
649 B
GLSL

uniform mat4 ModelViewProjectionMatrix;
uniform mat3 NormalMatrix;
uniform mat4 ModelViewMatrix;
in vec3 pos;
in vec3 nor;
in int ind;
out vec3 tangent;
out vec3 viewPosition;
flat out float colRand;
float rand(int s)
{
int seed = s * 1023423;
seed = (seed ^ 61) ^ (seed >> 16);
seed *= 9;
seed = seed ^ (seed >> 4);
seed *= 0x27d4eb2d;
seed = seed ^ (seed >> 15);
float value = float(seed);
value *= 1.0 / 42596.0;
return fract(value);
}
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
tangent = normalize(NormalMatrix * nor);
viewPosition = (ModelViewMatrix * vec4(pos, 1.0)).xyz;
colRand = rand(ind);
}