X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=shaderlib%2Fsinglepass.glsl;h=eef6a5322aabed050dbfa6272a2337d7fd09bfd1;hb=1e3b07299f798983ee0b861121a65ca2e8c8830a;hp=50c3841f3b267afa665a869424030677cbe98dc8;hpb=4bee7581168e0803dd24568b61e590d2a4830f96;p=libs%2Fgl.git diff --git a/shaderlib/singlepass.glsl b/shaderlib/singlepass.glsl index 50c3841f..eef6a532 100644 --- a/shaderlib/singlepass.glsl +++ b/shaderlib/singlepass.glsl @@ -1,35 +1,5 @@ -struct LightSourceParameters -{ - vec4 position; - vec4 diffuse; - vec4 specular; -}; - -struct MaterialParameters -{ - vec4 ambient; - vec4 diffuse; - vec4 specular; - float shininess; -}; - -struct ClipPlane -{ - vec4 equation; -}; - -uniform mat4 eye_obj_matrix; -uniform mat3 eye_obj_normal_matrix; -uniform Transform -{ - mat4 projection_matrix; -}; - -uniform Material -{ - MaterialParameters material; - float reflectivity; -}; +// Deprecated; use phong.glsl instead. +import msp_interface; const bool use_vertex_color = false; @@ -37,53 +7,15 @@ const bool use_lighting = false; const bool use_specular = false; const bool use_sky = false; const bool use_fog = false; -uniform Lighting -{ - // Declared as an array for compatibility reasons - LightSourceParameters light_sources[1]; - vec4 ambient_color; - vec4 sky_color; - vec3 eye_zenith_dir; - float horizon_limit; - vec4 fog_color; - float fog_density; -}; const bool use_diffuse_map = false; -uniform sampler2D diffuse_map; - const bool use_normal_map = false; -uniform sampler2D normal_map; const bool use_shadow_map = false; -uniform sampler2DShadow shadow; -uniform ShadowMap -{ - float shadow_darkness; - mat4 shd_eye_matrix; -}; const bool use_environment_map = false; -uniform samplerCube environment; -uniform EnvMap -{ - mat3 env_eye_matrix; -}; - -const int max_clip_planes = 0; -uniform Clipping -{ - ClipPlane clip_planes[max_clip_planes]; -}; #pragma MSP stage(vertex) -layout(location=0) in vec4 vertex; -layout(location=8) in vec4 texcoord; -layout(location=3) in vec4 color; -layout(location=2) in vec3 normal; -layout(location=4) in vec3 tangent; -layout(location=5) in vec3 binormal; - vec4 get_vertex_position() { return vertex; @@ -128,8 +60,6 @@ void main() } #pragma MSP stage(fragment) -layout(location=0) out vec4 frag_color; - vec4 get_diffuse_sample() { return texture(diffuse_map, texcoord.xy); @@ -142,7 +72,7 @@ vec3 get_normal_sample() vec4 get_environment_sample(vec3 direction) { - return texture(environment, direction); + return texture(environment_map, direction); } vec3 normal; @@ -150,7 +80,7 @@ vec4 diffuse_sample; vec3 singlepass_lighting() { - float shadow_sample = texture(shadow, shadow_coord); + float shadow_sample = texture(shadow_map, shadow_coord); float shadow_intensity = mix(1.0, shadow_sample, shadow_darkness); vec3 ambient_light = ambient_color.rgb; @@ -172,23 +102,23 @@ vec3 singlepass_lighting() vec3 diffuse_light = diffuse_intensity*light_sources[0].diffuse.rgb; vec3 half_vec = normalize(light_dir-incident_dir); - float specular_intensity = pow(max(dot(half_vec, normal), 0.0), material.shininess); + float specular_intensity = pow(max(dot(half_vec, normal), 0.0), basic_material.shininess); if(use_shadow_map) specular_intensity *= shadow_intensity; vec3 specular_light = specular_intensity*light_sources[0].specular.rgb; - vec3 result = material.ambient.rgb*ambient_light+material.diffuse.rgb*diffuse_light; + vec3 result = basic_material.diffuse.rgb*ambient_light+basic_material.diffuse.rgb*diffuse_light; if(use_diffuse_map) result *= diffuse_sample.rgb; if(use_specular) - result += material.specular.rgb*specular_light; + result += basic_material.specular.rgb*specular_light; return result; } float singlepass_transparency() { - float alpha = material.diffuse.a; + float alpha = basic_material.diffuse.a; if(use_diffuse_map) alpha *= diffuse_sample.a; return alpha;