Welcome to mirror list, hosted at ThFree Co, Russian Federation.

particle_strand_vert.glsl « shaders « modes « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d4c35d141822013f5786d6d390f9b73805307497 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

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);
}