Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Debug: building generic shader permutation with macro: GENERIC_2D
- Warn: Unableto parse shader info log errors: unknown format
- Warn: Source for shader program generic2D:
- 0: #version 450 core
- 1: #define HAVE_EXT_gpu_shader4 1
- 2: #define HAVE_ARB_gpu_shader5 1
- 3: #define HAVE_ARB_texture_gather 1
- 4: #define HAVE_EXT_texture_integer 1
- 5: #define HAVE_ARB_texture_rg 1
- 6: #define HAVE_ARB_uniform_buffer_object 1
- 7: #extension GL_ARB_shader_draw_parameters : require
- 8: #define HAVE_ARB_shader_draw_parameters 1
- 9: #define HAVE_ARB_shader_storage_buffer_object 1
- 10: #ifndef r_AmbientScale
- 11: #define r_AmbientScale 1.00000000e+00
- 12: #endif
- 13: #ifndef r_SpecularScale
- 14: #define r_SpecularScale 1.00000000e+00
- 15: #endif
- 16: #ifndef r_zNear
- 17: #define r_zNear 3.00000000e+00
- 18: #endif
- 19: #ifndef M_PI
- 20: #define M_PI 3.14159274e+00
- 21: #endif
- 22: #ifndef MAX_SHADOWMAPS
- 23: #define MAX_SHADOWMAPS 5
- 24: #endif
- 25: #ifndef MAX_REF_LIGHTS
- 26: #define MAX_REF_LIGHTS 1024
- 27: #endif
- 28: #ifndef TILE_SIZE
- 29: #define TILE_SIZE 16
- 30: #endif
- 31: #ifndef r_FBufSize
- 32: #define r_FBufSize vec2(6.40000000e+02, 4.80000000e+02)
- 33: #endif
- 34: #ifndef r_tileStep
- 35: #define r_tileStep vec2(2.49999985e-02, 3.33333313e-02)
- 36: #endif
- 37: #ifndef r_highPrecisionRendering
- 38: #define r_highPrecisionRendering 1
- 39: #endif
- 40: #ifndef r_precomputedLighting
- 41: #define r_precomputedLighting 1
- 42: #endif
- 43: #ifndef r_vertexSkinning
- 44: #define r_vertexSkinning 1
- 45: #endif
- 46: const int MAX_GLSL_BONES = 256;
- 47: #ifndef r_halfLambertLighting
- 48: #define r_halfLambertLighting 1
- 49: #endif
- 50: #ifndef r_glowMapping
- 51: #define r_glowMapping 1
- 52: #endif
- 53: #ifndef r_zNear
- 54: #define r_zNear 3.00000000e+00
- 55: #endif
- 56: #define IN in
- 57: #define OUT(mode) mode out
- 58: #define textureCube texture
- 59: #define texture2D texture
- 60: #define texture2DProj textureProj
- 61: #define texture3D texture
- 62: OUT(flat) int in_drawID;
- 63: OUT(flat) int in_baseInstance;
- 64: #define drawID gl_DrawIDARB
- 65: #define baseInstance gl_BaseInstanceARB
- 66:
- 67: #ifndef GENERIC_2D
- 68: #define GENERIC_2D 1
- 69: #endif
- 70: /*
- 71: ===========================================================================
- 72: Copyright (C) 2006-2011 Robert Beckebans <trebor_7@users.sourceforge.net>
- 73:
- 74: This file is part of XreaL source code.
- 75:
- 76: XreaL source code is free software; you can redistribute it
- 77: and/or modify it under the terms of the GNU General Public License as
- 78: published by the Free Software Foundation; either version 2 of the License,
- 79: or (at your option) any later version.
- 80:
- 81: XreaL source code is distributed in the hope that it will be
- 82: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- 83: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 84: GNU General Public License for more details.
- 85:
- 86: You should have received a copy of the GNU General Public License
- 87: along with XreaL source code; if not, write to the Free Software
- 88: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- 89: ===========================================================================
- 90: */
- 91:
- 92: /* generic_vp.glsl */
- 93:
- 10000: #line 10000 // vertexSimple_vp.glsl
- 10001: /*
- 10002: ===========================================================================
- 10003: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
- 10004:
- 10005: This file is part of XreaL source code.
- 10006:
- 10007: XreaL source code is free software; you can redistribute it
- 10008: and/or modify it under the terms of the GNU General Public License as
- 10009: published by the Free Software Foundation; either version 2 of the License,
- 10010: or (at your option) any later version.
- 10011:
- 10012: XreaL source code is distributed in the hope that it will be
- 10013: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- 10014: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 10015: GNU General Public License for more details.
- 10016:
- 10017: You should have received a copy of the GNU General Public License
- 10018: along with XreaL source code; if not, write to the Free Software
- 10019: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- 10020: ===========================================================================
- 10021: */
- 10022: // vertexSimple_vp.glsl - simple vertex fetch
- 10023:
- 10024: struct localBasis {
- 10025: vec3 normal;
- 10026: vec3 tangent, binormal;
- 10027: };
- 10028:
- 10029: vec3 QuatTransVec(in vec4 quat, in vec3 vec) {
- 10030: vec3 tmp = 2.0 * cross( quat.xyz, vec );
- 10031: return vec + quat.w * tmp + cross( quat.xyz, tmp );
- 10032: }
- 10033:
- 10034: void QTangentToLocalBasis( in vec4 qtangent, out localBasis LB ) {
- 10035: LB.normal = QuatTransVec( qtangent, vec3( 0.0, 0.0, 1.0 ) );
- 10036: LB.tangent = QuatTransVec( qtangent, vec3( 1.0, 0.0, 0.0 ) );
- 10037: LB.tangent *= sign( qtangent.w );
- 10038: LB.binormal = QuatTransVec( qtangent, vec3( 0.0, 1.0, 0.0 ) );
- 10039: }
- 10040:
- 10041: #if !defined(USE_VERTEX_ANIMATION) && !defined(USE_VERTEX_SKINNING) && !defined(USE_VERTEX_SPRITE)
- 10042:
- 10043: IN vec3 attr_Position;
- 10044: IN vec4 attr_Color;
- 10045: IN vec4 attr_QTangent;
- 10046: IN vec4 attr_TexCoord0;
- 10047:
- 10048: void VertexFetch(out vec4 position,
- 10049: out localBasis normalBasis,
- 10050: out vec4 color,
- 10051: out vec2 texCoord,
- 10052: out vec2 lmCoord)
- 10053: {
- 10054: position = vec4( attr_Position, 1.0 );
- 10055: QTangentToLocalBasis( attr_QTangent, normalBasis );
- 10056: color = attr_Color;
- 10057: texCoord = attr_TexCoord0.xy;
- 10058: lmCoord = attr_TexCoord0.zw;
- 10059: }
- 10060: #endif
- 92: #line 92
- 20000: #line 20000 // vertexSkinning_vp.glsl
- 20001: /*
- 20002: ===========================================================================
- 20003: Copyright (C) 2009-2011 Robert Beckebans <trebor_7@users.sourceforge.net>
- 20004:
- 20005: This file is part of XreaL source code.
- 20006:
- 20007: XreaL source code is free software; you can redistribute it
- 20008: and/or modify it under the terms of the GNU General Public License as
- 20009: published by the Free Software Foundation; either version 2 of the License,
- 20010: or (at your option) any later version.
- 20011:
- 20012: XreaL source code is distributed in the hope that it will be
- 20013: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- 20014: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 20015: GNU General Public License for more details.
- 20016:
- 20017: You should have received a copy of the GNU General Public License
- 20018: along with XreaL source code; if not, write to the Free Software
- 20019: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- 20020: ===========================================================================
- 20021: */
- 20022: // vertexSkinning_vp.glsl - GPU vertex skinning for skeletal meshes
- 20023:
- 20024: #if defined(USE_VERTEX_SKINNING)
- 20025:
- 20026: IN vec3 attr_Position;
- 20027: IN vec2 attr_TexCoord0;
- 20028: IN vec4 attr_Color;
- 20029: IN vec4 attr_QTangent;
- 20030: IN vec4 attr_BoneFactors;
- 20031:
- 20032: // even elements are rotation quat, odd elements are translation + scale (in .w)
- 20033: uniform vec4 u_Bones[ 2 * MAX_GLSL_BONES ];
- 20034:
- 20035: void VertexFetch(out vec4 position,
- 20036: out localBasis LB,
- 20037: out vec4 color,
- 20038: out vec2 texCoord,
- 20039: out vec2 lmCoord)
- 20040: {
- 20041: const float scale = 1.0 / 256.0;
- 20042: const float weightScale = 1.0 / 255.0;
- 20043: localBasis inLB;
- 20044:
- 20045: // Unpack data from "bone factors". This used to have the index in the high byte and the weight
- 20046: // in the low byte, which may seem a bit more logical, but it triggered issues with some
- 20047: // Nvidia shader compilers (https://github.com/DaemonEngine/Daemon/issues/472).
- 20048: vec4 ipart = floor( attr_BoneFactors * scale );
- 20049: vec4 fpart = attr_BoneFactors * scale - ipart;
- 20050: // idx = 2 times the original bone index (the index input to boneFactor)
- 20051: ivec4 idx = ivec4( fpart * 512.0 );
- 20052: vec4 weights = ipart * weightScale;
- 20053:
- 20054: vec4 quat = u_Bones[ idx.x ];
- 20055: vec4 trans = u_Bones[ idx.x + 1 ];
- 20056:
- 20057: QTangentToLocalBasis( attr_QTangent, inLB );
- 20058:
- 20059: position.xyz = weights.x * (QuatTransVec( quat, attr_Position ) * trans.w + trans.xyz);
- 20060: LB.normal = weights.x * (QuatTransVec( quat, inLB.normal ));
- 20061: LB.tangent = weights.x * (QuatTransVec( quat, inLB.tangent ));
- 20062: LB.binormal = weights.x * (QuatTransVec( quat, inLB.binormal ));
- 20063:
- 20064: quat = u_Bones[ idx.y ];
- 20065: trans = u_Bones[ idx.y + 1 ];
- 20066:
- 20067: position.xyz += weights.y * (QuatTransVec( quat, attr_Position ) * trans.w + trans.xyz);
- 20068: LB.normal += weights.y * (QuatTransVec( quat, inLB.normal ));
- 20069: LB.tangent += weights.y * (QuatTransVec( quat, inLB.tangent ));
- 20070: LB.binormal += weights.y * (QuatTransVec( quat, inLB.binormal ));
- 20071:
- 20072: quat = u_Bones[ idx.z ];
- 20073: trans = u_Bones[ idx.z + 1 ];
- 20074:
- 20075: position.xyz += weights.z * (QuatTransVec( quat, attr_Position ) * trans.w + trans.xyz);
- 20076: LB.normal += weights.z * (QuatTransVec( quat, inLB.normal ));
- 20077: LB.tangent += weights.z * (QuatTransVec( quat, inLB.tangent ));
- 20078: LB.binormal += weights.z * (QuatTransVec( quat, inLB.binormal ));
- 20079:
- 20080: quat = u_Bones[ idx.w ];
- 20081: trans = u_Bones[ idx.w + 1 ];
- 20082:
- 20083: position.xyz += weights.w * (QuatTransVec( quat, attr_Position ) * trans.w + trans.xyz);
- 20084: LB.normal += weights.w * (QuatTransVec( quat, inLB.normal ));
- 20085: LB.tangent += weights.w * (QuatTransVec( quat, inLB.tangent ));
- 20086: LB.binormal += weights.w * (QuatTransVec( quat, inLB.binormal ));
- 20087:
- 20088: position.w = 1.0;
- 20089: LB.normal = normalize(LB.normal);
- 20090: LB.tangent = normalize(LB.tangent);
- 20091: LB.binormal = normalize(LB.binormal);
- 20092:
- 20093: color = attr_Color;
- 20094: texCoord = attr_TexCoord0;
- 20095: lmCoord = attr_TexCoord0;
- 20096: }
- 20097: #endif
- 93: #line 93
- 30000: #line 30000 // vertexAnimation_vp.glsl
- 30001: /*
- 30002: ===========================================================================
- 30003: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
- 30004:
- 30005: This file is part of XreaL source code.
- 30006:
- 30007: XreaL source code is free software; you can redistribute it
- 30008: and/or modify it under the terms of the GNU General Public License as
- 30009: published by the Free Software Foundation; either version 2 of the License,
- 30010: or (at your option) any later version.
- 30011:
- 30012: XreaL source code is distributed in the hope that it will be
- 30013: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- 30014: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 30015: GNU General Public License for more details.
- 30016:
- 30017: You should have received a copy of the GNU General Public License
- 30018: along with XreaL source code; if not, write to the Free Software
- 30019: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- 30020: ===========================================================================
- 30021: */
- 30022: // vertexAnimation_vp.glsl - interpolates .md3/.mdc vertex animations
- 30023:
- 30024: #if defined(USE_VERTEX_ANIMATION)
- 30025:
- 30026: IN vec3 attr_Position;
- 30027: IN vec4 attr_Color;
- 30028: IN vec4 attr_QTangent;
- 30029: IN vec2 attr_TexCoord0;
- 30030: IN vec3 attr_Position2;
- 30031: IN vec4 attr_QTangent2;
- 30032:
- 30033: uniform float u_VertexInterpolation;
- 30034:
- 30035: void VertexAnimation_P_N( vec3 fromPosition, vec3 toPosition,
- 30036: vec4 fromQTangent, vec4 toQTangent,
- 30037: float frac,
- 30038: inout vec4 position, inout vec3 normal)
- 30039: {
- 30040: vec3 fromNormal = QuatTransVec( fromQTangent, vec3( 0.0, 0.0, 1.0 ) );
- 30041: vec3 toNormal = QuatTransVec( toQTangent, vec3( 0.0, 0.0, 1.0 ) );
- 30042:
- 30043: position.xyz = 512.0 * mix(fromPosition, toPosition, frac);
- 30044: position.w = 1;
- 30045:
- 30046: normal = normalize(mix(fromNormal, toNormal, frac));
- 30047: }
- 30048:
- 30049: void VertexFetch(out vec4 position,
- 30050: out localBasis LB,
- 30051: out vec4 color,
- 30052: out vec2 texCoord,
- 30053: out vec2 lmCoord)
- 30054: {
- 30055: localBasis fromLB, toLB;
- 30056:
- 30057: QTangentToLocalBasis( attr_QTangent, fromLB );
- 30058: QTangentToLocalBasis( attr_QTangent2, toLB );
- 30059:
- 30060: position.xyz = 512.0 * mix(attr_Position, attr_Position2, u_VertexInterpolation);
- 30061: position.w = 1;
- 30062:
- 30063: LB.normal = normalize(mix(fromLB.normal, toLB.normal, u_VertexInterpolation));
- 30064: LB.tangent = normalize(mix(fromLB.tangent, toLB.tangent, u_VertexInterpolation));
- 30065: LB.binormal = normalize(mix(fromLB.binormal, toLB.binormal, u_VertexInterpolation));
- 30066:
- 30067: color = attr_Color;
- 30068: texCoord = attr_TexCoord0;
- 30069: lmCoord = attr_TexCoord0;
- 30070: }
- 30071: #endif
- 94: #line 94
- 40000: #line 40000 // vertexSprite_vp.glsl
- 40001: /*
- 40002: ===========================================================================
- 40003: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
- 40004:
- 40005: This file is part of XreaL source code.
- 40006:
- 40007: XreaL source code is free software; you can redistribute it
- 40008: and/or modify it under the terms of the GNU General Public License as
- 40009: published by the Free Software Foundation; either version 2 of the License,
- 40010: or (at your option) any later version.
- 40011:
- 40012: XreaL source code is distributed in the hope that it will be
- 40013: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- 40014: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 40015: GNU General Public License for more details.
- 40016:
- 40017: You should have received a copy of the GNU General Public License
- 40018: along with XreaL source code; if not, write to the Free Software
- 40019: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- 40020: ===========================================================================
- 40021: */
- 40022: // vertexSprite_vp.glsl - sprite vertex fetch
- 40023:
- 40024: #if defined(USE_VERTEX_SPRITE)
- 40025:
- 40026: IN vec3 attr_Position;
- 40027: IN vec4 attr_Color;
- 40028: IN vec4 attr_TexCoord0;
- 40029: IN vec4 attr_Orientation;
- 40030:
- 40031: uniform vec3 u_ViewOrigin;
- 40032: uniform vec3 u_ViewUp;
- 40033:
- 40034: float depthScale;
- 40035:
- 40036: void VertexFetch(out vec4 position,
- 40037: out localBasis normalBasis,
- 40038: out vec4 color,
- Warn: Compile log:
- Warn: 0:132(2): error: syntax error, unexpected BASIC_TYPE_TOK, expecting ',' or ';'
- Warn: Unhandled exception (15ShaderException): Couldn't compile vertex shader: generic2D
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement