X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=shaderlib%2Fsinglepass.glsl;h=f782f3dad543ead82db5c583d3ebfbcfe955132e;hp=a80ca339147c028f3200fcbd2e8a2d792819f187;hb=HEAD;hpb=0c1e15e36a46bada35b905b2bdd35f6f48ce7cb0 diff --git a/shaderlib/singlepass.glsl b/shaderlib/singlepass.glsl deleted file mode 100644 index a80ca339..00000000 --- a/shaderlib/singlepass.glsl +++ /dev/null @@ -1,240 +0,0 @@ -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; -}; - -const bool use_vertex_color = false; - -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]; -}; - -////// 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; -} - -vec3 get_vertex_normal() -{ - return normal; -} - -void singlepass_transform_and_lighting() -{ - out vec4 eye_vertex = eye_obj_matrix*get_vertex_position(); - gl_Position = projection_matrix*eye_vertex; - - out vec3 eye_normal = eye_obj_normal_matrix*get_vertex_normal(); - vec3 eye_tangent = eye_obj_normal_matrix*tangent; - vec3 eye_binormal = eye_obj_normal_matrix*binormal; - out mat3 eye_tbn_matrix = mat3(eye_tangent, eye_binormal, eye_normal); - - out vec3 incident_dir = normalize(eye_vertex.xyz); - if(use_normal_map) - incident_dir = incident_dir*eye_tbn_matrix; - - vec3 ldir = normalize(light_sources[0].position.xyz-eye_vertex.xyz*light_sources[0].position.w); - if(use_normal_map) - ldir = ldir*eye_tbn_matrix; - out vec3 light_dir = ldir; - - out vec3 tbn_zenith_dir = eye_zenith_dir*eye_tbn_matrix; - out vec3 shadow_coord = (shd_eye_matrix*eye_vertex).xyz; - out float fog_coord = eye_vertex.z; - - for(int i=0; i