]> git.tdb.fi Git - libs/gl.git/blob - shaderlib/msp_interface.glsl
Fix some errors in the shader library
[libs/gl.git] / shaderlib / msp_interface.glsl
1 struct LightSourceParameters
2 {
3         vec4 position;
4         vec4 diffuse;
5         vec4 specular;
6 };
7
8 struct BasicMaterialParameters
9 {
10         vec4 diffuse;
11         vec4 specular;
12         vec4 emission;
13         float shininess;
14         float reflectivity;
15 };
16
17 struct PbrMaterialParameters
18 {
19         vec4 base_color;
20         vec4 emission;
21         float metalness;
22         float roughness;
23 };
24
25 struct ClipPlane
26 {
27         vec4 equation;
28 };
29
30 uniform mat4 eye_obj_matrix;
31 uniform mat3 eye_obj_normal_matrix;
32 uniform Transform
33 {
34         mat4 eye_world_matrix;
35         mat4 projection_matrix;
36 };
37
38 uniform BasicMaterial
39 {
40         BasicMaterialParameters basic_material;
41 };
42
43 uniform PbrMaterial
44 {
45         PbrMaterialParameters pbr_material;
46 };
47
48 uniform Lighting
49 {
50         // Declared as an array for compatibility reasons
51         LightSourceParameters light_sources[1];
52         vec4 ambient_color;
53         vec4 sky_color;
54         vec3 eye_zenith_dir;
55         float horizon_limit;
56         vec4 fog_color;
57         float fog_density;
58 };
59
60 uniform sampler2D diffuse_map;
61 uniform sampler2D specular_map;
62 uniform sampler2D shininess_map;
63 uniform sampler2D reflectivity_map;
64 uniform sampler2D base_color_map;
65 uniform sampler2D metalness_map;
66 uniform sampler2D roughness_map;
67 uniform sampler2D occlusion_map;
68 uniform sampler2D emission_map;
69 uniform sampler2D normal_map;
70
71 uniform sampler2DShadow shadow_map;
72 uniform ShadowMap
73 {
74         float shadow_darkness;
75         mat4 shd_eye_matrix;
76 };
77
78 uniform samplerCube environment_map;
79 uniform EnvMap
80 {
81         mat3 env_eye_matrix;
82 };
83
84 layout(constant_id=auto) const int max_clip_planes = 0;
85 uniform Clipping
86 {
87         ClipPlane clip_planes[max_clip_planes];
88 };
89
90 #pragma MSP stage(vertex)
91 layout(location=0) in vec4 vertex;
92 layout(location=8) in vec4 texcoord;
93 layout(location=3) in vec4 color;
94 layout(location=2) in vec3 normal;
95 layout(location=4) in vec3 tangent;
96 layout(location=5) in vec3 binormal;
97 layout(location=12) in vec4 instance_transform[3];
98
99 #pragma MSP stage(fragment)
100 layout(location=0) out vec4 frag_color;