XreaL 0.8.2 linux-i386 Feb 14 2010 ----- FS_Startup ----- Current search path: /home/sa/.xreal/base ./base ---------------------- 0 files in pk3 files execing default.cfg couldn't exec xreal.cfg execing autoexec.cfg Hunk_Clear: reset the hunk ok ----- Client Initialization ----- Couldn't read q3history. ----- Initializing Renderer ---- Loading "rendererGLi386.so"...Loading "/home/sa/Media/Games/XreaL/rendererGLi386.so"...done Calling GetRefAPI... GetRefAPI() ------------------------------- QKEY found. ----- Client Initialization Complete ----- ----- R_Init ----- SDL_Init( SDL_INIT_VIDEO )... SDL using driver "x11" Initializing OpenGL display Estimated display aspect: 1.600 ...setting mode 3: 640 480 Using 8/8/8 Color bits, 24 depth, 8 stencil display. ...initializing QGL Available modes: '1680x1050 1280x800 1440x900 720x400 640x480 800x600 832x624 1024x768 1152x864 1280x960 1280x1024' GL_RENDERER: Mesa DRI Intel(R) G45/G43 GEM 20091221 DEVELOPMENT x86/MMX/SSE2 Initializing OpenGL extensions ...using GL_ARB_multitexture ...using GL_ARB_depth_texture ...using GL_ARB_texture_cube_map ...using GL_ARB_vertex_program ...using GL_ARB_vertex_buffer_object ...using GL_ARB_occlusion_query ...using GL_ARB_shader_objects ...using GL_ARB_vertex_shader ...using GL_ARB_fragment_shader ...using GL_ARB_shading_language_100 ...using GL_ARB_texture_non_power_of_two ...using GL_ARB_draw_buffers ...using GL_ARB_half_float_pixel ...GL_ARB_texture_float not found ...using GL_ARB_texture_compression ...using GL_ARB_vertex_array_object ...using GL_EXT_texture_compression_s3tc ...using GL_EXT_texture3D ...using GL_EXT_stencil_wrap ...using GL_EXT_texture_filter_anisotropic ...using GL_EXT_stencil_two_side ...GL_EXT_depth_bounds_test not found ...using GL_EXT_framebuffer_object ...using GL_EXT_packed_depth_stencil ...using GL_EXT_framebuffer_blit ...GL_EXTX_framebuffer_mixed_formats not found ...using GL_ATI_separate_stencil ...using GL_SGIS_generate_mipmap GL_VENDOR: Tungsten Graphics, Inc GL_RENDERER: Mesa DRI Intel(R) G45/G43 GEM 20091221 DEVELOPMENT x86/MMX/SSE2 GL_VERSION: 2.1 Mesa 7.8-devel GL_EXTENSIONS: GL_ARB_copy_buffer GL_ARB_depth_texture GL_ARB_depth_clamp GL_ARB_draw_buffers GL_ARB_draw_elements_base_vertex GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_map_buffer_range GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_provoking_vertex GL_ARB_seamless_cube_map GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ARB_shading_language_120 GL_ARB_shadow GL_ARB_sync GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_transpose_matrix GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_window_pos GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_logic_op GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_cull_vertex GL_EXT_compiled_vertex_array GL_EXT_copy_texture GL_EXT_draw_buffers2 GL_EXT_draw_range_elements GL_EXT_framebuffer_blit GL_EXT_framebuffer_object GL_EXT_fog_coord GL_EXT_gpu_program_parameters GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_subtexture GL_EXT_texture GL_EXT_texture3D GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod_bias GL_EXT_texture_object GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_swizzle GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_3DFX_texture_compression_FXT1 GL_APPLE_client_storage GL_APPLE_packed_pixels GL_APPLE_vertex_array_object GL_ATI_blend_equation_separate GL_ATI_envmap_bumpmap GL_ATI_texture_env_combine3 GL_ATI_separate_stencil GL_IBM_multimode_draw_arrays GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_INGR_blend_func_separate GL_MESA_pack_invert GL_MESA_texture_signed_rgba GL_MESA_ycbcr_texture GL_MESA_window_pos GL_NV_blend_square GL_NV_depth_clamp GL_NV_light_max_exponent GL_NV_packed_depth_stencil GL_NV_texture_env_combine4 GL_NV_texture_rectangle GL_NV_texgen_reflection GL_NV_vertex_program GL_NV_vertex_program1_1 GL_OES_read_format GL_SGIS_generate_mipmap GL_SGIS_texture_border_clamp GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_SUN_multi_draw_arrays GL_S3_s3tc GL_MAX_TEXTURE_SIZE: 4096 GL_MAX_TEXTURE_UNITS_ARB: 8 GL_SHADING_LANGUAGE_VERSION_ARB: 1.20 GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 4096 GL_MAX_VARYING_FLOATS_ARB 64 GL_MAX_VERTEX_ATTRIBS_ARB 16 64 occlusion query bits GL_MAX_DRAW_BUFFERS_ARB: 4 GL_TEXTURE_MAX_ANISOTROPY_EXT: 16.000000 GL_MAX_RENDERBUFFER_SIZE_EXT: 4096 GL_MAX_COLOR_ATTACHMENTS_EXT: 4 PIXELFORMAT: color(24-bits) Z(24-bit) stencil(8-bits) MODE: 3, 640 x 480 fullscreen hz:N/A GAMMA: hardware w/ 0 overbright bits texturemode: GL_LINEAR_MIPMAP_NEAREST picmip: 1 Using S3TC (DXTC) texture compression ------- GLSL_InitGPUShaders ------- ...loading 'glsl/genericSingle_vp.glsl' ...loading 'glsl/genericSingle_fp.glsl' ...loading 'glsl/vertexLighting_DBS_entity_vp.glsl' ...loading 'glsl/vertexLighting_DBS_entity_fp.glsl' #version 120 #ifndef r_SpecularExponent #define r_SpecularExponent 16.000000 #endif #ifndef r_SpecularScale #define r_SpecularScale 1.400000 #endif #ifndef M_PI #define M_PI 3.14159265358979323846f #endif #ifndef MAX_SHADOWMAPS #define MAX_SHADOWMAPS 5 #endif #ifndef deformGen_t #define deformGen_t #define DGEN_WAVE_SIN 1 #define DGEN_WAVE_SQUARE 2 #define DGEN_WAVE_TRIANGLE 3 #define DGEN_WAVE_SAWTOOTH 4 #define DGEN_WAVE_INVERSE_SAWTOOTH 5 #define DGEN_BULGE 7 #define DGEN_MOVE 8 #endif #ifndef colorGen_t #define colorGen_t #define CGEN_VERTEX 5 #define CGEN_ONE_MINUS_VERTEX 6 #endif #ifndef alphaGen_t #define alphaGen_t #define AGEN_VERTEX 3 #define AGEN_ONE_MINUS_VERTEX 4 #endif #ifndef alphaTest_t #define alphaTest_t #define ATEST_GT_0 1 #define ATEST_LT_128 2 #define ATEST_GE_128 3 #endif #ifndef r_FBufScale #define r_FBufScale vec2(0.001563, 0.002083) #endif #ifndef r_NPOTScale #define r_NPOTScale vec2(1.000000, 1.000000) #endif #ifndef MESA #define MESA 1 #endif #ifndef r_precomputedLighting #define _precomputedLighting 1 #endif #ifndef r_heatHazeFix #define r_heatHazeFix 1 #endif #ifndef r_NormalMapping #define r_NormalMapping 1 #endif #ifndef r_WrapAroundLighting #define r_WrapAroundLighting 0.700000 #endif #ifndef r_halfLambertLighting #define r_halfLambertLighting 1 #endif #line 0 /* =========================================================================== Copyright (C) 2006-2009 Robert Beckebans This file is part of XreaL source code. XreaL source code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. XreaL source code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General ublic License along with XreaL source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ uniform sampler2D u_DiffuseMap; uniform sampler2D u_NormalMap; uniform sampler2D u_SpecularMap; uniform int u_AlphaTest; uniform vec3 u_ViewOrigin; uniform vec3 u_AmbientColor; uniform vec3 u_LightDir; uniform vec3 u_LightColor; uniform float u_SpecularExponent; uniform int u_ParallaxMapping; uniform float u_DepthScale; uniform int u_PortalClipping; uniform vec4 u_PortalPlane; varying vec3 var_Position; varying vec2 var_TexDiffuse; #if defined(r_NormalMapping) varying vec2 var_TexNormal; varying vec2 var_TexSpecular; varying vec3 var_Tangent; varying vec3 var_Binormal; #endif varying vec3 var_Normal; #if defined(r_ParallaxMapping) float RayIntersectDisplaceMap(vec2 dp, vec2 ds) { const int linearSearchSteps = 16; const int binarySearchSteps = 6; f oat depthStep = 1.0 / float(linearSearchSteps); // current size of search window float size = depthStep; // current depth position float depth = 0.0; // best match found (starts with last position 1.0) float bestDepth = 1.0; // search front to back for first point inside object for(int i = 0; i < linearSearchSteps - 1; ++i) { depth += size; vec4 t = texture2D(u_NormalMap, dp + ds * depth); if(bestDepth > 0.996) // if no depth found yet if(depth >= t.w) bestDepth = depth; // store best depth } depth = bestDepth; // recurse around first point (depth) for closest match for(int i = 0; i < binarySearchSteps; ++i) { size *= 0.5; vec4 t = texture2D(u_NormalMap, dp + ds * depth); if(depth >= t.w) #ifdef RM_DOUBLEDEPTH if(depth <= t.z) #endif { bestDepth = depth; depth -= 2.0 * size; } depth += size; } return bestDepth; } #endif void main() { if(bool(u_PortalClipping)) { float dist = dot(var_Position.xyz, u_PortalPlane.xyz) - u_PortalPla e.w; if(dist < 0.0) { discard; return; } } #if defined(r_NormalMapping) // invert tangent space for two sided surfaces mat3 tangentToWorldMatrix; if(gl_FrontFacing) tangentToWorldMatrix = mat3(-var_Tangent.xyz, -var_Binormal.xyz, -var_Normal.xyz); else tangentToWorldMatrix = mat3(var_Tangent.xyz, var_Binormal.xyz, var_Normal.xyz); // compute view direction in world space vec3 I = normalize(u_ViewOrigin - var_Position); #endif vec2 texDiffuse = var_TexDiffuse.st; #if defined(r_NormalMapping) vec2 texNormal = var_TexNormal.st; vec2 texSpecular = var_TexSpecular.st; #endif #if defined(r_ParallaxMapping) if(bool(u_ParallaxMapping)) { // ray intersect in view direction mat3 worldToTangentMatrix; #if defined(GLHW_ATI) || defined(GLHW_ATI_DX10) worldToTangentMatrix = mat3(tangentToWorldMatrix[0][0], tangentToWorldMatrix[1][0], tangentToWorldMatrix[2][0], tangentToWorldMatrix[0][1], tangentToWorldMatrix[1][1], tangentToWorldMatrix[2][1], tangentToWorldM trix[0][2], tangentToWorldMatrix[1][2], tangentToWorldMatrix[2][2]); #else worldToTangentMatrix = transpose(tangentToWorldMatrix); #endif // compute view direction in tangent space vec3 V = worldToTangentMatrix * (u_ViewOrigin - var_Position.xyz); V = normalize(V); // size and start position of search in texture space vec2 S = V.xy * -u_DepthScale / V.z; float depth = RayIntersectDisplaceMap(texNormal, S); // compute texcoords offset vec2 texOffset = S * depth; texDiffuse.st += texOffset; texNormal.st += texOffset; texSpecular.st += texOffset; } #endif // compute the diffuse term vec4 diffuse = texture2D(u_DiffuseMap, texDiffuse); if(u_AlphaTest == ATEST_GT_0 && diffuse.a <= 0.0) { discard; return; } else if(u_AlphaTest == ATEST_LT_128 && diffuse.a >= 0.5) { discard; return; } else if(u_AlphaTest == ATEST_GE_128 && diffuse.a < 0.5) { discard; return; } #if defined(r_NormalMapping) // compute normal in world space from normalmap vec3 N = t ngentToWorldMatrix * (2.0 * (texture2D(u_NormalMap, texNormal).xyz - 0.5)); // compute light direction in world space vec3 L = u_LightDir; // compute half angle in world space vec3 H = normalize(L + I); // compute the specular term vec3 specular = texture2D(u_SpecularMap, texSpecular).rgb * u_LightColor * pow(clamp(dot(N, H), 0.0, 1.0), r_SpecularExponent) * r_SpecularScale; // compute the light term #if defined(r_halfLambertLighting) // http://developer.valvesoftware.com/wiki/Half_Lambert float NL = clamp(dot(N, L), 0.0, 1.0) * 0.5 + 0.5; NL *= NL; #elif defined(r_WrapAroundLighting) float NL = clamp(dot(N, L) + r_WrapAroundLighting, 0.0, 1.0) / clamp(1.0 + r_WrapAroundLighting, 0.0, 1.0); #else float NL = clamp(dot(N, L), 0.0, 1.0); #endif vec3 light = u_AmbientColor + u_LightColor * NL; clamp(light, 0.0, 1.0); // compute final color vec4 color = diffuse; color.rgb *= light; color.rgb += specular; gl_FragColor = color; #else vec3 N; if(gl_FrontFacing) N = -normalize(v r_Normal); else N = normalize(var_Normal); vec3 L = u_LightDir; gl_FragColor = vec4(diffuse.rgb * (u_AmbientColor + u_LightColor * clamp(dot(N, L), 0.0, 1.0)), diffuse.a); #endif } compile log: Error: declaration of 'NL' conflicts with previous declaration ******************** ERROR: Couldn't compile glsl/vertexLighting_DBS_entity_fp.glsl ******************** RE_Shutdown( destroyWindow = 0 ) Hunk_Clear: reset the hunk ok ----- R_Init ----- Cmd_AddCommand: buildcubemaps already defined GL_VENDOR: Tungsten Graphics, Inc GL_RENDERER: Mesa DRI Intel(R) G45/G43 GEM 20091221 DEVELOPMENT x86/MMX/SSE2 GL_VERSION: 2.1 Mesa 7.8-devel GL_EXTENSIONS: GL_ARB_copy_buffer GL_ARB_depth_texture GL_ARB_depth_clamp GL_ARB_draw_buffers GL_ARB_draw_elements_base_vertex GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_map_buffer_range GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_provoking_vertex GL_ARB_seamless_cube_map GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ARB_shading_language_120 GL_ARB_shadow GL_ARB_sync GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_transpose_matrix GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_window_pos GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_logic_op GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_cull_vertex GL_EXT_compiled_vertex_array GL_EXT_copy_texture GL_EXT_draw_buffers2 GL_EXT_draw_range_elements GL_EXT_framebuffer_blit GL_EXT_framebuffer_object GL_EXT_fog_coord GL_EXT_gpu_program_parameters GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_subtexture GL_EXT_texture GL_EXT_texture3D GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod_bias GL_EXT_texture_object GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_swizzle GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_3DFX_texture_compression_FXT1 GL_APPLE_client_storage GL_APPLE_packed_pixels GL_APPLE_vertex_array_object GL_ATI_blend_equation_separate GL_ATI_envmap_bumpmap GL_ATI_texture_env_combine3 GL_ATI_separate_stencil GL_IBM_multimode_draw_arrays GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_INGR_blend_func_separate GL_MESA_pack_invert GL_MESA_texture_signed_rgba GL_MESA_ycbcr_texture GL_MESA_window_pos GL_NV_blend_square GL_NV_depth_clamp GL_NV_light_max_exponent GL_NV_packed_depth_stencil GL_NV_texture_env_combine4 GL_NV_texture_rectangle GL_NV_texgen_reflection GL_NV_vertex_program GL_NV_vertex_program1_1 GL_OES_read_format GL_SGIS_generate_mipmap GL_SGIS_texture_border_clamp GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_SUN_multi_draw_arrays GL_S3_s3tc GL_MAX_TEXTURE_SIZE: 4096 GL_MAX_TEXTURE_UNITS_ARB: 8 GL_SHADING_LANGUAGE_VERSION_ARB: 1.20 GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 4096 GL_MAX_VARYING_FLOATS_ARB 64 GL_MAX_VERTEX_ATTRIBS_ARB 16 64 occlusion query bits GL_MAX_DRAW_BUFFERS_ARB: 4 GL_TEXTURE_MAX_ANISOTROPY_EXT: 16.000000 GL_MAX_RENDERBUFFER_SIZE_EXT: 4096 GL_MAX_COLOR_ATTACHMENTS_EXT: 4 PIXELFORMAT: color(24-bits) Z(24-bit) stencil(8-bits) MODE: 3, 640 x 480 fullscreen hz:N/A GAMMA: hardware w/ 0 overbright bits texturemode: GL_LINEAR_MIPMAP_NEAREST picmip: 1 Using S3TC (DXTC) texture compression ------- GLSL_InitGPUShaders ------- ...loading 'glsl/genericSingle_vp.glsl' ...loading 'glsl/genericSingle_fp.glsl' ...loading 'glsl/vertexLighting_DBS_entity_vp.glsl' ...loading 'glsl/vertexLighting_DBS_entity_fp.glsl' #version 120 #ifndef r_SpecularExponent #define r_SpecularExponent 16.000000 #endif #ifndef r_SpecularScale #define r_SpecularScale 1.400000 #endif #ifndef M_PI #define M_PI 3.14159265358979323846f #endif #ifndef MAX_SHADOWMAPS #define MAX_SHADOWMAPS 5 #endif #ifndef deformGen_t #define deformGen_t #define DGEN_WAVE_SIN 1 #define DGEN_WAVE_SQUARE 2 #define DGEN_WAVE_TRIANGLE 3 #define DGEN_WAVE_SAWTOOTH 4 #define DGEN_WAVE_INVERSE_SAWTOOTH 5 #define DGEN_BULGE 7 #define DGEN_MOVE 8 #endif #ifndef colorGen_t #define colorGen_t #define CGEN_VERTEX 5 #define CGEN_ONE_MINUS_VERTEX 6 #endif #ifndef alphaGen_t #define alphaGen_t #define AGEN_VERTEX 3 #define AGEN_ONE_MINUS_VERTEX 4 #endif #ifndef alphaTest_t #define alphaTest_t #define ATEST_GT_0 1 #define ATEST_LT_128 2 #define ATEST_GE_128 3 #endif #ifndef r_FBufScale #define r_FBufScale vec2(0.001563, 0.002083) #endif #ifndef r_NPOTScale #define r_NPOTScale vec2(1.000000, 1.000000) #endif #ifndef MESA #define MESA 1 #endif #ifndef r_precomputedLighting #define _precomputedLighting 1 #endif #ifndef r_heatHazeFix #define r_heatHazeFix 1 #endif #ifndef r_NormalMapping #define r_NormalMapping 1 #endif #ifndef r_WrapAroundLighting #define r_WrapAroundLighting 0.700000 #endif #ifndef r_halfLambertLighting #define r_halfLambertLighting 1 #endif #line 0 /* =========================================================================== Copyright (C) 2006-2009 Robert Beckebans This file is part of XreaL source code. XreaL source code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. XreaL source code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General ublic License along with XreaL source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ uniform sampler2D u_DiffuseMap; uniform sampler2D u_NormalMap; uniform sampler2D u_SpecularMap; uniform int u_AlphaTest; uniform vec3 u_ViewOrigin; uniform vec3 u_AmbientColor; uniform vec3 u_LightDir; uniform vec3 u_LightColor; uniform float u_SpecularExponent; uniform int u_ParallaxMapping; uniform float u_DepthScale; uniform int u_PortalClipping; uniform vec4 u_PortalPlane; varying vec3 var_Position; varying vec2 var_TexDiffuse; #if defined(r_NormalMapping) varying vec2 var_TexNormal; varying vec2 var_TexSpecular; varying vec3 var_Tangent; varying vec3 var_Binormal; #endif varying vec3 var_Normal; #if defined(r_ParallaxMapping) float RayIntersectDisplaceMap(vec2 dp, vec2 ds) { const int linearSearchSteps = 16; const int binarySearchSteps = 6; f oat depthStep = 1.0 / float(linearSearchSteps); // current size of search window float size = depthStep; // current depth position float depth = 0.0; // best match found (starts with last position 1.0) float bestDepth = 1.0; // search front to back for first point inside object for(int i = 0; i < linearSearchSteps - 1; ++i) { depth += size; vec4 t = texture2D(u_NormalMap, dp + ds * depth); if(bestDepth > 0.996) // if no depth found yet if(depth >= t.w) bestDepth = depth; // store best depth } depth = bestDepth; // recurse around first point (depth) for closest match for(int i = 0; i < binarySearchSteps; ++i) { size *= 0.5; vec4 t = texture2D(u_NormalMap, dp + ds * depth); if(depth >= t.w) #ifdef RM_DOUBLEDEPTH if(depth <= t.z) #endif { bestDepth = depth; depth -= 2.0 * size; } depth += size; } return bestDepth; } #endif void main() { if(bool(u_PortalClipping)) { float dist = dot(var_Position.xyz, u_PortalPlane.xyz) - u_PortalPla e.w; if(dist < 0.0) { discard; return; } } #if defined(r_NormalMapping) // invert tangent space for two sided surfaces mat3 tangentToWorldMatrix; if(gl_FrontFacing) tangentToWorldMatrix = mat3(-var_Tangent.xyz, -var_Binormal.xyz, -var_Normal.xyz); else tangentToWorldMatrix = mat3(var_Tangent.xyz, var_Binormal.xyz, var_Normal.xyz); // compute view direction in world space vec3 I = normalize(u_ViewOrigin - var_Position); #endif vec2 texDiffuse = var_TexDiffuse.st; #if defined(r_NormalMapping) vec2 texNormal = var_TexNormal.st; vec2 texSpecular = var_TexSpecular.st; #endif #if defined(r_ParallaxMapping) if(bool(u_ParallaxMapping)) { // ray intersect in view direction mat3 worldToTangentMatrix; #if defined(GLHW_ATI) || defined(GLHW_ATI_DX10) worldToTangentMatrix = mat3(tangentToWorldMatrix[0][0], tangentToWorldMatrix[1][0], tangentToWorldMatrix[2][0], tangentToWorldMatrix[0][1], tangentToWorldMatrix[1][1], tangentToWorldMatrix[2][1], tangentToWorldM trix[0][2], tangentToWorldMatrix[1][2], tangentToWorldMatrix[2][2]); #else worldToTangentMatrix = transpose(tangentToWorldMatrix); #endif // compute view direction in tangent space vec3 V = worldToTangentMatrix * (u_ViewOrigin - var_Position.xyz); V = normalize(V); // size and start position of search in texture space vec2 S = V.xy * -u_DepthScale / V.z; float depth = RayIntersectDisplaceMap(texNormal, S); // compute texcoords offset vec2 texOffset = S * depth; texDiffuse.st += texOffset; texNormal.st += texOffset; texSpecular.st += texOffset; } #endif // compute the diffuse term vec4 diffuse = texture2D(u_DiffuseMap, texDiffuse); if(u_AlphaTest == ATEST_GT_0 && diffuse.a <= 0.0) { discard; return; } else if(u_AlphaTest == ATEST_LT_128 && diffuse.a >= 0.5) { discard; return; } else if(u_AlphaTest == ATEST_GE_128 && diffuse.a < 0.5) { discard; return; } #if defined(r_NormalMapping) // compute normal in world space from normalmap vec3 N = t ngentToWorldMatrix * (2.0 * (texture2D(u_NormalMap, texNormal).xyz - 0.5)); // compute light direction in world space vec3 L = u_LightDir; // compute half angle in world space vec3 H = normalize(L + I); // compute the specular term vec3 specular = texture2D(u_SpecularMap, texSpecular).rgb * u_LightColor * pow(clamp(dot(N, H), 0.0, 1.0), r_SpecularExponent) * r_SpecularScale; // compute the light term #if defined(r_halfLambertLighting) // http://developer.valvesoftware.com/wiki/Half_Lambert float NL = clamp(dot(N, L), 0.0, 1.0) * 0.5 + 0.5; NL *= NL; #elif defined(r_WrapAroundLighting) float NL = clamp(dot(N, L) + r_WrapAroundLighting, 0.0, 1.0) / clamp(1.0 + r_WrapAroundLighting, 0.0, 1.0); #else float NL = clamp(dot(N, L), 0.0, 1.0); #endif vec3 light = u_AmbientColor + u_LightColor * NL; clamp(light, 0.0, 1.0); // compute final color vec4 color = diffuse; color.rgb *= light; color.rgb += specular; gl_FragColor = color; #else vec3 N; if(gl_FrontFacing) N = -normalize(v r_Normal); else N = normalize(var_Normal); vec3 L = u_LightDir; gl_FragColor = vec4(diffuse.rgb * (u_AmbientColor + u_LightColor * clamp(dot(N, L), 0.0, 1.0)), diffuse.a); #endif } compile log: Error: declaration of 'NL' conflicts with previous declaration ----- CL_Shutdown ----- RE_Shutdown( destroyWindow = 1 ) ...shutting down QGL ----------------------- recursive error after: Couldn't compile glsl/vertexLighting_DBS_entity_fp.glsl