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