Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Debug: building generic shader permutation with macro: GENERIC_2D
- Warn: Source for shader program generic2D:
- 0: #version 460 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: #define IN in
- 11: #define OUT(mode) mode out
- 12: #define textureCube texture
- 13: #define texture2D texture
- 14: #define texture2DProj textureProj
- 15: #define texture3D texture
- 16: OUT(flat) int in_drawID;
- 17: OUT(flat) int in_baseInstance;
- 18: #define drawID gl_DrawIDARB
- 19: #define baseInstance gl_BaseInstanceARB
- 20:
- 21: #ifndef r_highPrecisionRendering
- 22: #define r_highPrecisionRendering 1
- 23: #endif
- 24: #ifndef r_precomputedLighting
- 25: #define r_precomputedLighting 1
- 26: #endif
- 27: #ifndef r_vertexSkinning
- 28: #define r_vertexSkinning 1
- 29: #endif
- 30: const int MAX_GLSL_BONES = 256;
- 31: #ifndef r_halfLambertLighting
- 32: #define r_halfLambertLighting 1
- 33: #endif
- 34: #ifndef r_glowMapping
- 35: #define r_glowMapping 1
- 36: #endif
- 37: #ifndef r_zNear
- 38: #define r_zNear 3.00000000e+00
- 39: #endif
- 40: #ifndef GENERIC_2D
- 41: #define GENERIC_2D 1
- 42: #endif
- 43: #ifndef r_AmbientScale
- 44: #define r_AmbientScale 1.00000000e+00
- 45: #endif
- 46: #ifndef r_SpecularScale
- 47: #define r_SpecularScale 1.00000000e+00
- 48: #endif
- 49: #ifndef r_zNear
- 50: #define r_zNear 3.00000000e+00
- 51: #endif
- 52: #ifndef M_PI
- 53: #define M_PI 3.14159274e+00
- 54: #endif
- 55: #ifndef MAX_SHADOWMAPS
- 56: #define MAX_SHADOWMAPS 5
- 57: #endif
- 58: #ifndef MAX_REF_LIGHTS
- 59: #define MAX_REF_LIGHTS 1024
- 60: #endif
- 61: #ifndef TILE_SIZE
- 62: #define TILE_SIZE 16
- 63: #endif
- 64: #ifndef r_FBufSize
- 65: #define r_FBufSize vec2(6.40000000e+02, 4.80000000e+02)
- 66: #endif
- 67: #ifndef r_tileStep
- 68: #define r_tileStep vec2(2.50000004e-02, 3.33333351e-02)
- 69: #endif
- 0: #line 0
- 1: /*
- 2: ===========================================================================
- 3: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
- 4:
- 5: This file is part of XreaL source code.
- 6:
- 7: XreaL source code is free software; you can redistribute it
- 8: and/or modify it under the terms of the GNU General Public License as
- 9: published by the Free Software Foundation; either version 2 of the License,
- 10: or (at your option) any later version.
- 11:
- 12: XreaL source code is distributed in the hope that it will be
- 13: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 15: GNU General Public License for more details.
- 16:
- 17: You should have received a copy of the GNU General Public License
- 18: along with XreaL source code; if not, write to the Free Software
- 19: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- 20: ===========================================================================
- 21: */
- 22: // vertexSimple_vp.glsl - simple vertex fetch
- 23:
- 24: struct localBasis {
- 25: vec3 normal;
- 26: vec3 tangent, binormal;
- 27: };
- 28:
- 29: vec3 QuatTransVec(in vec4 quat, in vec3 vec) {
- 30: vec3 tmp = 2.0 * cross( quat.xyz, vec );
- 31: return vec + quat.w * tmp + cross( quat.xyz, tmp );
- 32: }
- 33:
- 34: void QTangentToLocalBasis( in vec4 qtangent, out localBasis LB ) {
- 35: LB.normal = QuatTransVec( qtangent, vec3( 0.0, 0.0, 1.0 ) );
- 36: LB.tangent = QuatTransVec( qtangent, vec3( 1.0, 0.0, 0.0 ) );
- 37: LB.tangent *= sign( qtangent.w );
- 38: LB.binormal = QuatTransVec( qtangent, vec3( 0.0, 1.0, 0.0 ) );
- 39: }
- 40:
- 41: #if !defined(USE_VERTEX_ANIMATION) && !defined(USE_VERTEX_SKINNING) && !defined(USE_VERTEX_SPRITE)
- 42:
- 43: IN vec3 attr_Position;
- 44: IN vec4 attr_Color;
- 45: IN vec4 attr_QTangent;
- 46: IN vec4 attr_TexCoord0;
- 47:
- 48: void VertexFetch(out vec4 position,
- 49: out localBasis normalBasis,
- 50: out vec4 color,
- 51: out vec2 texCoord,
- 52: out vec2 lmCoord)
- 53: {
- 54: position = vec4( attr_Position, 1.0 );
- 55: QTangentToLocalBasis( attr_QTangent, normalBasis );
- 56: color = attr_Color;
- 57: texCoord = attr_TexCoord0.xy;
- 58: lmCoord = attr_TexCoord0.zw;
- 59: }
- 60: #endif
- 0: #line 0
- 1: /*
- 2: ===========================================================================
- 3: Copyright (C) 2010 Robert Beckebans <trebor_7@users.sourceforge.net>
- 4:
- 5: This file is part of XreaL source code.
- 6:
- 7: XreaL source code is free software; you can redistribute it
- 8: and/or modify it under the terms of the GNU General Public License as
- 9: published by the Free Software Foundation; either version 2 of the License,
- 10: or (at your option) any later version.
- 11:
- 12: XreaL source code is distributed in the hope that it will be
- 13: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 15: GNU General Public License for more details.
- 16:
- 17: You should have received a copy of the GNU General Public License
- 18: along with XreaL source code; if not, write to the Free Software
- 19: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- 20: ===========================================================================
- 21: */
- 22: // vertexSprite_vp.glsl - sprite vertex fetch
- 23:
- 24: #if defined(USE_VERTEX_SPRITE)
- 25:
- 26: IN vec3 attr_Position;
- 27: IN vec4 attr_Color;
- 28: IN vec4 attr_TexCoord0;
- 29: IN vec4 attr_Orientation;
- 30:
- 31: uniform vec3 u_ViewOrigin;
- 32: uniform vec3 u_ViewUp;
- 33:
- 34: float depthScale;
- 35:
- 36: void VertexFetch(out vec4 position,
- 37: out localBasis normalBasis,
- 38: out vec4 color,
- 39: out vec2 texCoord,
- 40: out vec2 lmCoord)
- 41: {
- 42: vec2 corner;
- 43: float radius = attr_Orientation.w;
- 44: vec3 normal = normalize( u_ViewOrigin - attr_Position ), up, left;
- 45: float s, c; // sin & cos of rotation factor
- 46:
- 47: corner = sign( attr_TexCoord0.zw );
- 48:
- 49: if( radius <= 0.0 ) {
- 50: // autosprite2 mode, attr_Orientation.xyz contains the up-vector
- 51: up = attr_Orientation.xyz;
- 52: left = radius * normalize( cross( up, normal ) );
- 53: position = vec4( attr_Position + corner.y * left, 1.0 );
- 54: } else {
- 55: // autosprite mode, attr_Orientation.x contains the rotation angle
- 56: left = normalize( cross( u_ViewUp, normal ) );
- 57: up = cross( left, normal );
- 58:
- 59: s = radius * sin( radians( attr_Orientation.x ) );
- 60: c = radius * cos( radians( attr_Orientation.x ) );
- 61:
- 62: // rotate left and up vectors
- 63: vec3 leftOrig = left;
- 64: left = c * left + s * up;
- 65: up = c * up - s * leftOrig;
- 66:
- 67: left *= corner.x;
- 68: up *= corner.y;
- 69:
- 70: position = vec4( attr_Position + left + up, 1.0 );
- 71: }
- 72: normalBasis.normal = normal;
- 73: normalBasis.tangent = normalize( up );
- 74: normalBasis.binormal = normalize( left );
- 75:
- 76: texCoord = 0.5 * corner + 0.5; //attr_TexCoord0.xy;
- 77: lmCoord = abs( attr_TexCoord0.zw );
- 78: color = attr_Color;
- 79:
- 80: depthScale = 2.0 * radius;
- 81: }
- 82: #endif
- 0: #line 0
- 1: /*
- 2: ===========================================================================
- 3: Copyright (C) 2006-2011 Robert Beckebans <trebor_7@users.sourceforge.net>
- 4:
- 5: This file is part of XreaL source code.
- 6:
- 7: XreaL source code is free software; you can redistribute it
- 8: and/or modify it under the terms of the GNU General Public License as
- 9: published by the Free Software Foundation; either version 2 of the License,
- 10: or (at your option) any later version.
- 11:
- 12: XreaL source code is distributed in the hope that it will be
- 13: useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 15: GNU General Public License for more details.
- 16:
- 17: You should have received a copy of the GNU General Public License
- 18: along with XreaL source code; if not, write to the Free Software
- 19: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- 20: ===========================================================================
- 21: */
- 22:
- 23: /* generic_vp.glsl */
- 24:
- 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
- 25: #line 25
- 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
- 26: #line 26
- 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
- 27: #line 27
- 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,
- 40039: out vec2 texCoord,
- 40040: out vec2 lmCoord)
- 40041: {
- 40042: vec2 corner;
- 40043: float radius = attr_Orientation.w;
- 40044: vec3 normal = normalize( u_ViewOrigin - attr_Position ), up, left;
- 40045: float s, c; // sin & cos of rotation factor
- 40046:
- 40047: corner = sign( attr_TexCoord0.zw );
- 40048:
- 40049: if( radius <= 0.0 ) {
- 40050: // autosprite2 mode, attr_Orientation.xyz contains the up-vector
- 40051: up = attr_Orientation.xyz;
- 40052: left = radius * normalize( cross( up, normal ) );
- 40053: position = vec4( attr_Position + corner.y * left, 1.0 );
- 40054: } else {
- 40055: // autosprite mode, attr_Orientation.x contains the rotation angle
- 40056: left = normalize( cross( u_ViewUp, normal ) );
- 40057: up = cross( left, normal );
- 40058:
- 40059: s = radius * sin( radians( attr_Orientation.x ) );
- 40060: c = radius * cos( radians( attr_Orientation.x ) );
- 40061:
- 40062: // rotate left and up vectors
- 40063: vec3 leftOrig = left;
- 40064: left = c * left + s * up;
- 40065: up = c * up - s * leftOrig;
- 40066:
- 40067: left *= corner.x;
- 40068: up *= corner.y;
- 40069:
- 40070: position = vec4( attr_Position + left + up, 1.0 );
- 40071: }
- 40072: normalBasis.normal = normal;
- 40073: normalBasis.tangent = normalize( up );
- 40074: normalBasis.binormal = normalize( left );
- 40075:
- 40076: texCoord = 0.5 * corner + 0.5; //attr_TexCoord0.xy;
- 40077: lmCoord = abs( attr_TexCoord0.zw );
- 40078: color = attr_Color;
- 40079:
- 40080: depthScale = 2.0 * radius;
- 40081: }
- 40082: #endif
- 28: #line 28
- 29:
- 30: uniform mat4 u_TextureMatrix;
- 31: #if !defined(USE_VERTEX_SPRITE)
- 32: uniform vec3 u_ViewOrigin;
- 33: #endif
- 34:
- 35: uniform float u_Time;
- 36:
- 37: uniform vec4 u_ColorModulate;
- 38: uniform vec4 u_Color;
- 39: #if defined(USE_TCGEN_ENVIRONMENT)
- 40: uniform mat4 u_ModelMatrix;
- 41: #endif
- 42: uniform mat4 u_ModelViewProjectionMatrix;
- 43:
- 44: #if defined(USE_VERTEX_SPRITE)
- 45: OUT(smooth) vec2 var_FadeDepth;
- 46: uniform mat4 u_ProjectionMatrixTranspose;
- 47: #elif defined(USE_DEPTH_FADE)
- 48: uniform float u_DepthScale;
- 49: OUT(smooth) vec2 var_FadeDepth;
- 50: #endif
- 51:
- 52: OUT(smooth) vec2 var_TexCoords;
- 53: OUT(smooth) vec4 var_Color;
- 54:
- 55: void DeformVertex( inout vec4 pos,
- 56: inout vec3 normal,
- 57: inout vec2 st,
- 58: inout vec4 color,
- 59: in float time);
- 60:
- 61: void main()
- 62: {
- 50000: #line 50000 // material_vp.glsl
- 50001: /*
- 50002: ===========================================================================
- 50003:
- 50004: Daemon BSD Source Code
- 50005: Copyright (c) 2024 Daemon Developers
- 50006: All rights reserved.
- 50007:
- 50008: This file is part of the Daemon BSD Source Code (Daemon Source Code).
- 50009:
- 50010: Redistribution and use in source and binary forms, with or without
- 50011: modification, are permitted provided that the following conditions are met:
- 50012: * Redistributions of source code must retain the above copyright
- 50013: notice, this list of conditions and the following disclaimer.
- 50014: * Redistributions in binary form must reproduce the above copyright
- 50015: notice, this list of conditions and the following disclaimer in the
- 50016: documentation and/or other materials provided with the distribution.
- 50017: * Neither the name of the Daemon developers nor the
- 50018: names of its contributors may be used to endorse or promote products
- 50019: derived from this software without specific prior written permission.
- 50020:
- 50021: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- 50022: ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- 50023: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- 50024: DISCLAIMED. IN NO EVENT SHALL DAEMON DEVELOPERS BE LIABLE FOR ANY
- 50025: DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- 50026: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- 50027: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- 50028: ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- 50029: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- 50030: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- 50031:
- 50032: ===========================================================================
- 50033: */
- 50034:
- 50035: /* material_vp.glsl */
- 50036:
- 50037: #if defined(USE_MATERIAL_SYSTEM)
- 50038:
- 50039: #ifdef HAVE_ARB_shader_draw_parameters
- 50040: in_drawID = drawID;
- 50041: in_baseInstance = baseInstance;
- 50042: #endif // !HAVE_ARB_shader_draw_parameters
- 50043:
- 50044: #endif // !USE_MATERIAL_SYSTEM
- 63: #line 63
- 64: a
- 65: vec4 position;
- 66: localBasis LB;
- 67: vec4 color;
- 68: vec2 texCoord, lmCoord;
- 69:
- 70: VertexFetch( position, LB, color, texCoord, lmCoord );
- 71: color = color * u_ColorModulate + u_Color;
- 72:
- 73: DeformVertex( position,
- 74: LB.normal,
- 75: texCoord,
- 76: color,
- 77: u_Time);
- 78:
- 79: // transform vertex position into homogenous clip-space
- 80: gl_Position = u_ModelViewProjectionMatrix * position;
- 81:
- 82: // transform texcoords
- 83: #if defined(USE_TCGEN_ENVIRONMENT)
- 84: {
- 85: // TODO: Explain why only the rotational part of u_ModelMatrix is relevant
- 86: position.xyz = mat3(u_ModelMatrix) * position.xyz;
- 87:
- 88: vec3 viewer = normalize(u_ViewOrigin - position.xyz);
- 89:
- 90: float d = dot(LB.normal, viewer);
- 91:
- 92: vec3 reflected = LB.normal * 2.0 * d - viewer;
- 93:
- 94: var_TexCoords = 0.5 + vec2(0.5, -0.5) * reflected.yz;
- 95: }
- 96: #elif defined(USE_TCGEN_LIGHTMAP)
- 97: var_TexCoords = (u_TextureMatrix * vec4(lmCoord, 0.0, 1.0)).xy;
- 98: #else
- 99: var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).xy;
- 100: #endif
- 101:
- 102: #if defined(USE_DEPTH_FADE)
- 103: // compute z of end of fading effect
- 104: vec4 fadeDepth = u_ModelViewProjectionMatrix * (position - u_DepthScale * vec4(LB.normal, 0.0));
- 105: var_FadeDepth = fadeDepth.zw;
- 106: #elif defined(USE_VERTEX_SPRITE)
- 107: vec4 fadeDepth = u_ModelViewProjectionMatrix * (position - depthScale * vec4(LB.normal, 0.0));
- 108: var_FadeDepth = fadeDepth.zw;
- 109: #endif
- 110:
- 111: var_Color = color;
- 112: }
- Warn: Compile log:
- 0:64(2): error: syntax error, unexpected BASIC_TYPE_TOK, expecting ',' or ';'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement