File: decal-v.sdr

package info (click to toggle)
freespace2 25.0.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 47,232 kB
  • sloc: cpp: 657,500; ansic: 22,305; sh: 293; python: 200; makefile: 198; xml: 181
file content (42 lines) | stat: -rw-r--r-- 953 bytes parent folder | download
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
35
36
37
38
39
40
41
42

in vec4 vertPosition;
in mat4 vertModelMatrix;

flat out mat4 invModelMatrix;
flat out vec3 decalDirection;
flat out float normal_angle_cutoff;
flat out float angle_fade_start;
flat out float alpha_scale;

layout (std140) uniform decalGlobalData {
	mat4 viewMatrix;
	mat4 projMatrix;
	mat4 invViewMatrix;
	mat4 invProjMatrix;

	vec2 viewportSize;
};

layout (std140) uniform decalInfoData {
	int diffuse_index;
	int glow_index;
	int normal_index;
	int diffuse_blend_mode;

	int glow_blend_mode;
};

void main() {
    normal_angle_cutoff = vertModelMatrix[0][3];
    angle_fade_start = vertModelMatrix[1][3];
    alpha_scale = vertModelMatrix[2][3];

    mat4 modelMatrix = vertModelMatrix;
    modelMatrix[0][3] = 0.0;
    modelMatrix[1][3] = 0.0;
    modelMatrix[2][3] = 0.0;

    invModelMatrix = inverse(modelMatrix);
    decalDirection = mat3(viewMatrix) * modelMatrix[2].xyz;
	gl_Position = projMatrix * viewMatrix * modelMatrix * vertPosition;
}