… | |
… | |
2 | #define SHADER_VARS_H |
2 | #define SHADER_VARS_H |
3 | |
3 | |
4 | #include "shader.h" |
4 | #include "shader.h" |
5 | |
5 | |
6 | namespace shader { |
6 | namespace shader { |
|
|
7 | namespace compile { |
|
|
8 | extern struct vin |
|
|
9 | { |
|
|
10 | static const gluvar vertex; |
|
|
11 | static const gluvar normal; |
|
|
12 | static const gluvar color; |
|
|
13 | static const gluvar secondary_color; |
|
|
14 | static const gluvar tex_coord[8]; |
|
|
15 | static const gluvar fog_coord; |
|
|
16 | } vin; |
7 | |
17 | |
8 | extern struct vin |
18 | extern struct vout |
9 | { |
19 | { |
10 | // for setting |
20 | // glstate builtin |
11 | static varying_3f vertex_3f; |
21 | static const gluvar position; |
12 | static varying_4f vertex_4f; |
22 | static const gluvar point_size; |
13 | static varying_3f normal_3f; |
23 | static const gluvar clip_vertex; |
14 | static varying_3f color_3f; |
|
|
15 | static varying_4f color_4f; |
|
|
16 | static varying_3f secondary_color_3f; |
|
|
17 | static varying_4f secondary_color_4f; |
|
|
18 | static varying_1f tex_coord_1f[8]; |
|
|
19 | static varying_2f tex_coord_2f[8]; |
|
|
20 | static varying_3f tex_coord_3f[8]; |
|
|
21 | static varying_4f tex_coord_4f[8]; |
|
|
22 | |
24 | |
23 | // for the vertex shader |
25 | // standard varying |
24 | static const glvar vertex; |
|
|
25 | static const glvar normal; |
26 | static const gluvar front_color; |
26 | static const glvar color; |
27 | static const gluvar back_color; |
|
|
28 | static const gluvar front_secondary_color; |
27 | static const glvar secondary_color; |
29 | static const gluvar back_secondary_color; |
28 | static const glvar tex_coord[8]; |
30 | static const gluvar tex_coord[8]; |
29 | static const glvar fog_coord; |
31 | static const gluvar fog_frag_coord; |
30 | } vin; |
32 | } vout; |
31 | |
33 | |
32 | extern struct vout |
34 | extern struct fin |
33 | { |
35 | { |
34 | // glstate builtin |
36 | // glstate builtin |
35 | static const glvar position; |
37 | static const gluvar frag_coord; |
36 | static const glvar point_size; |
38 | static const gluvar front_facing; |
37 | static const glvar clip_vertex; |
|
|
38 | |
39 | |
39 | // standard varying |
40 | // standard varying |
40 | static const glvar front_color; |
|
|
41 | static const glvar back_color; |
41 | static const gluvar color; |
42 | static const glvar front_secondary_color; |
|
|
43 | static const glvar back_secondary_color; |
42 | static const gluvar secondary_color; |
44 | static const glvar tex_coord[8]; |
43 | static const gluvar tex_coord[8]; |
45 | static const glvar fog_frag_coord; |
44 | static const gluvar fog_frag_coord; |
46 | } vout; |
45 | } fin; |
47 | |
46 | |
48 | extern struct fin |
47 | extern struct fout |
49 | { |
48 | { |
50 | // glstate builtin |
49 | // glstate builtin |
51 | static const glvar frag_coord; |
50 | static const gluvar frag_color; |
52 | static const glvar front_facing; |
51 | static const gluvar frag_depth; |
|
|
52 | static const gluvar frag_data[2]; |
|
|
53 | } fout; |
53 | |
54 | |
54 | // standard varying |
55 | // predefined globals |
55 | static const glvar color; |
56 | extern gluvar model_view_matrix, |
56 | static const glvar secondary_color; |
57 | projection_matrix, |
57 | static const glvar tex_coord[8]; |
58 | model_view_projection_matrix, |
58 | static const glvar fog_frag_coord; |
59 | texture_matrix[8]; |
59 | } fin; |
60 | extern gluvar model_view_matrix_inverse, |
|
|
61 | projection_matrix_inverse, |
|
|
62 | model_view_projection_matrix_inverse, |
|
|
63 | texture_matrix_inverse[8]; |
|
|
64 | extern gluvar model_view_matrix_transpose, |
|
|
65 | projection_matrix_transpose, |
|
|
66 | model_view_projection_matrix_transpose, |
|
|
67 | texture_matrix_transpose[8]; |
|
|
68 | extern gluvar model_view_matrix_inverse_transpose, |
|
|
69 | projection_matrix_inverse_transpose, |
|
|
70 | model_view_projection_matrix_inverse_transpose, |
|
|
71 | texture_matrix_inverse_transpose[8]; |
60 | |
72 | |
61 | extern struct fout |
73 | extern gluvar normal_matrix; |
62 | { |
|
|
63 | // glstate builtin |
|
|
64 | static const glvar frag_color; |
|
|
65 | static const glvar frag_depth; |
|
|
66 | static const glvar frag_data[2]; |
|
|
67 | } fout; |
|
|
68 | |
74 | |
69 | // predefined globals |
75 | extern gluvar normal_scale; |
70 | extern struct gl { |
76 | extern gluvar depth_range_near, depth_range_far, depth_range_diff; |
71 | static uniform_matrix_4f model_view_matrix, |
|
|
72 | projection_matrix, |
|
|
73 | model_view_projection_matrix, |
|
|
74 | texture_matrix[8]; |
|
|
75 | static uniform_matrix_4f model_view_matrix_inverse, |
|
|
76 | projection_matrix_inverse, |
|
|
77 | model_view_projection_matrix_inverse, |
|
|
78 | texture_matrix_inverse[8]; |
|
|
79 | static uniform_matrix_4f model_view_matrix_transpose, |
|
|
80 | projection_matrix_transpose, |
|
|
81 | model_view_projection_matrix_transpose, |
|
|
82 | texture_matrix_transpose[8]; |
|
|
83 | static uniform_matrix_4f model_view_matrix_inverse_transpose, |
|
|
84 | projection_matrix_inverse_transpose, |
|
|
85 | model_view_projection_matrix_inverse_transpose, |
|
|
86 | texture_matrix_inverse_transpose[8]; |
|
|
87 | |
77 | |
88 | static uniform_matrix_3f normal_matrix; |
78 | extern gluvar clip_plane[2];//TODO |
89 | |
|
|
90 | static uniform_1f normal_scale; |
|
|
91 | static uniform_1f depth_range_near, depth_range_far, depth_range_diff; |
|
|
92 | |
|
|
93 | static uniform_4f clip_plane[2];//TODO |
|
|
94 | |
79 | |
95 | // point parameters TODO |
80 | // point parameters TODO |
96 | |
81 | |
97 | static uniform_4f front_material_emission, |
82 | extern gluvar front_material_emission, |
98 | front_material_ambient, |
83 | front_material_ambient, |
99 | front_material_diffuse, |
84 | front_material_diffuse, |
100 | front_material_specular, |
85 | front_material_specular, |
101 | front_material_shininess; |
86 | front_material_shininess; |
102 | static uniform_4f back_material_emission, |
87 | extern gluvar back_material_emission, |
103 | back_material_ambient, |
88 | back_material_ambient, |
104 | back_material_diffuse, |
89 | back_material_diffuse, |
105 | back_material_specular, |
90 | back_material_specular, |
106 | back_material_shininess; |
91 | back_material_shininess; |
107 | |
92 | |
108 | // light source parameters TODO |
93 | // light source parameters TODO |
109 | |
94 | |
110 | static uniform_4f light_model_ambient; |
95 | extern gluvar light_model_ambient; |
111 | static uniform_4f front_light_model_product_scene_color; |
96 | extern gluvar front_light_model_product_scene_color; |
112 | static uniform_4f back_light_model_product_scene_color; |
97 | extern gluvar back_light_model_product_scene_color; |
113 | |
98 | |
114 | // light products TODO |
99 | // light products TODO |
115 | // texture env and gen TODO |
100 | // texture env and gen TODO |
116 | // fogparameters TODO |
101 | // fogparameters TODO |
117 | |
102 | |
118 | // shader output are in vout and fout |
103 | // shader output are in vout and fout |
119 | } gl; |
104 | } |
120 | |
|
|
121 | } |
105 | } |
122 | |
106 | |
123 | #endif |
107 | #endif |
124 | |
108 | |
125 | |
109 | |