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

workbench_volume_vert.glsl « shaders « workbench « engines « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7ce21c3d5ca7af71068afee2984ff6b106f7b9ba (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

uniform mat4 ModelViewProjectionMatrix;
uniform vec3 OrcoTexCoFactors[2];
uniform float slicePosition;
uniform int sliceAxis; /* -1 is no slice, 0 is X, 1 is Y, 2 is Z. */

in vec3 pos;

#ifdef VOLUME_SLICE
in vec3 uvs;

out vec3 localPos;
#endif

void main()
{
#ifdef VOLUME_SLICE
	if (sliceAxis == 0) {
		localPos = vec3(slicePosition * 2.0 - 1.0, pos.xy);
	}
	else if (sliceAxis == 1) {
		localPos = vec3(pos.x, slicePosition * 2.0 - 1.0, pos.y);
	}
	else {
		localPos = vec3(pos.xy, slicePosition * 2.0 - 1.0);
	}
	vec3 final_pos = localPos;
#else
	vec3 final_pos = pos;
#endif
	final_pos = ((final_pos * 0.5 + 0.5) - OrcoTexCoFactors[0]) / OrcoTexCoFactors[1];
	gl_Position = ModelViewProjectionMatrix * vec4(final_pos, 1.0);
}