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: 90a22d9d02fe224c0751113ab609c69393090531 (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

uniform mat4 ModelViewProjectionMatrix;
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);
	}

	gl_Position = ModelViewProjectionMatrix * vec4(localPos, 1.0);
#else
	gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
#endif
}