Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OpenJK-MP: v1.0.1.0 linux-x86_64 Mar 6 2018
- ----- FS_Startup -----
- Current search path:
- /home/monsterovich/.local/share/openjk/base
- ./base/assets3.pk3 (16 files)
- ./base/assets2.pk3 (62 files)
- ./base/assets1.pk3 (8320 files)
- ./base/assets0.pk3 (15346 files)
- ./base
- ----------------------
- 23744 files in pk3 files
- execing mpdefault.cfg
- execing openjk.cfg
- couldn't exec autoexec.cfg
- ----- Initializing Renderer ----
- Trying to load "rd-rend2_x86_64.so" from "."...
- QKEY found.
- ----- R_Init -----
- SDL using driver "x11"
- Initializing display
- Display aspect: 1.779
- ...setting mode -1: 1366 768
- Using 24 color bits, 24 depth, 8 stencil display.
- Available modes: '640x360 720x405 864x486 960x540 1024x576 1366x768 680x384 640x480 800x600 1024x768'
- Initializing OpenGL 3.2 functions
- ...using GLSL version 4.50
- GL_RENDERER: Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2)
- Initializing OpenGL extensions
- ...GL_S3_s3tc available
- ...ignoring texture compression
- ...GL_EXT_texture_filter_anisotropic available
- ...using GL_EXT_texture_filter_anisotropic
- ...GL_EXT_texture_compression_latc not found
- ...ignoring GL_ARB_texture_compression_bptc
- ...using GL_ARB_texture_storage
- ...ignoring GL_ARB_buffer_storage
- ...ignoring GL_ARB_debug_output
- ...using GL_ARB_timer_query
- ------- R_InitVBOs -------
- ------- FBO_Init -------
- ------- GLSL_InitGPUShaders -------
- #version 150 core
- #ifndef M_PI
- #define M_PI 3.14159265358979323846
- #endif
- #ifndef deformGen_t
- #define deformGen_t
- #define DEFORM_NONE 0
- #define DEFORM_WAVE 1
- #define DEFORM_NORMALS 2
- #define DEFORM_BULGE 3
- #define DEFORM_MOVE 4
- #define DEFORM_PROJECTION_SHADOW 5
- #define WF_NONE 0
- #define WF_SIN 1
- #define WF_SQUARE 2
- #define WF_TRIANGLE 3
- #define WF_SAWTOOTH 4
- #define WF_INVERSE_SAWTOOTH 5
- #endif
- #ifndef tcGen_t
- #define tcGen_t
- #define TCGEN_LIGHTMAP 2
- #define TCGEN_LIGHTMAP1 3
- #define TCGEN_LIGHTMAP2 4
- #define TCGEN_LIGHTMAP3 5
- #define TCGEN_TEXTURE 6
- #define TCGEN_ENVIRONMENT_MAPPED 7
- #define TCGEN_FOG 8
- #define TCGEN_VECTOR 9
- #endif
- #ifndef colorGen_t
- #define colorGen_t
- #define CGEN_LIGHTING_DIFFUSE 11
- #endif
- #ifndef alphaGen_t
- #define alphaGen_t
- #define AGEN_LIGHTING_SPECULAR 6
- #define AGEN_PORTAL 8
- #endif
- #ifndef texenv_t
- #define texenv_t
- #define TEXENV_MODULATE 8448
- #define TEXENV_ADD 260
- #define TEXENV_REPLACE 7681
- #endif
- #define ALPHA_TEST_GT0 1
- #define ALPHA_TEST_LT128 2
- #define ALPHA_TEST_GE128 3
- #d
- efine ALPHA_TEST_GE192 4
- #ifndef r_FBufScale
- #define r_FBufScale vec2(0.000732, 0.001302)
- #endif
- #line 1
- in vec3 attr_Position;
- in vec3 attr_Normal;
- in vec2 attr_TexCoord0;
- #if defined(USE_VERTEX_ANIMATION)
- in vec3 attr_Position2;
- in vec3 attr_Normal2;
- #elif defined(USE_SKELETAL_ANIMATION)
- in uvec4 attr_BoneIndexes;
- in vec4 attr_BoneWeights;
- #endif
- #if defined(USE_DEFORM_VERTEXES)
- uniform int u_DeformType;
- uniform int u_DeformFunc;
- uniform float u_DeformParams[7];
- #endif
- uniform float u_Time;
- uniform mat4 u_ModelMatrix;
- uniform mat4 u_ModelViewProjectionMatrix;
- #if defined(USE_VERTEX_ANIMATION)
- uniform float u_VertexLerp;
- #elif defined(USE_SKELETAL_ANIMATION)
- uniform mat4x3 u_BoneMatrices[20];
- #endif
- uniform vec4 u_Color;
- out vec3 var_WSPosition;
- #if defined(USE_DEFORM_VERTEXES)
- float GetNoiseValue( float x, float y, float z, float t )
- {
- // Variation on the 'one-liner random function'.
- // Not sure if this is still 'correctly' random
- return fract( sin( dot(
- vec4( x, y, z, t ),
- vec4( 12.9898, 78
- .233, 12.9898, 78.233 )
- )) * 43758.5453 );
- }
- float CalculateDeformScale( in int func, in float time, in float phase, in float frequency )
- {
- float value = phase + time * frequency;
- switch ( func )
- {
- case WF_SIN:
- return sin(value * 2.0 * M_PI);
- case WF_SQUARE:
- return sign(0.5 - fract(value));
- case WF_TRIANGLE:
- return abs(fract(value + 0.75) - 0.5) * 4.0 - 1.0;
- case WF_SAWTOOTH:
- return fract(value);
- case WF_INVERSE_SAWTOOTH:
- return 1.0 - fract(value);
- default:
- return 0.0;
- }
- }
- vec3 DeformPosition(const vec3 pos, const vec3 normal, const vec2 st)
- {
- switch ( u_DeformType )
- {
- default:
- {
- return pos;
- }
- case DEFORM_BULGE:
- {
- float bulgeHeight = u_DeformParams[1]; // amplitude
- float bulgeWidth = u_DeformParams[2]; // phase
- float bulgeSpeed = u_DeformParams[3]; // frequency
- float scale = CalculateDeformScale( WF_SIN, u_Time, bulgeWidth * st.x, bulgeSpeed );
- return pos + normal * scale * bulgeHeight;
- }
- case DEFORM_WAVE:
- {
- float base = u_Defor
- mParams[0];
- float amplitude = u_DeformParams[1];
- float phase = u_DeformParams[2];
- float frequency = u_DeformParams[3];
- float spread = u_DeformParams[4];
- float offset = dot( pos.xyz, vec3( spread ) );
- float scale = CalculateDeformScale( u_DeformFunc, u_Time, phase + offset, frequency );
- return pos + normal * (base + scale * amplitude);
- }
- case DEFORM_MOVE:
- {
- float base = u_DeformParams[0];
- float amplitude = u_DeformParams[1];
- float phase = u_DeformParams[2];
- float frequency = u_DeformParams[3];
- vec3 direction = vec3( u_DeformParams[4], u_DeformParams[5], u_DeformParams[6] );
- float scale = CalculateDeformScale( u_DeformFunc, u_Time, phase, frequency );
- return pos + direction * (base + scale * amplitude);
- }
- case DEFORM_PROJECTION_SHADOW:
- {
- vec3 ground = vec3(
- u_DeformParams[0],
- u_DeformParams[1],
- u_DeformParams[2]);
- float groundDist = u_DeformParams[3];
- vec3 lightDir = vec3(
- u_DeformParams[4],
- u_DeformParams[5],
- u_Deform
- Params[6]);
- float d = dot( lightDir, ground );
- lightDir = lightDir * max( 0.5 - d, 0.0 ) + ground;
- d = 1.0 / dot( lightDir, ground );
- vec3 lightPos = lightDir * d;
- return pos - lightPos * dot( pos, ground ) + groundDist;
- }
- }
- }
- vec3 DeformNormal( const in vec3 position, const in vec3 normal )
- {
- if ( u_DeformType != DEFORM_NORMALS )
- {
- return normal;
- }
- float amplitude = u_DeformParams[1];
- float frequency = u_DeformParams[3];
- vec3 outNormal = normal;
- const float scale = 0.98;
- outNormal.x += amplitude * GetNoiseValue(
- position.x * scale,
- position.y * scale,
- position.z * scale,
- u_Time * frequency );
- outNormal.y += amplitude * GetNoiseValue(
- 100.0 * position.x * scale,
- position.y * scale,
- position.z * scale,
- u_Time * frequency );
- outNormal.z += amplitude * GetNoiseValue(
- 200.0 * position.x * scale,
- position.y * scale,
- position.z * scale,
- u_Time * frequency );
- return outNormal;
- }
- #endif
- void main()
- {
- #if defined(USE_VERTEX_ANIMATION)
- vec3 position
- = mix(attr_Position, attr_Position2, u_VertexLerp);
- vec3 normal = mix(attr_Normal, attr_Normal2, u_VertexLerp);
- normal = normalize(normal - vec3(0.5));
- #elif defined(USE_SKELETAL_ANIMATION)
- vec4 position4 = vec4(0.0);
- vec4 normal4 = vec4(0.0);
- vec4 originalPosition = vec4(attr_Position, 1.0);
- vec4 originalNormal = vec4(attr_Normal - vec3 (0.5), 0.0);
- for (int i = 0; i < 4; i++)
- {
- uint boneIndex = attr_BoneIndexes[i];
- mat4 boneMatrix = mat4(
- vec4(u_BoneMatrices[boneIndex][0], 0.0),
- vec4(u_BoneMatrices[boneIndex][1], 0.0),
- vec4(u_BoneMatrices[boneIndex][2], 0.0),
- vec4(u_BoneMatrices[boneIndex][3], 1.0)
- );
- position4 += (boneMatrix * originalPosition) * attr_BoneWeights[i];
- normal4 += (boneMatrix * originalNormal) * attr_BoneWeights[i];
- }
- vec3 position = position4.xyz;
- vec3 normal = normalize(normal4.xyz);
- #else
- vec3 position = attr_Position;
- vec3 normal = attr_Normal * 2.0 - vec3(1.0);
- #endif
- #if defined(USE_DEFORM_VERTEXES)
- position = DeformPosition(position, no
- rmal, attr_TexCoord0.st);
- normal = DeformNormal( position, normal );
- #endif
- gl_Position = u_ModelViewProjectionMatrix * vec4(position, 1.0);
- var_WSPosition = (u_ModelMatrix * vec4(position, 1.0)).xyz;
- }
- cubeLightColuniform vec4 u_Color;
- #if defined(USE_ALPHA_TEST)
- uniform int u_AlphaTestType;
- #endif
- uniform vec4 u_FogPlane;
- uniform float u_FogDepthToOpaque;
- uniform bool u_FogHasPlane;
- uniform vec3 u_ViewOrigin;
- in vec3 var_WSPosition;
- out vec4 out_Color;
- out vec4 out_Glow;
- float CalcFog(in vec3 viewOrigin, in vec3 position, in vec4 fogPlane, in float depthToOpaque, in bool hasPlane)
- {
- // line: x = o + tv
- // plane: (x . n) + d = 0
- // intersects: dot(o + tv, n) + d = 0
- // dot(o + tv, n) = -d
- // dot(o, n) + t*dot(n, v) = -d
- // t = -(d + dot(o, n)) / dot(n, v)
- vec3 V = position - viewOrigin;
- // fogPlane is inverted in tr_bsp for some reason.
- float t = -(fogPlane.w + dot(viewOrigin, -fogPlane.xyz)) / dot(V, -fogPlane.xyz);
- bool inFog = ((dot(viewOrigin, fo
- gPlane.xyz) - fogPlane.w) >= 0.0) || !hasPlane;
- bool intersects = (t > 0.0 && t <= 1.0);
- // this is valid only when t > 0.0. When t < 0.0, then intersection point is behind
- // the camera, meaning we're facing away from the fog plane, which probably means
- // we're inside the fog volume.
- vec3 intersectsAt = viewOrigin + t*V;
- float distToVertexFromIntersection = distance(intersectsAt, position);
- float distToVertexFromViewOrigin = distance(viewOrigin, position);
- float distToVertex = mix(distToVertexFromViewOrigin,
- distToVertexFromIntersection,
- !inFog && intersects);
- float z = depthToOpaque * distToVertex;
- return 1.0 - clamp(exp(-(z * z)), 0.0, 1.0);
- }
- void main()
- {
- float fog = CalcFog(u_ViewOrigin, var_WSPosition, u_FogPlane, u_FogDepthToOpaque, u_FogHasPlane);
- out_Color.rgb = u_Color.rgb;
- out_Color.a = sqrt(clamp(fog, 0.0, 1.0));
- #if defined(USE_ALPHA_TEST)
- if (u_AlphaTestType == ALPHA_TEST_GT0)
- {
- if (out_Color.a == 0.0)
- discard;
- }
- else if (u_AlphaTestType == ALPHA_TE
- ST_LT128)
- {
- if (out_Color.a >= 0.5)
- discard;
- }
- else if (u_AlphaTestType == ALPHA_TEST_GE128)
- {
- if (out_Color.a < 0.5)
- discard;
- }
- else if (u_AlphaTestType == ALPHA_TEST_GE192)
- {
- if (out_Color.a < 0.75)
- discard;
- }
- #endif
- #if defined(USE_GLOW_BUFFER)
- out_Glow = out_Color;
- #else
- out_Glow = vec4(0.0);
- #endif
- }
- ec3 (0.0);
- attenuation = 1.0;
- #elif defined(USE_LIGHT_VECTOR)
- lightColor = u_DirectedLight * var_Color.rgb;
- ambientColor = u_AmbientLight * var_Color.rgb;
- attenuation = CalcLightAttenuation(float(var_LightDir.w > 0.0), var_LightDir.w / sqrLightDist);
- #elif defined(USE_LIGHT_VERTEX)
- lightColor = var_Color.rgb;
- ambientColor = vec3 (0.0);
- attenuation = 1.0;
- #endif
- N = CalcNormal(var_Normal.xyz, texCoords, tangentToWorld);
- L /= sqrt(sqrLightDist);
- #if defined(USE_SHADOWMAP)
- vec2 shadowTex = gl_FragCoord.xy * r_FBufScale;
- float shadowValue = texture(u_ShadowMap, shadowTex).r;
- // surfaces not facing the light are always shadowed
- vec3 primaryLightDir = normalize(va
- r_PrimaryLightDir.xyz);
- shadowValue = mix(0.0, shadowValue, dot(N, primaryLightDir) > 0.0);
- #if defined(SHADOWMAP_MODULATE)
- lightColor = mix(u_PrimaryLightAmbient * lightColor, lightColor, shadowValue);
- #endif
- #endif
- #if defined(USE_LIGHTMAP) || defined(USE_LIGHT_VERTEX)
- ambientColor = lightColor;
- float surfNL = clamp(dot(N, L), 0.0, 1.0);
- // Scale the incoming light to compensate for the baked-in light angle
- // attenuation.
- lightColor /= max(surfNL, 0.25);
- // Recover any unused light as ambient, in case attenuation is over 4x or
- // light is below the surface
- ambientColor = clamp(ambientColor - lightColor * surfNL, 0.0, 1.0);
- #endif
- vec4 specular = vec4(1.0);
- #if defined(USE_SPECULARMAP)
- specular = texture(u_SpecularMap, texCoords);
- //specular.rgb = sRGBToLinear(specular.rgb);
- #endif
- specular *= u_SpecularScale;
- // diffuse is actually base color, and red of specular is metalness
- const vec3 DIELECTRIC_SPECULAR = vec3(0.04);
- const vec3 METAL_DIFFUSE = vec3(0.0);
- float metalness = specular.r;
- float roughness = max(specular.a, 0.02);
- specular.rgb = mix(DIELECTRIC_SPECULAR, diffuse.rgb, metalness);
- diffuse.rgb = mix(diffuse.rgb, METAL_DIFFUSE, metalness);
- vec3 H = normalize(L + E);
- float NE = abs(dot(N, E)) + 1e-5;
- float NL = clamp(dot(N, L), 0.0, 1.0);
- float LH = clamp(dot(L, H), 0.0, 1.0);
- vec3 Fd = CalcDiffuse(diffuse.rgb, NE, NL, LH, roughness);
- vec3 Fs = vec3(0.0);
- #if defined(USE_LIGHT_VECTOR)
- float NH = clamp(dot(N, H), 0.0, 1.0);
- Fs = CalcSpecular(specular.rgb, NH, NL, NE, LH, roughness);
- #endif
- vec3 reflectance = Fd + Fs;
- out_Color.rgb = lightColor * reflectance * (attenuation * NL);
- out_Color.rgb += ambientColor * diffuse.rgb;
- #if defined(USE_PRIMARY_LIGHT)
- vec3 L2 = normalize(var_PrimaryLightDir.xyz);
- vec3 H2 = normalize(L2 + E);
- float NL2 = clamp(dot(N, L2), 0.0, 1.0);
- float L2H2 = clamp(dot(L2, H2), 0.0, 1.0);
- float NH2 = clamp(dot(N, H2), 0.0, 1.0);
- reflectance = CalcDiffuse(diffuse.rgb, NE, N
- L2, L2H2, roughness);
- reflectance += CalcSpecular(specular.rgb, NH2, NL2, NE, L2H2, roughness);
- lightColor = u_PrimaryLightColor * var_Color.rgb;
- #if defined(USE_SHADOWMAP)
- lightColor *= shadowValue;
- #endif
- out_Color.rgb += lightColor * reflectance * NL2;
- #endif
- out_Color.rgb += CalcIBLContribution(roughness, N, E, viewDir, NE, specular.rgb);
- #else
- lightColor = var_Color.rgb;
- #if defined(USE_LIGHTMAP)
- lightColor *= lightmapColor.rgb;
- #endif
- out_Color.rgb = diffuse.rgb * lightColor;
- #endif
- out_Color.a = diffuse.a * var_Color.a;
- #if defined(USE_GLOW_BUFFER)
- out_Glow = out_Color;
- #else
- out_Glow = vec4(0.0);
- #endif
- }
- compile log:
- 0:299(3): preprocessor error: #elif without #if
- 0:303(3): preprocessor error: #elif without #if
- 0:307(3): preprocessor error: #endif without #if
- 0:393(1): preprocessor error: #else without #if
- 0:400(1): preprocessor error: #endif without #if
- RE_Shutdown( 1 )
- Couldn't compile shaderAutomatically freeing 3345 blocks making up 2859096 bytes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement