Debian Codegraph @

src/scene/glsl/generated-pascal/main_shading_gouraud.vs.inc

raw
1 { -*- buffer-read-only: t -*- }
2 { DON'T EDIT -- this file was automatically generated from "source/main_shading_gouraud.vs" }
3 '/* Gouraud shading GLSL vertex shader. */' + LineEnding +
4 '' + LineEnding +
5 '/* Plug into PLUG-DECLARATIONS-EARLY things that need to be defined' + LineEnding +
6 ' before uniforms below, like definition of CASTLE_HAS_NORMALS.' + LineEnding +
7 ' TODO: Can we unify this with PLUG-DECLARATIONS? */' + LineEnding +
8 '/* PLUG-DECLARATIONS-EARLY */' + LineEnding +
9 '' + LineEnding +
10 'uniform mat4 castle_ModelViewMatrix;' + LineEnding +
11 'uniform mat4 castle_ProjectionMatrix;' + LineEnding +
12 'attribute vec4 castle_Vertex;' + LineEnding +
13 '' + LineEnding +
14 '#if defined(CASTLE_HAS_NORMALS)' + LineEnding +
15 'uniform mat3 castle_NormalMatrix;' + LineEnding +
16 'attribute vec3 castle_Normal;' + LineEnding +
17 '#endif' + LineEnding +
18 '' + LineEnding +
19 '/* PLUG-DECLARATIONS */' + LineEnding +
20 '' + LineEnding +
21 'varying vec4 castle_vertex_eye;' + LineEnding +
22 'varying vec3 castle_normal_eye;' + LineEnding +
23 'varying vec4 castle_Color;' + LineEnding +
24 '' + LineEnding +
25 '#if defined(COLOR_PER_VERTEX_RGB)' + LineEnding +
26 'attribute vec3 castle_ColorPerVertex;' + LineEnding +
27 '#elif defined(COLOR_PER_VERTEX_RGB_ALPHA)' + LineEnding +
28 'attribute vec4 castle_ColorPerVertex;' + LineEnding +
29 '#endif' + LineEnding +
30 '' + LineEnding +
31 '/* Apply per-vertex color, over the base/diffuse/emissive color + alpha. */' + LineEnding +
32 'vec4 castle_apply_color_per_vertex(vec4 color)' + LineEnding +
33 '{' + LineEnding +
34 ' return' + LineEnding +
35 ' #if defined(COLOR_PER_VERTEX_REPLACE)' + LineEnding +
36 ' #if defined(COLOR_PER_VERTEX_RGB)' + LineEnding +
37 ' vec4(castle_ColorPerVertex, color.a);' + LineEnding +
38 ' #elif defined(COLOR_PER_VERTEX_RGB_ALPHA)' + LineEnding +
39 ' castle_ColorPerVertex;' + LineEnding +
40 ' #endif' + LineEnding +
41 ' #elif defined(COLOR_PER_VERTEX_MODULATE)' + LineEnding +
42 ' #if defined(COLOR_PER_VERTEX_RGB)' + LineEnding +
43 ' vec4(castle_ColorPerVertex * color.rgb, color.a);' + LineEnding +
44 ' #elif defined(COLOR_PER_VERTEX_RGB_ALPHA)' + LineEnding +
45 ' castle_ColorPerVertex * color;' + LineEnding +
46 ' #endif' + LineEnding +
47 ' #else' + LineEnding +
48 ' color;' + LineEnding +
49 ' #endif' + LineEnding +
50 '}' + LineEnding +
51 '' + LineEnding +
52 '/* Include fragment shader utilities used by both Gouraud and Phong shading. */' + LineEnding +
53 '/* CASTLE-COMMON-CODE */' + LineEnding +
54 '' + LineEnding +
55 '/* CASTLE-LIGHTING-MODEL */' + LineEnding +
56 '' + LineEnding +
57 'void main(void)' + LineEnding +
58 '{' + LineEnding +
59 ' vec4 vertex_object = castle_Vertex;' + LineEnding +
60 ' vec3 normal_object =' + LineEnding +
61 ' #if defined(CASTLE_HAS_NORMALS)' + LineEnding +
62 ' castle_Normal;' + LineEnding +
63 ' #else' + LineEnding +
64 ' /* When CASTLE_HAS_NORMALS not defined, then TShader.NeedsNormals = false.' + LineEnding +
65 ' Renderer may then not define castle_Normal attribute at all,' + LineEnding +
66 ' so we cannot use it (using it causes invisible objects on ATI GPUs,' + LineEnding +
67 ' even though undefined normal_object value is not used by anything;' + LineEnding +
68 ' see' + LineEnding +
69 ' https://github.com/castle-engine/castle-engine/issues/462' + LineEnding +
70 ' https://trello.com/c/QH9d9A8o/92-bug-unable-to-see-and-use-gizmos )' + LineEnding +
71 ' */' + LineEnding +
72 ' vec3(0.0, 0.0, 1.0);' + LineEnding +
73 ' #endif' + LineEnding +
74 '' + LineEnding +
75 ' /* PLUG: vertex_object_space_change (vertex_object, normal_object) */' + LineEnding +
76 ' /* PLUG: vertex_object_space (vertex_object, normal_object) */' + LineEnding +
77 '' + LineEnding +
78 ' #ifdef CASTLE_BUGGY_GLSL_READ_VARYING' + LineEnding +
79 ' /* use local variables, instead of reading + writing to varying variables,' + LineEnding +
80 ' in this case */' + LineEnding +
81 ' vec4 temp_castle_vertex_eye;' + LineEnding +
82 ' vec3 temp_castle_normal_eye;' + LineEnding +
83 ' vec4 temp_castle_Color;' + LineEnding +
84 ' #define castle_vertex_eye temp_castle_vertex_eye' + LineEnding +
85 ' #define castle_normal_eye temp_castle_normal_eye' + LineEnding +
86 ' #define castle_Color temp_castle_Color' + LineEnding +
87 ' #endif' + LineEnding +
88 '' + LineEnding +
89 ' castle_vertex_eye = castle_ModelViewMatrix * vertex_object;' + LineEnding +
90 ' castle_normal_eye =' + LineEnding +
91 ' #if defined(CASTLE_HAS_NORMALS)' + LineEnding +
92 ' normalize(castle_NormalMatrix * normal_object);' + LineEnding +
93 ' #else' + LineEnding +
94 ' vec3(0.0, 0.0, 1.0);' + LineEnding +
95 ' #endif' + LineEnding +
96 '' + LineEnding +
97 ' /* PLUG: vertex_eye_space (castle_vertex_eye, castle_normal_eye) */' + LineEnding +
98 '' + LineEnding +
99 ' calculate_lighting(castle_Color, castle_vertex_eye, castle_normal_eye);' + LineEnding +
100 '' + LineEnding +
101 ' /* PLUG: lighting_apply (castle_Color, castle_vertex_eye, castle_normal_eye) */' + LineEnding +
102 '' + LineEnding +
103 ' gl_Position = castle_ProjectionMatrix * castle_vertex_eye;' + LineEnding +
104 '' + LineEnding +
105 ' #ifdef CASTLE_BUGGY_GLSL_READ_VARYING' + LineEnding +
106 ' #undef castle_vertex_eye' + LineEnding +
107 ' #undef castle_normal_eye' + LineEnding +
108 ' #undef castle_Color' + LineEnding +
109 ' castle_vertex_eye = temp_castle_vertex_eye;' + LineEnding +
110 ' castle_normal_eye = temp_castle_normal_eye;' + LineEnding +
111 ' castle_Color = temp_castle_Color;' + LineEnding +
112 ' #endif' + LineEnding +
113 '}' + LineEnding +
114 ''