Guest User

Untitled

a guest
Mar 6th, 2018
253
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. OpenJK-MP: v1.0.1.0 linux-x86_64 Mar 6 2018
  2. ----- FS_Startup -----
  3. Current search path:
  4. /home/monsterovich/.local/share/openjk/base
  5. ./base/assets3.pk3 (16 files)
  6. ./base/assets2.pk3 (62 files)
  7. ./base/assets1.pk3 (8320 files)
  8. ./base/assets0.pk3 (15346 files)
  9. ./base
  10.  
  11. ----------------------
  12. 23744 files in pk3 files
  13. execing mpdefault.cfg
  14. execing openjk.cfg
  15. couldn't exec autoexec.cfg
  16. ----- Initializing Renderer ----
  17. Trying to load "rd-rend2_x86_64.so" from "."...
  18. QKEY found.
  19. ----- R_Init -----
  20. SDL using driver "x11"
  21. Initializing display
  22. Display aspect: 1.779
  23. ...setting mode -1: 1366 768
  24. Using 24 color bits, 24 depth, 8 stencil display.
  25. Available modes: '640x360 720x405 864x486 960x540 1024x576 1366x768 680x384 640x480 800x600 1024x768'
  26. Initializing OpenGL 3.2 functions
  27. ...using GLSL version 4.50
  28. GL_RENDERER: Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2)
  29. Initializing OpenGL extensions
  30. ...GL_S3_s3tc available
  31. ...ignoring texture compression
  32. ...GL_EXT_texture_filter_anisotropic available
  33. ...using GL_EXT_texture_filter_anisotropic
  34. ...GL_EXT_texture_compression_latc not found
  35. ...ignoring GL_ARB_texture_compression_bptc
  36. ...using GL_ARB_texture_storage
  37. ...ignoring GL_ARB_buffer_storage
  38. ...ignoring GL_ARB_debug_output
  39. ...using GL_ARB_timer_query
  40. ------- R_InitVBOs -------
  41. ------- FBO_Init -------
  42. ------- GLSL_InitGPUShaders -------
  43. #version 150 core
  44. #ifndef M_PI
  45. #define M_PI 3.14159265358979323846
  46. #endif
  47. #ifndef deformGen_t
  48. #define deformGen_t
  49. #define DEFORM_NONE 0
  50. #define DEFORM_WAVE 1
  51. #define DEFORM_NORMALS 2
  52. #define DEFORM_BULGE 3
  53. #define DEFORM_MOVE 4
  54. #define DEFORM_PROJECTION_SHADOW 5
  55. #define WF_NONE 0
  56. #define WF_SIN 1
  57. #define WF_SQUARE 2
  58. #define WF_TRIANGLE 3
  59. #define WF_SAWTOOTH 4
  60. #define WF_INVERSE_SAWTOOTH 5
  61. #endif
  62. #ifndef tcGen_t
  63. #define tcGen_t
  64. #define TCGEN_LIGHTMAP 2
  65. #define TCGEN_LIGHTMAP1 3
  66. #define TCGEN_LIGHTMAP2 4
  67. #define TCGEN_LIGHTMAP3 5
  68. #define TCGEN_TEXTURE 6
  69. #define TCGEN_ENVIRONMENT_MAPPED 7
  70. #define TCGEN_FOG 8
  71. #define TCGEN_VECTOR 9
  72. #endif
  73. #ifndef colorGen_t
  74. #define colorGen_t
  75. #define CGEN_LIGHTING_DIFFUSE 11
  76. #endif
  77. #ifndef alphaGen_t
  78. #define alphaGen_t
  79. #define AGEN_LIGHTING_SPECULAR 6
  80. #define AGEN_PORTAL 8
  81. #endif
  82. #ifndef texenv_t
  83. #define texenv_t
  84. #define TEXENV_MODULATE 8448
  85. #define TEXENV_ADD 260
  86. #define TEXENV_REPLACE 7681
  87. #endif
  88. #define ALPHA_TEST_GT0 1
  89. #define ALPHA_TEST_LT128 2
  90. #define ALPHA_TEST_GE128 3
  91. #d
  92. efine ALPHA_TEST_GE192 4
  93. #ifndef r_FBufScale
  94. #define r_FBufScale vec2(0.000732, 0.001302)
  95. #endif
  96. #line 1
  97. in vec3 attr_Position;
  98. in vec3 attr_Normal;
  99.  
  100. in vec2 attr_TexCoord0;
  101.  
  102. #if defined(USE_VERTEX_ANIMATION)
  103. in vec3 attr_Position2;
  104. in vec3 attr_Normal2;
  105. #elif defined(USE_SKELETAL_ANIMATION)
  106. in uvec4 attr_BoneIndexes;
  107. in vec4 attr_BoneWeights;
  108. #endif
  109.  
  110. #if defined(USE_DEFORM_VERTEXES)
  111. uniform int u_DeformType;
  112. uniform int u_DeformFunc;
  113. uniform float u_DeformParams[7];
  114. #endif
  115.  
  116. uniform float u_Time;
  117. uniform mat4 u_ModelMatrix;
  118. uniform mat4 u_ModelViewProjectionMatrix;
  119.  
  120. #if defined(USE_VERTEX_ANIMATION)
  121. uniform float u_VertexLerp;
  122. #elif defined(USE_SKELETAL_ANIMATION)
  123. uniform mat4x3 u_BoneMatrices[20];
  124. #endif
  125.  
  126. uniform vec4 u_Color;
  127.  
  128. out vec3 var_WSPosition;
  129.  
  130. #if defined(USE_DEFORM_VERTEXES)
  131. float GetNoiseValue( float x, float y, float z, float t )
  132. {
  133. // Variation on the 'one-liner random function'.
  134. // Not sure if this is still 'correctly' random
  135. return fract( sin( dot(
  136. vec4( x, y, z, t ),
  137. vec4( 12.9898, 78
  138. .233, 12.9898, 78.233 )
  139. )) * 43758.5453 );
  140. }
  141.  
  142. float CalculateDeformScale( in int func, in float time, in float phase, in float frequency )
  143. {
  144. float value = phase + time * frequency;
  145.  
  146. switch ( func )
  147. {
  148. case WF_SIN:
  149. return sin(value * 2.0 * M_PI);
  150. case WF_SQUARE:
  151. return sign(0.5 - fract(value));
  152. case WF_TRIANGLE:
  153. return abs(fract(value + 0.75) - 0.5) * 4.0 - 1.0;
  154. case WF_SAWTOOTH:
  155. return fract(value);
  156. case WF_INVERSE_SAWTOOTH:
  157. return 1.0 - fract(value);
  158. default:
  159. return 0.0;
  160. }
  161. }
  162.  
  163. vec3 DeformPosition(const vec3 pos, const vec3 normal, const vec2 st)
  164. {
  165. switch ( u_DeformType )
  166. {
  167. default:
  168. {
  169. return pos;
  170. }
  171.  
  172. case DEFORM_BULGE:
  173. {
  174. float bulgeHeight = u_DeformParams[1]; // amplitude
  175. float bulgeWidth = u_DeformParams[2]; // phase
  176. float bulgeSpeed = u_DeformParams[3]; // frequency
  177.  
  178. float scale = CalculateDeformScale( WF_SIN, u_Time, bulgeWidth * st.x, bulgeSpeed );
  179.  
  180. return pos + normal * scale * bulgeHeight;
  181. }
  182.  
  183. case DEFORM_WAVE:
  184. {
  185. float base = u_Defor
  186. mParams[0];
  187. float amplitude = u_DeformParams[1];
  188. float phase = u_DeformParams[2];
  189. float frequency = u_DeformParams[3];
  190. float spread = u_DeformParams[4];
  191.  
  192. float offset = dot( pos.xyz, vec3( spread ) );
  193. float scale = CalculateDeformScale( u_DeformFunc, u_Time, phase + offset, frequency );
  194.  
  195. return pos + normal * (base + scale * amplitude);
  196. }
  197.  
  198. case DEFORM_MOVE:
  199. {
  200. float base = u_DeformParams[0];
  201. float amplitude = u_DeformParams[1];
  202. float phase = u_DeformParams[2];
  203. float frequency = u_DeformParams[3];
  204. vec3 direction = vec3( u_DeformParams[4], u_DeformParams[5], u_DeformParams[6] );
  205.  
  206. float scale = CalculateDeformScale( u_DeformFunc, u_Time, phase, frequency );
  207.  
  208. return pos + direction * (base + scale * amplitude);
  209. }
  210.  
  211. case DEFORM_PROJECTION_SHADOW:
  212. {
  213. vec3 ground = vec3(
  214. u_DeformParams[0],
  215. u_DeformParams[1],
  216. u_DeformParams[2]);
  217. float groundDist = u_DeformParams[3];
  218. vec3 lightDir = vec3(
  219. u_DeformParams[4],
  220. u_DeformParams[5],
  221. u_Deform
  222. Params[6]);
  223.  
  224. float d = dot( lightDir, ground );
  225.  
  226. lightDir = lightDir * max( 0.5 - d, 0.0 ) + ground;
  227. d = 1.0 / dot( lightDir, ground );
  228.  
  229. vec3 lightPos = lightDir * d;
  230.  
  231. return pos - lightPos * dot( pos, ground ) + groundDist;
  232. }
  233. }
  234. }
  235.  
  236. vec3 DeformNormal( const in vec3 position, const in vec3 normal )
  237. {
  238. if ( u_DeformType != DEFORM_NORMALS )
  239. {
  240. return normal;
  241. }
  242.  
  243. float amplitude = u_DeformParams[1];
  244. float frequency = u_DeformParams[3];
  245.  
  246. vec3 outNormal = normal;
  247. const float scale = 0.98;
  248.  
  249. outNormal.x += amplitude * GetNoiseValue(
  250. position.x * scale,
  251. position.y * scale,
  252. position.z * scale,
  253. u_Time * frequency );
  254.  
  255. outNormal.y += amplitude * GetNoiseValue(
  256. 100.0 * position.x * scale,
  257. position.y * scale,
  258. position.z * scale,
  259. u_Time * frequency );
  260.  
  261. outNormal.z += amplitude * GetNoiseValue(
  262. 200.0 * position.x * scale,
  263. position.y * scale,
  264. position.z * scale,
  265. u_Time * frequency );
  266.  
  267. return outNormal;
  268. }
  269. #endif
  270.  
  271. void main()
  272. {
  273. #if defined(USE_VERTEX_ANIMATION)
  274. vec3 position
  275. = mix(attr_Position, attr_Position2, u_VertexLerp);
  276. vec3 normal = mix(attr_Normal, attr_Normal2, u_VertexLerp);
  277. normal = normalize(normal - vec3(0.5));
  278. #elif defined(USE_SKELETAL_ANIMATION)
  279. vec4 position4 = vec4(0.0);
  280. vec4 normal4 = vec4(0.0);
  281. vec4 originalPosition = vec4(attr_Position, 1.0);
  282. vec4 originalNormal = vec4(attr_Normal - vec3 (0.5), 0.0);
  283.  
  284. for (int i = 0; i < 4; i++)
  285. {
  286. uint boneIndex = attr_BoneIndexes[i];
  287.  
  288. mat4 boneMatrix = mat4(
  289. vec4(u_BoneMatrices[boneIndex][0], 0.0),
  290. vec4(u_BoneMatrices[boneIndex][1], 0.0),
  291. vec4(u_BoneMatrices[boneIndex][2], 0.0),
  292. vec4(u_BoneMatrices[boneIndex][3], 1.0)
  293. );
  294.  
  295. position4 += (boneMatrix * originalPosition) * attr_BoneWeights[i];
  296. normal4 += (boneMatrix * originalNormal) * attr_BoneWeights[i];
  297. }
  298.  
  299. vec3 position = position4.xyz;
  300. vec3 normal = normalize(normal4.xyz);
  301. #else
  302. vec3 position = attr_Position;
  303. vec3 normal = attr_Normal * 2.0 - vec3(1.0);
  304. #endif
  305.  
  306. #if defined(USE_DEFORM_VERTEXES)
  307. position = DeformPosition(position, no
  308. rmal, attr_TexCoord0.st);
  309. normal = DeformNormal( position, normal );
  310. #endif
  311.  
  312. gl_Position = u_ModelViewProjectionMatrix * vec4(position, 1.0);
  313.  
  314. var_WSPosition = (u_ModelMatrix * vec4(position, 1.0)).xyz;
  315. }
  316.  
  317. cubeLightColuniform vec4 u_Color;
  318. #if defined(USE_ALPHA_TEST)
  319. uniform int u_AlphaTestType;
  320. #endif
  321.  
  322. uniform vec4 u_FogPlane;
  323. uniform float u_FogDepthToOpaque;
  324. uniform bool u_FogHasPlane;
  325. uniform vec3 u_ViewOrigin;
  326. in vec3 var_WSPosition;
  327.  
  328. out vec4 out_Color;
  329. out vec4 out_Glow;
  330.  
  331. float CalcFog(in vec3 viewOrigin, in vec3 position, in vec4 fogPlane, in float depthToOpaque, in bool hasPlane)
  332. {
  333. // line: x = o + tv
  334. // plane: (x . n) + d = 0
  335. // intersects: dot(o + tv, n) + d = 0
  336. // dot(o + tv, n) = -d
  337. // dot(o, n) + t*dot(n, v) = -d
  338. // t = -(d + dot(o, n)) / dot(n, v)
  339. vec3 V = position - viewOrigin;
  340.  
  341. // fogPlane is inverted in tr_bsp for some reason.
  342. float t = -(fogPlane.w + dot(viewOrigin, -fogPlane.xyz)) / dot(V, -fogPlane.xyz);
  343.  
  344. bool inFog = ((dot(viewOrigin, fo
  345. gPlane.xyz) - fogPlane.w) >= 0.0) || !hasPlane;
  346. bool intersects = (t > 0.0 && t <= 1.0);
  347.  
  348. // this is valid only when t > 0.0. When t < 0.0, then intersection point is behind
  349. // the camera, meaning we're facing away from the fog plane, which probably means
  350. // we're inside the fog volume.
  351. vec3 intersectsAt = viewOrigin + t*V;
  352.  
  353. float distToVertexFromIntersection = distance(intersectsAt, position);
  354. float distToVertexFromViewOrigin = distance(viewOrigin, position);
  355.  
  356. float distToVertex = mix(distToVertexFromViewOrigin,
  357. distToVertexFromIntersection,
  358. !inFog && intersects);
  359.  
  360. float z = depthToOpaque * distToVertex;
  361. return 1.0 - clamp(exp(-(z * z)), 0.0, 1.0);
  362. }
  363.  
  364. void main()
  365. {
  366. float fog = CalcFog(u_ViewOrigin, var_WSPosition, u_FogPlane, u_FogDepthToOpaque, u_FogHasPlane);
  367. out_Color.rgb = u_Color.rgb;
  368. out_Color.a = sqrt(clamp(fog, 0.0, 1.0));
  369.  
  370. #if defined(USE_ALPHA_TEST)
  371. if (u_AlphaTestType == ALPHA_TEST_GT0)
  372. {
  373. if (out_Color.a == 0.0)
  374. discard;
  375. }
  376. else if (u_AlphaTestType == ALPHA_TE
  377. ST_LT128)
  378. {
  379. if (out_Color.a >= 0.5)
  380. discard;
  381. }
  382. else if (u_AlphaTestType == ALPHA_TEST_GE128)
  383. {
  384. if (out_Color.a < 0.5)
  385. discard;
  386. }
  387. else if (u_AlphaTestType == ALPHA_TEST_GE192)
  388. {
  389. if (out_Color.a < 0.75)
  390. discard;
  391. }
  392. #endif
  393.  
  394. #if defined(USE_GLOW_BUFFER)
  395. out_Glow = out_Color;
  396. #else
  397. out_Glow = vec4(0.0);
  398. #endif
  399. }
  400. ec3 (0.0);
  401. attenuation = 1.0;
  402. #elif defined(USE_LIGHT_VECTOR)
  403. lightColor = u_DirectedLight * var_Color.rgb;
  404. ambientColor = u_AmbientLight * var_Color.rgb;
  405. attenuation = CalcLightAttenuation(float(var_LightDir.w > 0.0), var_LightDir.w / sqrLightDist);
  406. #elif defined(USE_LIGHT_VERTEX)
  407. lightColor = var_Color.rgb;
  408. ambientColor = vec3 (0.0);
  409. attenuation = 1.0;
  410. #endif
  411.  
  412. N = CalcNormal(var_Normal.xyz, texCoords, tangentToWorld);
  413. L /= sqrt(sqrLightDist);
  414.  
  415. #if defined(USE_SHADOWMAP)
  416. vec2 shadowTex = gl_FragCoord.xy * r_FBufScale;
  417. float shadowValue = texture(u_ShadowMap, shadowTex).r;
  418.  
  419. // surfaces not facing the light are always shadowed
  420. vec3 primaryLightDir = normalize(va
  421. r_PrimaryLightDir.xyz);
  422. shadowValue = mix(0.0, shadowValue, dot(N, primaryLightDir) > 0.0);
  423.  
  424. #if defined(SHADOWMAP_MODULATE)
  425. lightColor = mix(u_PrimaryLightAmbient * lightColor, lightColor, shadowValue);
  426. #endif
  427. #endif
  428.  
  429. #if defined(USE_LIGHTMAP) || defined(USE_LIGHT_VERTEX)
  430. ambientColor = lightColor;
  431. float surfNL = clamp(dot(N, L), 0.0, 1.0);
  432.  
  433. // Scale the incoming light to compensate for the baked-in light angle
  434. // attenuation.
  435. lightColor /= max(surfNL, 0.25);
  436.  
  437. // Recover any unused light as ambient, in case attenuation is over 4x or
  438. // light is below the surface
  439. ambientColor = clamp(ambientColor - lightColor * surfNL, 0.0, 1.0);
  440. #endif
  441.  
  442. vec4 specular = vec4(1.0);
  443. #if defined(USE_SPECULARMAP)
  444. specular = texture(u_SpecularMap, texCoords);
  445. //specular.rgb = sRGBToLinear(specular.rgb);
  446. #endif
  447. specular *= u_SpecularScale;
  448.  
  449. // diffuse is actually base color, and red of specular is metalness
  450. const vec3 DIELECTRIC_SPECULAR = vec3(0.04);
  451. const vec3 METAL_DIFFUSE = vec3(0.0);
  452.  
  453.  
  454. float metalness = specular.r;
  455. float roughness = max(specular.a, 0.02);
  456. specular.rgb = mix(DIELECTRIC_SPECULAR, diffuse.rgb, metalness);
  457. diffuse.rgb = mix(diffuse.rgb, METAL_DIFFUSE, metalness);
  458.  
  459. vec3 H = normalize(L + E);
  460. float NE = abs(dot(N, E)) + 1e-5;
  461. float NL = clamp(dot(N, L), 0.0, 1.0);
  462. float LH = clamp(dot(L, H), 0.0, 1.0);
  463.  
  464. vec3 Fd = CalcDiffuse(diffuse.rgb, NE, NL, LH, roughness);
  465. vec3 Fs = vec3(0.0);
  466.  
  467. #if defined(USE_LIGHT_VECTOR)
  468. float NH = clamp(dot(N, H), 0.0, 1.0);
  469.  
  470. Fs = CalcSpecular(specular.rgb, NH, NL, NE, LH, roughness);
  471. #endif
  472.  
  473. vec3 reflectance = Fd + Fs;
  474.  
  475. out_Color.rgb = lightColor * reflectance * (attenuation * NL);
  476. out_Color.rgb += ambientColor * diffuse.rgb;
  477.  
  478. #if defined(USE_PRIMARY_LIGHT)
  479. vec3 L2 = normalize(var_PrimaryLightDir.xyz);
  480. vec3 H2 = normalize(L2 + E);
  481. float NL2 = clamp(dot(N, L2), 0.0, 1.0);
  482. float L2H2 = clamp(dot(L2, H2), 0.0, 1.0);
  483. float NH2 = clamp(dot(N, H2), 0.0, 1.0);
  484.  
  485. reflectance = CalcDiffuse(diffuse.rgb, NE, N
  486. L2, L2H2, roughness);
  487. reflectance += CalcSpecular(specular.rgb, NH2, NL2, NE, L2H2, roughness);
  488.  
  489. lightColor = u_PrimaryLightColor * var_Color.rgb;
  490. #if defined(USE_SHADOWMAP)
  491. lightColor *= shadowValue;
  492. #endif
  493.  
  494. out_Color.rgb += lightColor * reflectance * NL2;
  495. #endif
  496.  
  497. out_Color.rgb += CalcIBLContribution(roughness, N, E, viewDir, NE, specular.rgb);
  498.  
  499. #else
  500. lightColor = var_Color.rgb;
  501. #if defined(USE_LIGHTMAP)
  502. lightColor *= lightmapColor.rgb;
  503. #endif
  504.  
  505. out_Color.rgb = diffuse.rgb * lightColor;
  506. #endif
  507.  
  508. out_Color.a = diffuse.a * var_Color.a;
  509.  
  510. #if defined(USE_GLOW_BUFFER)
  511. out_Glow = out_Color;
  512. #else
  513. out_Glow = vec4(0.0);
  514. #endif
  515. }
  516.  
  517. compile log:
  518. 0:299(3): preprocessor error: #elif without #if
  519.  
  520. 0:303(3): preprocessor error: #elif without #if
  521.  
  522. 0:307(3): preprocessor error: #endif without #if
  523.  
  524. 0:393(1): preprocessor error: #else without #if
  525.  
  526. 0:400(1): preprocessor error: #endif without #if
  527.  
  528.  
  529. RE_Shutdown( 1 )
  530. Couldn't compile shaderAutomatically freeing 3345 blocks making up 2859096 bytes
RAW Paste Data