Advertisement
illwieckz

Mesa GLSL error

Aug 14th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.82 KB | None | 0 0
  1. Debug: building generic shader permutation with macro: GENERIC_2D
  2. Warn: Source for shader program generic2D:
  3. 0: #version 460 core
  4. 1: #define HAVE_EXT_gpu_shader4 1
  5. 2: #define HAVE_ARB_gpu_shader5 1
  6. 3: #define HAVE_ARB_texture_gather 1
  7. 4: #define HAVE_EXT_texture_integer 1
  8. 5: #define HAVE_ARB_texture_rg 1
  9. 6: #define HAVE_ARB_uniform_buffer_object 1
  10. 7: #extension GL_ARB_shader_draw_parameters : require
  11. 8: #define HAVE_ARB_shader_draw_parameters 1
  12. 9: #define HAVE_ARB_shader_storage_buffer_object 1
  13. 10: #define IN in
  14. 11: #define OUT(mode) mode out
  15. 12: #define textureCube texture
  16. 13: #define texture2D texture
  17. 14: #define texture2DProj textureProj
  18. 15: #define texture3D texture
  19. 16: OUT(flat) int in_drawID;
  20. 17: OUT(flat) int in_baseInstance;
  21. 18: #define drawID gl_DrawIDARB
  22. 19: #define baseInstance gl_BaseInstanceARB
  23. 20:
  24. 21: #ifndef r_highPrecisionRendering
  25. 22: #define r_highPrecisionRendering 1
  26. 23: #endif
  27. 24: #ifndef r_precomputedLighting
  28. 25: #define r_precomputedLighting 1
  29. 26: #endif
  30. 27: #ifndef r_vertexSkinning
  31. 28: #define r_vertexSkinning 1
  32. 29: #endif
  33. 30: const int MAX_GLSL_BONES = 256;
  34. 31: #ifndef r_halfLambertLighting
  35. 32: #define r_halfLambertLighting 1
  36. 33: #endif
  37. 34: #ifndef r_glowMapping
  38. 35: #define r_glowMapping 1
  39. 36: #endif
  40. 37: #ifndef r_zNear
  41. 38: #define r_zNear 3.00000000e+00
  42. 39: #endif
  43. 40: #ifndef GENERIC_2D
  44. 41: #define GENERIC_2D 1
  45. 42: #endif
  46. 43: #ifndef r_AmbientScale
  47. 44: #define r_AmbientScale 1.00000000e+00
  48. 45: #endif
  49. 46: #ifndef r_SpecularScale
  50. 47: #define r_SpecularScale 1.00000000e+00
  51. 48: #endif
  52. 49: #ifndef r_zNear
  53. 50: #define r_zNear 3.00000000e+00
  54. 51: #endif
  55. 52: #ifndef M_PI
  56. 53: #define M_PI 3.14159274e+00
  57. 54: #endif
  58. 55: #ifndef MAX_SHADOWMAPS
  59. 56: #define MAX_SHADOWMAPS 5
  60. 57: #endif
  61. 58: #ifndef MAX_REF_LIGHTS
  62. 59: #define MAX_REF_LIGHTS 1024
  63. 60: #endif
  64. 61: #ifndef TILE_SIZE
  65. 62: #define TILE_SIZE 16
  66. 63: #endif
  67. 64: #ifndef r_FBufSize
  68. 65: #define r_FBufSize vec2(6.40000000e+02, 4.80000000e+02)
  69. 66: #endif
  70. 67: #ifndef r_tileStep
  71. 68: #define r_tileStep vec2(2.50000004e-02, 3.33333351e-02)
  72. 69: #endif
  73. 0: #line 0
  74. 1: /*
  75. 2: ===========================================================================
  76. 3: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
  77. 4:
  78. 5: This file is part of XreaL source code.
  79. 6:
  80. 7: XreaL source code is free software; you can redistribute it
  81. 8: and/or modify it under the terms of the GNU General Public License as
  82. 9: published by the Free Software Foundation; either version 2 of the License,
  83. 10: or (at your option) any later version.
  84. 11:
  85. 12: XreaL source code is distributed in the hope that it will be
  86. 13: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  87. 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  88. 15: GNU General Public License for more details.
  89. 16:
  90. 17: You should have received a copy of the GNU General Public License
  91. 18: along with XreaL source code; if not, write to the Free Software
  92. 19: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  93. 20: ===========================================================================
  94. 21: */
  95. 22: // vertexSimple_vp.glsl - simple vertex fetch
  96. 23:
  97. 24: struct localBasis {
  98. 25: vec3 normal;
  99. 26: vec3 tangent, binormal;
  100. 27: };
  101. 28:
  102. 29: vec3 QuatTransVec(in vec4 quat, in vec3 vec) {
  103. 30: vec3 tmp = 2.0 * cross( quat.xyz, vec );
  104. 31: return vec + quat.w * tmp + cross( quat.xyz, tmp );
  105. 32: }
  106. 33:
  107. 34: void QTangentToLocalBasis( in vec4 qtangent, out localBasis LB ) {
  108. 35: LB.normal = QuatTransVec( qtangent, vec3( 0.0, 0.0, 1.0 ) );
  109. 36: LB.tangent = QuatTransVec( qtangent, vec3( 1.0, 0.0, 0.0 ) );
  110. 37: LB.tangent *= sign( qtangent.w );
  111. 38: LB.binormal = QuatTransVec( qtangent, vec3( 0.0, 1.0, 0.0 ) );
  112. 39: }
  113. 40:
  114. 41: #if !defined(USE_VERTEX_ANIMATION) && !defined(USE_VERTEX_SKINNING) && !defined(USE_VERTEX_SPRITE)
  115. 42:
  116. 43: IN vec3 attr_Position;
  117. 44: IN vec4 attr_Color;
  118. 45: IN vec4 attr_QTangent;
  119. 46: IN vec4 attr_TexCoord0;
  120. 47:
  121. 48: void VertexFetch(out vec4 position,
  122. 49: out localBasis normalBasis,
  123. 50: out vec4 color,
  124. 51: out vec2 texCoord,
  125. 52: out vec2 lmCoord)
  126. 53: {
  127. 54: position = vec4( attr_Position, 1.0 );
  128. 55: QTangentToLocalBasis( attr_QTangent, normalBasis );
  129. 56: color = attr_Color;
  130. 57: texCoord = attr_TexCoord0.xy;
  131. 58: lmCoord = attr_TexCoord0.zw;
  132. 59: }
  133. 60: #endif
  134. 0: #line 0
  135. 1: /*
  136. 2: ===========================================================================
  137. 3: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
  138. 4:
  139. 5: This file is part of XreaL source code.
  140. 6:
  141. 7: XreaL source code is free software; you can redistribute it
  142. 8: and/or modify it under the terms of the GNU General Public License as
  143. 9: published by the Free Software Foundation; either version 2 of the License,
  144. 10: or (at your option) any later version.
  145. 11:
  146. 12: XreaL source code is distributed in the hope that it will be
  147. 13: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  148. 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  149. 15: GNU General Public License for more details.
  150. 16:
  151. 17: You should have received a copy of the GNU General Public License
  152. 18: along with XreaL source code; if not, write to the Free Software
  153. 19: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  154. 20: ===========================================================================
  155. 21: */
  156. 22: // vertexSprite_vp.glsl - sprite vertex fetch
  157. 23:
  158. 24: #if defined(USE_VERTEX_SPRITE)
  159. 25:
  160. 26: IN vec3 attr_Position;
  161. 27: IN vec4 attr_Color;
  162. 28: IN vec4 attr_TexCoord0;
  163. 29: IN vec4 attr_Orientation;
  164. 30:
  165. 31: uniform vec3 u_ViewOrigin;
  166. 32: uniform vec3 u_ViewUp;
  167. 33:
  168. 34: float depthScale;
  169. 35:
  170. 36: void VertexFetch(out vec4 position,
  171. 37: out localBasis normalBasis,
  172. 38: out vec4 color,
  173. 39: out vec2 texCoord,
  174. 40: out vec2 lmCoord)
  175. 41: {
  176. 42: vec2 corner;
  177. 43: float radius = attr_Orientation.w;
  178. 44: vec3 normal = normalize( u_ViewOrigin - attr_Position ), up, left;
  179. 45: float s, c; // sin & cos of rotation factor
  180. 46:
  181. 47: corner = sign( attr_TexCoord0.zw );
  182. 48:
  183. 49: if( radius <= 0.0 ) {
  184. 50: // autosprite2 mode, attr_Orientation.xyz contains the up-vector
  185. 51: up = attr_Orientation.xyz;
  186. 52: left = radius * normalize( cross( up, normal ) );
  187. 53: position = vec4( attr_Position + corner.y * left, 1.0 );
  188. 54: } else {
  189. 55: // autosprite mode, attr_Orientation.x contains the rotation angle
  190. 56: left = normalize( cross( u_ViewUp, normal ) );
  191. 57: up = cross( left, normal );
  192. 58:
  193. 59: s = radius * sin( radians( attr_Orientation.x ) );
  194. 60: c = radius * cos( radians( attr_Orientation.x ) );
  195. 61:
  196. 62: // rotate left and up vectors
  197. 63: vec3 leftOrig = left;
  198. 64: left = c * left + s * up;
  199. 65: up = c * up - s * leftOrig;
  200. 66:
  201. 67: left *= corner.x;
  202. 68: up *= corner.y;
  203. 69:
  204. 70: position = vec4( attr_Position + left + up, 1.0 );
  205. 71: }
  206. 72: normalBasis.normal = normal;
  207. 73: normalBasis.tangent = normalize( up );
  208. 74: normalBasis.binormal = normalize( left );
  209. 75:
  210. 76: texCoord = 0.5 * corner + 0.5; //attr_TexCoord0.xy;
  211. 77: lmCoord = abs( attr_TexCoord0.zw );
  212. 78: color = attr_Color;
  213. 79:
  214. 80: depthScale = 2.0 * radius;
  215. 81: }
  216. 82: #endif
  217. 0: #line 0
  218. 1: /*
  219. 2: ===========================================================================
  220. 3: Copyright (C) 2006-2011 Robert Beckebans <trebor_7@users.sourceforge.net>
  221. 4:
  222. 5: This file is part of XreaL source code.
  223. 6:
  224. 7: XreaL source code is free software; you can redistribute it
  225. 8: and/or modify it under the terms of the GNU General Public License as
  226. 9: published by the Free Software Foundation; either version 2 of the License,
  227. 10: or (at your option) any later version.
  228. 11:
  229. 12: XreaL source code is distributed in the hope that it will be
  230. 13: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  231. 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  232. 15: GNU General Public License for more details.
  233. 16:
  234. 17: You should have received a copy of the GNU General Public License
  235. 18: along with XreaL source code; if not, write to the Free Software
  236. 19: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  237. 20: ===========================================================================
  238. 21: */
  239. 22:
  240. 23: /* generic_vp.glsl */
  241. 24:
  242. 10000: #line 10000 // vertexSimple_vp.glsl
  243. 10001: /*
  244. 10002: ===========================================================================
  245. 10003: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
  246. 10004:
  247. 10005: This file is part of XreaL source code.
  248. 10006:
  249. 10007: XreaL source code is free software; you can redistribute it
  250. 10008: and/or modify it under the terms of the GNU General Public License as
  251. 10009: published by the Free Software Foundation; either version 2 of the License,
  252. 10010: or (at your option) any later version.
  253. 10011:
  254. 10012: XreaL source code is distributed in the hope that it will be
  255. 10013: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  256. 10014: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  257. 10015: GNU General Public License for more details.
  258. 10016:
  259. 10017: You should have received a copy of the GNU General Public License
  260. 10018: along with XreaL source code; if not, write to the Free Software
  261. 10019: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  262. 10020: ===========================================================================
  263. 10021: */
  264. 10022: // vertexSimple_vp.glsl - simple vertex fetch
  265. 10023:
  266. 10024: struct localBasis {
  267. 10025: vec3 normal;
  268. 10026: vec3 tangent, binormal;
  269. 10027: };
  270. 10028:
  271. 10029: vec3 QuatTransVec(in vec4 quat, in vec3 vec) {
  272. 10030: vec3 tmp = 2.0 * cross( quat.xyz, vec );
  273. 10031: return vec + quat.w * tmp + cross( quat.xyz, tmp );
  274. 10032: }
  275. 10033:
  276. 10034: void QTangentToLocalBasis( in vec4 qtangent, out localBasis LB ) {
  277. 10035: LB.normal = QuatTransVec( qtangent, vec3( 0.0, 0.0, 1.0 ) );
  278. 10036: LB.tangent = QuatTransVec( qtangent, vec3( 1.0, 0.0, 0.0 ) );
  279. 10037: LB.tangent *= sign( qtangent.w );
  280. 10038: LB.binormal = QuatTransVec( qtangent, vec3( 0.0, 1.0, 0.0 ) );
  281. 10039: }
  282. 10040:
  283. 10041: #if !defined(USE_VERTEX_ANIMATION) && !defined(USE_VERTEX_SKINNING) && !defined(USE_VERTEX_SPRITE)
  284. 10042:
  285. 10043: IN vec3 attr_Position;
  286. 10044: IN vec4 attr_Color;
  287. 10045: IN vec4 attr_QTangent;
  288. 10046: IN vec4 attr_TexCoord0;
  289. 10047:
  290. 10048: void VertexFetch(out vec4 position,
  291. 10049: out localBasis normalBasis,
  292. 10050: out vec4 color,
  293. 10051: out vec2 texCoord,
  294. 10052: out vec2 lmCoord)
  295. 10053: {
  296. 10054: position = vec4( attr_Position, 1.0 );
  297. 10055: QTangentToLocalBasis( attr_QTangent, normalBasis );
  298. 10056: color = attr_Color;
  299. 10057: texCoord = attr_TexCoord0.xy;
  300. 10058: lmCoord = attr_TexCoord0.zw;
  301. 10059: }
  302. 10060: #endif
  303. 25: #line 25
  304. 20000: #line 20000 // vertexSkinning_vp.glsl
  305. 20001: /*
  306. 20002: ===========================================================================
  307. 20003: Copyright (C) 2009-2011 Robert Beckebans <trebor_7@users.sourceforge.net>
  308. 20004:
  309. 20005: This file is part of XreaL source code.
  310. 20006:
  311. 20007: XreaL source code is free software; you can redistribute it
  312. 20008: and/or modify it under the terms of the GNU General Public License as
  313. 20009: published by the Free Software Foundation; either version 2 of the License,
  314. 20010: or (at your option) any later version.
  315. 20011:
  316. 20012: XreaL source code is distributed in the hope that it will be
  317. 20013: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  318. 20014: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  319. 20015: GNU General Public License for more details.
  320. 20016:
  321. 20017: You should have received a copy of the GNU General Public License
  322. 20018: along with XreaL source code; if not, write to the Free Software
  323. 20019: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  324. 20020: ===========================================================================
  325. 20021: */
  326. 20022: // vertexSkinning_vp.glsl - GPU vertex skinning for skeletal meshes
  327. 20023:
  328. 20024: #if defined(USE_VERTEX_SKINNING)
  329. 20025:
  330. 20026: IN vec3 attr_Position;
  331. 20027: IN vec2 attr_TexCoord0;
  332. 20028: IN vec4 attr_Color;
  333. 20029: IN vec4 attr_QTangent;
  334. 20030: IN vec4 attr_BoneFactors;
  335. 20031:
  336. 20032: // even elements are rotation quat, odd elements are translation + scale (in .w)
  337. 20033: uniform vec4 u_Bones[ 2 * MAX_GLSL_BONES ];
  338. 20034:
  339. 20035: void VertexFetch(out vec4 position,
  340. 20036: out localBasis LB,
  341. 20037: out vec4 color,
  342. 20038: out vec2 texCoord,
  343. 20039: out vec2 lmCoord)
  344. 20040: {
  345. 20041: const float scale = 1.0 / 256.0;
  346. 20042: const float weightScale = 1.0 / 255.0;
  347. 20043: localBasis inLB;
  348. 20044:
  349. 20045: // Unpack data from "bone factors". This used to have the index in the high byte and the weight
  350. 20046: // in the low byte, which may seem a bit more logical, but it triggered issues with some
  351. 20047: // Nvidia shader compilers (https://github.com/DaemonEngine/Daemon/issues/472).
  352. 20048: vec4 ipart = floor( attr_BoneFactors * scale );
  353. 20049: vec4 fpart = attr_BoneFactors * scale - ipart;
  354. 20050: // idx = 2 times the original bone index (the index input to boneFactor)
  355. 20051: ivec4 idx = ivec4( fpart * 512.0 );
  356. 20052: vec4 weights = ipart * weightScale;
  357. 20053:
  358. 20054: vec4 quat = u_Bones[ idx.x ];
  359. 20055: vec4 trans = u_Bones[ idx.x + 1 ];
  360. 20056:
  361. 20057: QTangentToLocalBasis( attr_QTangent, inLB );
  362. 20058:
  363. 20059: position.xyz = weights.x * (QuatTransVec( quat, attr_Position ) * trans.w + trans.xyz);
  364. 20060: LB.normal = weights.x * (QuatTransVec( quat, inLB.normal ));
  365. 20061: LB.tangent = weights.x * (QuatTransVec( quat, inLB.tangent ));
  366. 20062: LB.binormal = weights.x * (QuatTransVec( quat, inLB.binormal ));
  367. 20063:
  368. 20064: quat = u_Bones[ idx.y ];
  369. 20065: trans = u_Bones[ idx.y + 1 ];
  370. 20066:
  371. 20067: position.xyz += weights.y * (QuatTransVec( quat, attr_Position ) * trans.w + trans.xyz);
  372. 20068: LB.normal += weights.y * (QuatTransVec( quat, inLB.normal ));
  373. 20069: LB.tangent += weights.y * (QuatTransVec( quat, inLB.tangent ));
  374. 20070: LB.binormal += weights.y * (QuatTransVec( quat, inLB.binormal ));
  375. 20071:
  376. 20072: quat = u_Bones[ idx.z ];
  377. 20073: trans = u_Bones[ idx.z + 1 ];
  378. 20074:
  379. 20075: position.xyz += weights.z * (QuatTransVec( quat, attr_Position ) * trans.w + trans.xyz);
  380. 20076: LB.normal += weights.z * (QuatTransVec( quat, inLB.normal ));
  381. 20077: LB.tangent += weights.z * (QuatTransVec( quat, inLB.tangent ));
  382. 20078: LB.binormal += weights.z * (QuatTransVec( quat, inLB.binormal ));
  383. 20079:
  384. 20080: quat = u_Bones[ idx.w ];
  385. 20081: trans = u_Bones[ idx.w + 1 ];
  386. 20082:
  387. 20083: position.xyz += weights.w * (QuatTransVec( quat, attr_Position ) * trans.w + trans.xyz);
  388. 20084: LB.normal += weights.w * (QuatTransVec( quat, inLB.normal ));
  389. 20085: LB.tangent += weights.w * (QuatTransVec( quat, inLB.tangent ));
  390. 20086: LB.binormal += weights.w * (QuatTransVec( quat, inLB.binormal ));
  391. 20087:
  392. 20088: position.w = 1.0;
  393. 20089: LB.normal = normalize(LB.normal);
  394. 20090: LB.tangent = normalize(LB.tangent);
  395. 20091: LB.binormal = normalize(LB.binormal);
  396. 20092:
  397. 20093: color = attr_Color;
  398. 20094: texCoord = attr_TexCoord0;
  399. 20095: lmCoord = attr_TexCoord0;
  400. 20096: }
  401. 20097: #endif
  402. 26: #line 26
  403. 30000: #line 30000 // vertexAnimation_vp.glsl
  404. 30001: /*
  405. 30002: ===========================================================================
  406. 30003: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
  407. 30004:
  408. 30005: This file is part of XreaL source code.
  409. 30006:
  410. 30007: XreaL source code is free software; you can redistribute it
  411. 30008: and/or modify it under the terms of the GNU General Public License as
  412. 30009: published by the Free Software Foundation; either version 2 of the License,
  413. 30010: or (at your option) any later version.
  414. 30011:
  415. 30012: XreaL source code is distributed in the hope that it will be
  416. 30013: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  417. 30014: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  418. 30015: GNU General Public License for more details.
  419. 30016:
  420. 30017: You should have received a copy of the GNU General Public License
  421. 30018: along with XreaL source code; if not, write to the Free Software
  422. 30019: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  423. 30020: ===========================================================================
  424. 30021: */
  425. 30022: // vertexAnimation_vp.glsl - interpolates .md3/.mdc vertex animations
  426. 30023:
  427. 30024: #if defined(USE_VERTEX_ANIMATION)
  428. 30025:
  429. 30026: IN vec3 attr_Position;
  430. 30027: IN vec4 attr_Color;
  431. 30028: IN vec4 attr_QTangent;
  432. 30029: IN vec2 attr_TexCoord0;
  433. 30030: IN vec3 attr_Position2;
  434. 30031: IN vec4 attr_QTangent2;
  435. 30032:
  436. 30033: uniform float u_VertexInterpolation;
  437. 30034:
  438. 30035: void VertexAnimation_P_N( vec3 fromPosition, vec3 toPosition,
  439. 30036: vec4 fromQTangent, vec4 toQTangent,
  440. 30037: float frac,
  441. 30038: inout vec4 position, inout vec3 normal)
  442. 30039: {
  443. 30040: vec3 fromNormal = QuatTransVec( fromQTangent, vec3( 0.0, 0.0, 1.0 ) );
  444. 30041: vec3 toNormal = QuatTransVec( toQTangent, vec3( 0.0, 0.0, 1.0 ) );
  445. 30042:
  446. 30043: position.xyz = 512.0 * mix(fromPosition, toPosition, frac);
  447. 30044: position.w = 1;
  448. 30045:
  449. 30046: normal = normalize(mix(fromNormal, toNormal, frac));
  450. 30047: }
  451. 30048:
  452. 30049: void VertexFetch(out vec4 position,
  453. 30050: out localBasis LB,
  454. 30051: out vec4 color,
  455. 30052: out vec2 texCoord,
  456. 30053: out vec2 lmCoord)
  457. 30054: {
  458. 30055: localBasis fromLB, toLB;
  459. 30056:
  460. 30057: QTangentToLocalBasis( attr_QTangent, fromLB );
  461. 30058: QTangentToLocalBasis( attr_QTangent2, toLB );
  462. 30059:
  463. 30060: position.xyz = 512.0 * mix(attr_Position, attr_Position2, u_VertexInterpolation);
  464. 30061: position.w = 1;
  465. 30062:
  466. 30063: LB.normal = normalize(mix(fromLB.normal, toLB.normal, u_VertexInterpolation));
  467. 30064: LB.tangent = normalize(mix(fromLB.tangent, toLB.tangent, u_VertexInterpolation));
  468. 30065: LB.binormal = normalize(mix(fromLB.binormal, toLB.binormal, u_VertexInterpolation));
  469. 30066:
  470. 30067: color = attr_Color;
  471. 30068: texCoord = attr_TexCoord0;
  472. 30069: lmCoord = attr_TexCoord0;
  473. 30070: }
  474. 30071: #endif
  475. 27: #line 27
  476. 40000: #line 40000 // vertexSprite_vp.glsl
  477. 40001: /*
  478. 40002: ===========================================================================
  479. 40003: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
  480. 40004:
  481. 40005: This file is part of XreaL source code.
  482. 40006:
  483. 40007: XreaL source code is free software; you can redistribute it
  484. 40008: and/or modify it under the terms of the GNU General Public License as
  485. 40009: published by the Free Software Foundation; either version 2 of the License,
  486. 40010: or (at your option) any later version.
  487. 40011:
  488. 40012: XreaL source code is distributed in the hope that it will be
  489. 40013: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  490. 40014: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  491. 40015: GNU General Public License for more details.
  492. 40016:
  493. 40017: You should have received a copy of the GNU General Public License
  494. 40018: along with XreaL source code; if not, write to the Free Software
  495. 40019: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  496. 40020: ===========================================================================
  497. 40021: */
  498. 40022: // vertexSprite_vp.glsl - sprite vertex fetch
  499. 40023:
  500. 40024: #if defined(USE_VERTEX_SPRITE)
  501. 40025:
  502. 40026: IN vec3 attr_Position;
  503. 40027: IN vec4 attr_Color;
  504. 40028: IN vec4 attr_TexCoord0;
  505. 40029: IN vec4 attr_Orientation;
  506. 40030:
  507. 40031: uniform vec3 u_ViewOrigin;
  508. 40032: uniform vec3 u_ViewUp;
  509. 40033:
  510. 40034: float depthScale;
  511. 40035:
  512. 40036: void VertexFetch(out vec4 position,
  513. 40037: out localBasis normalBasis,
  514. 40038: out vec4 color,
  515. 40039: out vec2 texCoord,
  516. 40040: out vec2 lmCoord)
  517. 40041: {
  518. 40042: vec2 corner;
  519. 40043: float radius = attr_Orientation.w;
  520. 40044: vec3 normal = normalize( u_ViewOrigin - attr_Position ), up, left;
  521. 40045: float s, c; // sin & cos of rotation factor
  522. 40046:
  523. 40047: corner = sign( attr_TexCoord0.zw );
  524. 40048:
  525. 40049: if( radius <= 0.0 ) {
  526. 40050: // autosprite2 mode, attr_Orientation.xyz contains the up-vector
  527. 40051: up = attr_Orientation.xyz;
  528. 40052: left = radius * normalize( cross( up, normal ) );
  529. 40053: position = vec4( attr_Position + corner.y * left, 1.0 );
  530. 40054: } else {
  531. 40055: // autosprite mode, attr_Orientation.x contains the rotation angle
  532. 40056: left = normalize( cross( u_ViewUp, normal ) );
  533. 40057: up = cross( left, normal );
  534. 40058:
  535. 40059: s = radius * sin( radians( attr_Orientation.x ) );
  536. 40060: c = radius * cos( radians( attr_Orientation.x ) );
  537. 40061:
  538. 40062: // rotate left and up vectors
  539. 40063: vec3 leftOrig = left;
  540. 40064: left = c * left + s * up;
  541. 40065: up = c * up - s * leftOrig;
  542. 40066:
  543. 40067: left *= corner.x;
  544. 40068: up *= corner.y;
  545. 40069:
  546. 40070: position = vec4( attr_Position + left + up, 1.0 );
  547. 40071: }
  548. 40072: normalBasis.normal = normal;
  549. 40073: normalBasis.tangent = normalize( up );
  550. 40074: normalBasis.binormal = normalize( left );
  551. 40075:
  552. 40076: texCoord = 0.5 * corner + 0.5; //attr_TexCoord0.xy;
  553. 40077: lmCoord = abs( attr_TexCoord0.zw );
  554. 40078: color = attr_Color;
  555. 40079:
  556. 40080: depthScale = 2.0 * radius;
  557. 40081: }
  558. 40082: #endif
  559. 28: #line 28
  560. 29:
  561. 30: uniform mat4 u_TextureMatrix;
  562. 31: #if !defined(USE_VERTEX_SPRITE)
  563. 32: uniform vec3 u_ViewOrigin;
  564. 33: #endif
  565. 34:
  566. 35: uniform float u_Time;
  567. 36:
  568. 37: uniform vec4 u_ColorModulate;
  569. 38: uniform vec4 u_Color;
  570. 39: #if defined(USE_TCGEN_ENVIRONMENT)
  571. 40: uniform mat4 u_ModelMatrix;
  572. 41: #endif
  573. 42: uniform mat4 u_ModelViewProjectionMatrix;
  574. 43:
  575. 44: #if defined(USE_VERTEX_SPRITE)
  576. 45: OUT(smooth) vec2 var_FadeDepth;
  577. 46: uniform mat4 u_ProjectionMatrixTranspose;
  578. 47: #elif defined(USE_DEPTH_FADE)
  579. 48: uniform float u_DepthScale;
  580. 49: OUT(smooth) vec2 var_FadeDepth;
  581. 50: #endif
  582. 51:
  583. 52: OUT(smooth) vec2 var_TexCoords;
  584. 53: OUT(smooth) vec4 var_Color;
  585. 54:
  586. 55: void DeformVertex( inout vec4 pos,
  587. 56: inout vec3 normal,
  588. 57: inout vec2 st,
  589. 58: inout vec4 color,
  590. 59: in float time);
  591. 60:
  592. 61: void main()
  593. 62: {
  594. 50000: #line 50000 // material_vp.glsl
  595. 50001: /*
  596. 50002: ===========================================================================
  597. 50003:
  598. 50004: Daemon BSD Source Code
  599. 50005: Copyright (c) 2024 Daemon Developers
  600. 50006: All rights reserved.
  601. 50007:
  602. 50008: This file is part of the Daemon BSD Source Code (Daemon Source Code).
  603. 50009:
  604. 50010: Redistribution and use in source and binary forms, with or without
  605. 50011: modification, are permitted provided that the following conditions are met:
  606. 50012: * Redistributions of source code must retain the above copyright
  607. 50013: notice, this list of conditions and the following disclaimer.
  608. 50014: * Redistributions in binary form must reproduce the above copyright
  609. 50015: notice, this list of conditions and the following disclaimer in the
  610. 50016: documentation and/or other materials provided with the distribution.
  611. 50017: * Neither the name of the Daemon developers nor the
  612. 50018: names of its contributors may be used to endorse or promote products
  613. 50019: derived from this software without specific prior written permission.
  614. 50020:
  615. 50021: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  616. 50022: ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  617. 50023: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  618. 50024: DISCLAIMED. IN NO EVENT SHALL DAEMON DEVELOPERS BE LIABLE FOR ANY
  619. 50025: DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  620. 50026: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  621. 50027: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  622. 50028: ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  623. 50029: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  624. 50030: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  625. 50031:
  626. 50032: ===========================================================================
  627. 50033: */
  628. 50034:
  629. 50035: /* material_vp.glsl */
  630. 50036:
  631. 50037: #if defined(USE_MATERIAL_SYSTEM)
  632. 50038:
  633. 50039: #ifdef HAVE_ARB_shader_draw_parameters
  634. 50040: in_drawID = drawID;
  635. 50041: in_baseInstance = baseInstance;
  636. 50042: #endif // !HAVE_ARB_shader_draw_parameters
  637. 50043:
  638. 50044: #endif // !USE_MATERIAL_SYSTEM
  639. 63: #line 63
  640. 64: a
  641. 65: vec4 position;
  642. 66: localBasis LB;
  643. 67: vec4 color;
  644. 68: vec2 texCoord, lmCoord;
  645. 69:
  646. 70: VertexFetch( position, LB, color, texCoord, lmCoord );
  647. 71: color = color * u_ColorModulate + u_Color;
  648. 72:
  649. 73: DeformVertex( position,
  650. 74: LB.normal,
  651. 75: texCoord,
  652. 76: color,
  653. 77: u_Time);
  654. 78:
  655. 79: // transform vertex position into homogenous clip-space
  656. 80: gl_Position = u_ModelViewProjectionMatrix * position;
  657. 81:
  658. 82: // transform texcoords
  659. 83: #if defined(USE_TCGEN_ENVIRONMENT)
  660. 84: {
  661. 85: // TODO: Explain why only the rotational part of u_ModelMatrix is relevant
  662. 86: position.xyz = mat3(u_ModelMatrix) * position.xyz;
  663. 87:
  664. 88: vec3 viewer = normalize(u_ViewOrigin - position.xyz);
  665. 89:
  666. 90: float d = dot(LB.normal, viewer);
  667. 91:
  668. 92: vec3 reflected = LB.normal * 2.0 * d - viewer;
  669. 93:
  670. 94: var_TexCoords = 0.5 + vec2(0.5, -0.5) * reflected.yz;
  671. 95: }
  672. 96: #elif defined(USE_TCGEN_LIGHTMAP)
  673. 97: var_TexCoords = (u_TextureMatrix * vec4(lmCoord, 0.0, 1.0)).xy;
  674. 98: #else
  675. 99: var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).xy;
  676. 100: #endif
  677. 101:
  678. 102: #if defined(USE_DEPTH_FADE)
  679. 103: // compute z of end of fading effect
  680. 104: vec4 fadeDepth = u_ModelViewProjectionMatrix * (position - u_DepthScale * vec4(LB.normal, 0.0));
  681. 105: var_FadeDepth = fadeDepth.zw;
  682. 106: #elif defined(USE_VERTEX_SPRITE)
  683. 107: vec4 fadeDepth = u_ModelViewProjectionMatrix * (position - depthScale * vec4(LB.normal, 0.0));
  684. 108: var_FadeDepth = fadeDepth.zw;
  685. 109: #endif
  686. 110:
  687. 111: var_Color = color;
  688. 112: }
  689.  
  690. Warn: Compile log:
  691. 0:64(2): error: syntax error, unexpected BASIC_TYPE_TOK, expecting ',' or ';'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement