Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Warn: Source for shader program generic2D:
- 0: #version 460 core
- 1: #define HAVE_ARB_texture_gather 1
- 2: #define HAVE_EXT_gpu_shader4 1
- 3: #define HAVE_ARB_gpu_shader5 1
- 4: #define HAVE_ARB_uniform_buffer_object 1
- 5: #extension GL_ARB_bindless_texture : require
- 6: #define HAVE_ARB_bindless_texture 1
- 7: #define HAVE_ARB_shader_draw_parameters 1
- 8: #define HAVE_ARB_shader_storage_buffer_object 1
- 9: #extension GL_ARB_gpu_shader_int64 : require
- 10: #define HAVE_ARB_gpu_shader_int64 1
- 11: #define IN in
- 12: #define OUT(mode) mode out
- 13: #define textureCube texture
- 14: #define texture2D texture
- 15: #define texture2DProj textureProj
- 16: #define texture3D texture
- 17: OUT(flat) int in_drawID;
- 18: OUT(flat) int in_baseInstance;
- 19: #ifndef r_precomputedLighting
- 20: #define r_precomputedLighting 1
- 21: #endif
- 22: #ifndef r_vertexSkinning
- 23: #define r_vertexSkinning 1
- 24: #endif
- 25: const int MAX_GLSL_BONES = 256;
- 26: #ifndef r_halfLambertLighting
- 27: #define r_halfLambertLighting 1
- 28: #endif
- 29: #ifndef r_rimLighting
- 30: #define r_rimLighting 1
- 31: #endif
- 32: const float r_RimExponent = 3.00000000e+00;
- 33: #ifndef r_normalMapping
- 34: #define r_normalMapping 1
- 35: #endif
- 36: #ifndef r_liquidMapping
- 37: #define r_liquidMapping 1
- 38: #endif
- 39: #ifndef r_specularMapping
- 40: #define r_specularMapping 1
- 41: #endif
- 42: #ifndef r_physicalMapping
- 43: #define r_physicalMapping 1
- 44: #endif
- 45: #ifndef r_glowMapping
- 46: #define r_glowMapping 1
- 47: #endif
- 48: #ifndef GENERIC_2D
- 49: #define GENERIC_2D 1
- 50: #endif
- 51: #define drawID gl_DrawIDARB
- 52: #define baseInstance gl_BaseInstanceARB
- 53:
- 54: #ifndef TEXTURE_RG
- 55: #define TEXTURE_RG 1
- 56: #endif
- 57: #ifndef UNIFORM_BUFFER_OBJECT
- 58: #define UNIFORM_BUFFER_OBJECT 1
- 59: #endif
- 60: #ifndef TEXTURE_INTEGER
- 61: #define TEXTURE_INTEGER 1
- 62: #endif
- 63: #ifndef r_AmbientScale
- 64: #define r_AmbientScale 1.00000000e+00
- 65: #endif
- 66: #ifndef r_SpecularScale
- 67: #define r_SpecularScale 1.00000000e+00
- 68: #endif
- 69: #ifndef r_zNear
- 70: #define r_zNear 3.00000000e+00
- 71: #endif
- 72: #ifndef M_PI
- 73: #define M_PI 3.14159274e+00
- 74: #endif
- 75: #ifndef MAX_SHADOWMAPS
- 76: #define MAX_SHADOWMAPS 5
- 77: #endif
- 78: #ifndef MAX_REF_LIGHTS
- 79: #define MAX_REF_LIGHTS 1024
- 80: #endif
- 81: #ifndef TILE_SIZE
- 82: #define TILE_SIZE 16
- 83: #endif
- 84: #ifndef r_FBufSize
- 85: #define r_FBufSize vec2(3.84000000e+03, 2.16000000e+03)
- 86: #endif
- 87: #ifndef r_tileStep
- 88: #define r_tileStep vec2(4.16666688e-03, 7.40740728e-03)
- 89: #endif
- 90: #ifdef HAVE_ARB_shader_draw_parameters
- 91: #define SETUP_SHADER_PARMS SetShaderParameters();
- 92: void SetShaderParameters() {
- 93: in_drawID = drawID;
- 94: in_baseInstance = baseInstance;
- 95: }
- 96: #else
- 97: #define SETUP_SHADER_PARMS //Unavailable
- 98: #endif
- 99: /*
- 100: ===========================================================================
- 101: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
- 102:
- 103: This file is part of XreaL source code.
- 104:
- 105: XreaL source code is free software; you can redistribute it
- 106: and/or modify it under the terms of the GNU General Public License as
- 107: published by the Free Software Foundation; either version 2 of the License,
- 108: or (at your option) any later version.
- 109:
- 110: XreaL source code is distributed in the hope that it will be
- 111: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- 112: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 113: GNU General Public License for more details.
- 114:
- 115: You should have received a copy of the GNU General Public License
- 116: along with XreaL source code; if not, write to the Free Software
- 117: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- 118: ===========================================================================
- 119: */
- 120: // vertexSimple_vp.glsl - simple vertex fetch
- 121:
- 122: struct localBasis {
- 123: vec3 normal;
- 124: vec3 tangent, binormal;
- 125: };
- 126:
- 127: vec3 QuatTransVec(in vec4 quat, in vec3 vec) {
- 128: vec3 tmp = 2.0 * cross( quat.xyz, vec );
- 129: return vec + quat.w * tmp + cross( quat.xyz, tmp );
- 130: }
- 131:
- 132: void QTangentToLocalBasis( in vec4 qtangent, out localBasis LB ) {
- 133: LB.normal = QuatTransVec( qtangent, vec3( 0.0, 0.0, 1.0 ) );
- 134: LB.tangent = QuatTransVec( qtangent, vec3( 1.0, 0.0, 0.0 ) );
- 135: LB.tangent *= sign( qtangent.w );
- 136: LB.binormal = QuatTransVec( qtangent, vec3( 0.0, 1.0, 0.0 ) );
- 137: }
- 138:
- 139: #if !defined(USE_VERTEX_ANIMATION) && !defined(USE_VERTEX_SKINNING) && !defined(USE_VERTEX_SPRITE)
- 140:
- 141: IN vec3 attr_Position;
- 142: IN vec4 attr_Color;
- 143: IN vec4 attr_QTangent;
- 144: IN vec4 attr_TexCoord0;
- 145:
- 146: void VertexFetch(out vec4 position,
- 147: out localBasis normalBasis,
- 148: out vec4 color,
- 149: out vec2 texCoord,
- 150: out vec2 lmCoord)
- 151: {
- 152: position = vec4( attr_Position, 1.0 );
- 153: QTangentToLocalBasis( attr_QTangent, normalBasis );
- 154: color = attr_Color;
- 155: texCoord = attr_TexCoord0.xy;
- 156: lmCoord = attr_TexCoord0.zw;
- 157: }
- 158: #endif
- 159: /*
- 160: ===========================================================================
- 161: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
- 162:
- 163: This file is part of XreaL source code.
- 164:
- 165: XreaL source code is free software; you can redistribute it
- 166: and/or modify it under the terms of the GNU General Public License as
- 167: published by the Free Software Foundation; either version 2 of the License,
- 168: or (at your option) any later version.
- 169:
- 170: XreaL source code is distributed in the hope that it will be
- 171: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- 172: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 173: GNU General Public License for more details.
- 174:
- 175: You should have received a copy of the GNU General Public License
- 176: along with XreaL source code; if not, write to the Free Software
- 177: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- 178: ===========================================================================
- 179: */
- 180: // vertexSprite_vp.glsl - sprite vertex fetch
- 181:
- 182: #if defined(USE_VERTEX_SPRITE)
- 183:
- 184: IN vec3 attr_Position;
- 185: IN vec4 attr_Color;
- 186: IN vec4 attr_TexCoord0;
- 187: IN vec4 attr_Orientation;
- 188:
- 189: uniform vec3 u_ViewOrigin;
- 190: uniform vec3 u_ViewUp;
- 191:
- 192: float depthScale;
- 193:
- 194: void VertexFetch(out vec4 position,
- 195: out localBasis normalBasis,
- 196: out vec4 color,
- 197: out vec2 texCoord,
- 198: out vec2 lmCoord)
- 199: {
- 200: vec2 corner;
- 201: float radius = attr_Orientation.w;
- 202: vec3 normal = normalize( u_ViewOrigin - attr_Position ), up, left;
- 203: float s, c; // sin & cos of rotation factor
- 204:
- 205: corner = sign( attr_TexCoord0.zw );
- 206:
- 207: if( radius <= 0.0 ) {
- 208: // autosprite2 mode, attr_Orientation.xyz contains the up-vector
- 209: up = attr_Orientation.xyz;
- 210: left = radius * normalize( cross( up, normal ) );
- 211: position = vec4( attr_Position + corner.y * left, 1.0 );
- 212: } else {
- 213: // autosprite mode, attr_Orientation.x contains the rotation angle
- 214: left = normalize( cross( u_ViewUp, normal ) );
- 215: up = cross( left, normal );
- 216:
- 217: s = radius * sin( radians( attr_Orientation.x ) );
- 218: c = radius * cos( radians( attr_Orientation.x ) );
- 219:
- 220: // rotate left and up vectors
- 221: vec3 leftOrig = left;
- 222: left = c * left + s * up;
- 223: up = c * up - s * leftOrig;
- 224:
- 225: left *= corner.x;
- 226: up *= corner.y;
- 227:
- 228: position = vec4( attr_Position + left + up, 1.0 );
- 229: }
- 230: normalBasis.normal = normal;
- 231: normalBasis.tangent = normalize( up );
- 232: normalBasis.binormal = normalize( left );
- 233:
- 234: texCoord = 0.5 * corner + 0.5; //attr_TexCoord0.xy;
- 235: lmCoord = abs( attr_TexCoord0.zw );
- 236: color = attr_Color;
- 237:
- 238: depthScale = 2.0 * radius;
- 239: }
- 240: #endif
- 241: /*
- 242: ===========================================================================
- 243: Copyright (C) 2006-2011 Robert Beckebans <trebor_7@users.sourceforge.net>
- 244:
- 245: This file is part of XreaL source code.
- 246:
- 247: XreaL source code is free software; you can redistribute it
- 248: and/or modify it under the terms of the GNU General Public License as
- 249: published by the Free Software Foundation; either version 2 of the License,
- 250: or (at your option) any later version.
- 251:
- 252: XreaL source code is distributed in the hope that it will be
- 253: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- 254: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 255: GNU General Public License for more details.
- 256:
- 257: You should have received a copy of the GNU General Public License
- 258: along with XreaL source code; if not, write to the Free Software
- 259: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- 260: ===========================================================================
- 261: */
- 262:
- 263: /* generic_vp.glsl */
- 264:
- 265: uniform mat4 u_TextureMatrix;
- 266: #if !defined(USE_VERTEX_SPRITE)
- 267: uniform vec3 u_ViewOrigin;
- 268: #endif
- 269:
- 270: uniform float u_Time;
- 271:
- 272: uniform vec4 u_ColorModulate;
- 273: uniform vec4 u_Color;
- 274: #if defined(USE_TCGEN_ENVIRONMENT)
- 275: uniform mat4 u_ModelMatrix;
- 276: #endif
- 277: uniform mat4 u_ModelViewProjectionMatrix;
- 278:
- 279: #if defined(USE_VERTEX_SPRITE)
- 280: OUT(smooth) vec2 var_FadeDepth;
- 281: uniform mat4 u_ProjectionMatrixTranspose;
- 282: #elif defined(USE_DEPTH_FADE)
- 283: uniform float u_DepthScale;
- 284: OUT(smooth) vec2 var_FadeDepth;
- 285: #endif
- 286:
- 287: OUT(smooth) vec2 var_TexCoords;
- 288: OUT(smooth) vec4 var_Color;
- 289:
- 290: void DeformVertex( inout vec4 pos,
- 291: inout vec3 normal,
- 292: inout vec2 st,
- 293: inout vec4 color,
- 294: in float time);
- 295:
- 296: void main()
- 297: {
- 298: vec4 position;
- 299: localBasis LB;
- 300: vec4 color;
- 301: vec2 texCoord, lmCoord;
- 302:
- 303: VertexFetch( position, LB, color, texCoord, lmCoord );
- 304: color = color * u_ColorModulate + u_Color;
- 305:
- 306: DeformVertex( position,
- 307: LB.normal,
- 308: texCoord,
- 309: color,
- 310: u_Time);
- 311:
- 312: // transform vertex position into homogenous clip-space
- 313: gl_Position = u_ModelViewProjectionMatrix * position;
- 314:
- 315: // transform texcoords
- 316: #if defined(USE_TCGEN_ENVIRONMENT)
- 317: {
- 318: // TODO: Explain why only the rotational part of u_ModelMatrix is relevant
- 319: position.xyz = mat3(u_ModelMatrix) * position.xyz;
- 320:
- 321: vec3 viewer = normalize(u_ViewOrigin - position.xyz);
- 322:
- 323: float d = dot(LB.normal, viewer);
- 324:
- 325: vec3 reflected = LB.normal * 2.0 * d - viewer;
- 326:
- 327: var_TexCoords = 0.5 + vec2(0.5, -0.5) * reflected.yz;
- 328: }
- 329: #elif defined(USE_TCGEN_LIGHTMAP)
- 330: var_TexCoords = (u_TextureMatrix * vec4(lmCoord, 0.0, 1.0)).xy;
- 331: #else
- 332: var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).xy;
- 333: #endif
- 334:
- 335: #if defined(USE_DEPTH_FADE)
- 336: // compute z of end of fading effect
- 337: vec4 fadeDepth = u_ModelViewProjectionMatrix * (position - u_DepthScale * vec4(LB.normal, 0.0));
- 338: var_FadeDepth = fadeDepth.zw;
- 339: #elif defined(USE_VERTEX_SPRITE)
- 340: vec4 fadeDepth = u_ModelViewProjectionMatrix * (position - depthScale * vec4(LB.normal, 0.0));
- 341: var_FadeDepth = fadeDepth.zw;
- 342: #endif
- 343:
- 344: var_Color = color;
- 345:
- 346: SETUP_SHADER_PARMS
- 347: }
- Warn: Compile log:
- 0:94(14): error: `gl_DrawIDARB' undeclared
- 0:95(20): error: `gl_BaseInstanceARB' undeclared
- Warn: Unhandled exception (15ShaderException): Couldn't compile vertex shader: generic2D
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement