-const ProgramBuilder::StandardVariable ProgramBuilder::standard_variables[] =
-{
- { FRAGMENT, "gl_FragColor", 0, "color_base", "!t" },
- { FRAGMENT, "gl_FragColor", 0, "tex_sample", "!l!s!mt" },
- { FRAGMENT, "gl_FragColor", 0, "tex_sample*color_base", "l|s|mt" },
- { FRAGMENT, "color_base", "vec4", "vec4(1.0)", "!l!s!m" },
- { FRAGMENT, "color_base", "vec4", "color", "!l!sm" },
- { FRAGMENT, "color_base", "vec4", "vec4(vec3(l_shadow), 1.0)", "!ls!m" },
- { FRAGMENT, "color_base", "vec4", "color*vec4(vec3(l_shadow), 1.0)", "!lsm" },
- { FRAGMENT, "color_base", "vec4", "vec4(rgb_light_full, 1.0)", "l!m" },
- { FRAGMENT, "color_base", "vec4", "vec4(rgb_light_full, gl_FrontMaterial.diffuse.a)", "lm" },
- { FRAGMENT, "rgb_light_full", "vec3", "rgb_light_shadow+gl_FrontLightModelProduct.sceneColor.rgb", "m" },
- { FRAGMENT, "rgb_light_full", "vec3", "rgb_light_shadow", "!m" },
- { FRAGMENT, "rgb_light_shadow", "vec3", "rgb_light*l_shadow", "s" },
- { FRAGMENT, "rgb_light_shadow", "vec3", "rgb_light", "!s" },
- { FRAGMENT, "rgb_light", "vec3", "vec3(l_diffuse)", "!m!p" },
- { FRAGMENT, "rgb_light", "vec3", "vec3(l_diffuse+l_specular)", "!mp" },
- { FRAGMENT, "rgb_light", "vec3", "l_diffuse*gl_FrontLightProduct[0].diffuse.rgb", "m!p" },
- { FRAGMENT, "rgb_light", "vec3", "l_diffuse*gl_FrontLightProduct[0].diffuse.rgb+l_specular*gl_FrontLightProduct[0].specular.rgb", "mp" },
+const ProgramBuilder::VariableDefinition ProgramBuilder::standard_variables[] =
+{
+ { FRAGMENT, "gl_FragColor", "vec4", "frag_color", 0 },
+ { FRAGMENT, "frag_color", "vec4", "incoming_color", "!f" },
+ { FRAGMENT, "frag_color", "vec4", "vec4(mix(fog_color.rgb, incoming_color.rgb, fog_value), incoming_color.a)", "f" },
+ { FRAGMENT, "fog_value", "float", "exp(-fog_coord*fog_density)", 0 },
+
+ { FRAGMENT, "incoming_color", "vec4", "basic_color", "!e!l" },
+ { FRAGMENT, "incoming_color", "vec4", "vec4(rgb_surface, surface_alpha)", "!el" },
+ { FRAGMENT, "incoming_color", "vec4", "vec4(rgb_surface+rgb_reflection, surface_alpha)", "e" },
+
+ { FRAGMENT, "rgb_reflection", "vec3", "reflect_sample.rgb*reflectivity", 0 },
+ { FRAGMENT, "reflect_sample", "vec4", "textureCube(environment, env_reflect_dir)", 0 },
+ { FRAGMENT, "env_reflect_dir", "vec3", "env_eye_matrix*eye_reflect_dir", 0 },
+ { FRAGMENT, "eye_reflect_dir", "vec3", "eye_tbn_matrix*tbn_reflect_dir", "n" },
+
+ { FRAGMENT, "rgb_surface", "vec3", "rgb_unlit_surface", "!l" },
+ { FRAGMENT, "rgb_surface", "vec3", "rgb_lit_surface", "l" },
+ { FRAGMENT, "rgb_unlit_surface", "vec3", "basic_color.rgb", "!s" },
+ { FRAGMENT, "rgb_unlit_surface", "vec3", "basic_color.rgb*l_shadow", "s" },
+ { FRAGMENT, "rgb_lit_surface", "vec3", "rgb_illumination_diffuse", "!m!t" },
+ { FRAGMENT, "rgb_lit_surface", "vec3", "rgb_illumination_diffuse*diffuse_sample.rgb", "!mt" },
+ { FRAGMENT, "rgb_lit_surface", "vec3", "rgb_surface_ambient+rgb_surface_diffuse", "m!p" },
+ { FRAGMENT, "rgb_lit_surface", "vec3", "rgb_surface_ambient+rgb_surface_diffuse+rgb_surface_specular", "mp" },
+
+ { FRAGMENT, "surface_alpha", "float", "basic_color.a", "!m" },
+ { FRAGMENT, "surface_alpha", "float", "basic_color.a", "m!l" },
+ { FRAGMENT, "surface_alpha", "float", "material.diffuse.a", "ml!t" },
+ { FRAGMENT, "surface_alpha", "float", "material.diffuse.a*diffuse_sample.a", "mlt" },
+ { FRAGMENT, "basic_color", "vec4", "vec4(1.0)", "!m!t" },
+ { FRAGMENT, "basic_color", "vec4", "diffuse_sample", "!mt" },
+ { FRAGMENT, "basic_color", "vec4", "color", "m!t" },
+ { FRAGMENT, "basic_color", "vec4", "color*diffuse_sample", "mt" },
+
+ { FRAGMENT, "rgb_surface_ambient", "vec3", "rgb_illumination_ambient*material.ambient.rgb", "!t" },
+ { FRAGMENT, "rgb_surface_ambient", "vec3", "rgb_illumination_ambient*material.ambient.rgb*diffuse_sample.rgb", "t" },
+ { FRAGMENT, "rgb_illumination_ambient", "vec3", "ambient_color.rgb", "!y" },
+ { FRAGMENT, "rgb_illumination_ambient", "vec3", "ambient_color.rgb+l_skylight*sky_color.rgb", "y" },
+ { FRAGMENT, "l_skylight", "float", "dot(n_zzz_normal, zzz_sky_dir)*0.5+0.5", 0 },
+
+ { FRAGMENT, "rgb_surface_specular", "vec3", "rgb_illumination_specular*material.specular.rgb", 0 },
+ { FRAGMENT, "rgb_illumination_specular", "vec3", "rgb_illumination_specular_direct", "!y|e" },
+ { FRAGMENT, "rgb_illumination_specular", "vec3", "rgb_illumination_specular_direct+l_sky_specular*sky_color.rgb", "y!e" },
+ { FRAGMENT, "rgb_illumination_specular_direct", "vec3", "rgb_light_specular", "!s" },
+ { FRAGMENT, "rgb_illumination_specular_direct", "vec3", "rgb_light_specular*l_shadow", "s" },
+ { FRAGMENT, "rgb_light_specular[i]", "vec3", "l_specular[i]*light_sources[i].specular.rgb", 0 },
+ { FRAGMENT, "l_sky_specular", "float", "pow((1.0-pow(clamp(dot(zzz_reflect_dir, zzz_sky_dir)-horizon_limit, -1.0, 0.0), 2.0)), material.shininess/2.0)", 0 },
+ { FRAGMENT, "l_specular[i]", "float", "pow(max(dot(n_zzz_half_vec[i], n_zzz_normal), 0.0), material.shininess)", 0 },
+
+ { FRAGMENT, "rgb_surface_diffuse", "vec3", "rgb_illumination_diffuse*material.diffuse.rgb", "!t" },
+ { FRAGMENT, "rgb_surface_diffuse", "vec3", "rgb_illumination_diffuse*material.diffuse.rgb*diffuse_sample.rgb", "t" },
+ { FRAGMENT, "rgb_illumination_diffuse", "vec3", "rgb_light_diffuse", "!s" },
+ { FRAGMENT, "rgb_illumination_diffuse", "vec3", "rgb_light_diffuse*l_shadow", "s" },
+ { FRAGMENT, "rgb_light_diffuse[i]", "vec3", "l_diffuse[i]*light_sources[i].diffuse.rgb", 0 },
+ { FRAGMENT, "l_diffuse[i]", "float", "max(dot(n_zzz_normal, n_zzz_light_dir[i]), 0.0)", 0 },
+