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_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_bindless_texture : require
- 8: #define HAVE_ARB_bindless_texture 1
- 9: #extension GL_ARB_shader_draw_parameters : require
- 10: #define HAVE_ARB_shader_draw_parameters 1
- 11: #define HAVE_ARB_shader_storage_buffer_object 1
- 12: #define IN in
- 13: #define OUT(mode) mode out
- 14: #define textureCube texture
- 15: #define texture2D texture
- 16: #define texture2DProj textureProj
- 17: #define texture3D texture
- 18: OUT(flat) int in_drawID;
- 19: OUT(flat) int in_baseInstance;
- 20: #define drawID gl_DrawIDARB
- 21: #define baseInstance gl_BaseInstanceARB
- 22:
- 23: #ifndef r_highPrecisionRendering
- 24: #define r_highPrecisionRendering 1
- 25: #endif
- 26: #ifndef r_dynamicLight
- 27: #define r_dynamicLight 1
- 28: #endif
- 29: #ifndef r_dynamicLightRenderer
- 30: #define r_dynamicLightRenderer 1
- 31: #endif
- 32: #ifndef r_precomputedLighting
- 33: #define r_precomputedLighting 1
- 34: #endif
- 35: #ifndef r_vertexSkinning
- 36: #define r_vertexSkinning 1
- 37: #endif
- 38: const int MAX_GLSL_BONES = 256;
- 39: #ifndef r_halfLambertLighting
- 40: #define r_halfLambertLighting 1
- 41: #endif
- 42: #ifndef r_rimLighting
- 43: #define r_rimLighting 1
- 44: #endif
- 45: const float r_RimExponent = 3.00000000e+00;
- 46: #ifndef r_normalMapping
- 47: #define r_normalMapping 1
- 48: #endif
- 49: #ifndef r_specularMapping
- 50: #define r_specularMapping 1
- 51: #endif
- 52: #ifndef r_physicalMapping
- 53: #define r_physicalMapping 1
- 54: #endif
- 55: #ifndef r_glowMapping
- 56: #define r_glowMapping 1
- 57: #endif
- 58: #ifndef GENERIC_2D
- 59: #define GENERIC_2D 1
- 60: #endif
- 61: #ifndef r_AmbientScale
- 62: #define r_AmbientScale 1.00000000e+00
- 63: #endif
- 64: #ifndef r_SpecularScale
- 65: #define r_SpecularScale 1.00000000e+00
- 66: #endif
- 67: #ifndef r_zNear
- 68: #define r_zNear 3.00000000e+00
- 69: #endif
- 70: #ifndef M_PI
- 71: #define M_PI 3.14159274e+00
- 72: #endif
- 73: #ifndef MAX_SHADOWMAPS
- 74: #define MAX_SHADOWMAPS 5
- 75: #endif
- 76: #ifndef MAX_REF_LIGHTS
- 77: #define MAX_REF_LIGHTS 1024
- 78: #endif
- 79: #ifndef TILE_SIZE
- 80: #define TILE_SIZE 16
- 81: #endif
- 82: #ifndef r_FBufSize
- 83: #define r_FBufSize vec2(2.56000000e+03, 1.44000000e+03)
- 84: #endif
- 85: #ifndef r_tileStep
- 86: #define r_tileStep vec2(6.24999963e-03, 1.11111114e-02)
- 87: #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:
- 25: uniform mat4 u_TextureMatrix;
- 26: #if !defined(USE_VERTEX_SPRITE)
- 27: uniform vec3 u_ViewOrigin;
- 28: #endif
- 29:
- 30: uniform float u_Time;
- 31:
- 32: uniform vec4 u_ColorModulate;
- 33: uniform vec4 u_Color;
- 34: #if defined(USE_TCGEN_ENVIRONMENT)
- 35: uniform mat4 u_ModelMatrix;
- 36: #endif
- 37: uniform mat4 u_ModelViewProjectionMatrix;
- 38:
- 39: #if defined(USE_VERTEX_SPRITE)
- 40: OUT(smooth) vec2 var_FadeDepth;
- 41: uniform mat4 u_ProjectionMatrixTranspose;
- 42: #elif defined(USE_DEPTH_FADE)
- 43: uniform float u_DepthScale;
- 44: OUT(smooth) vec2 var_FadeDepth;
- 45: #endif
- 46:
- 47: OUT(smooth) vec2 var_TexCoords;
- 48: OUT(smooth) vec4 var_Color;
- 49:
- 50: void DeformVertex( inout vec4 pos,
- 51: inout vec3 normal,
- 52: inout vec2 st,
- 53: inout vec4 color,
- 54: in float time);
- 55:
- 56: void main()
- 57: {
- 58: /* Shader file: glsl/material_vp.glsl: */
- 10000: #line 10000
- 10001: /*
- 10002: ===========================================================================
- 10003:
- 10004: Daemon BSD Source Code
- 10005: Copyright (c) 2024 Daemon Developers
- 10006: All rights reserved.
- 10007:
- 10008: This file is part of the Daemon BSD Source Code (Daemon Source Code).
- 10009:
- 10010: Redistribution and use in source and binary forms, with or without
- 10011: modification, are permitted provided that the following conditions are met:
- 10012: * Redistributions of source code must retain the above copyright
- 10013: notice, this list of conditions and the following disclaimer.
- 10014: * Redistributions in binary form must reproduce the above copyright
- 10015: notice, this list of conditions and the following disclaimer in the
- 10016: documentation and/or other materials provided with the distribution.
- 10017: * Neither the name of the Daemon developers nor the
- 10018: names of its contributors may be used to endorse or promote products
- 10019: derived from this software without specific prior written permission.
- 10020:
- 10021: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- 10022: ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- 10023: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- 10024: DISCLAIMED. IN NO EVENT SHALL DAEMON DEVELOPERS BE LIABLE FOR ANY
- 10025: DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- 10026: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- 10027: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- 10028: ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- 10029: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- 10030: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- 10031:
- 10032: ===========================================================================
- 10033: */
- 10034:
- 10035: /* material_vp.glsl */
- 10036:
- 10037: #if defined(USE_MATERIAL_SYSTEM)
- 10038:
- 10039: #ifdef HAVE_ARB_shader_draw_parameters
- 10040: in_drawID = drawID;
- 10041: in_baseInstance = baseInstance;
- 10042: #endif // !HAVE_ARB_shader_draw_parameters
- 10043:
- 10044: #endif // !USE_MATERIAL_SYSTEM
- 59:
- 60: vec4 position;
- 61: localBasis LB;
- 62: vec4 color;
- 63: vec2 texCoord, lmCoord;
- 64:
- 65: VertexFetch( position, LB, color, texCoord, lmCoord );
- 66: color = color * u_ColorModulate + u_Color;
- 67:
- 68: DeformVertex( position,
- 69: LB.normal,
- 70: texCoord,
- 71: color,
- 72: u_Time);
- 73:
- 74: // transform vertex position into homogenous clip-space
- 75: gl_Position = u_ModelViewProjectionMatrix * position;
- 76:
- 77: // transform texcoords
- 78: #if defined(USE_TCGEN_ENVIRONMENT)
- 79: {
- 80: // TODO: Explain why only the rotational part of u_ModelMatrix is relevant
- 81: position.xyz = mat3(u_ModelMatrix) * position.xyz;
- 82:
- 83: vec3 viewer = normalize(u_ViewOrigin - position.xyz);
- 84:
- 85: float d = dot(LB.normal, viewer);
- 86:
- 87: vec3 reflected = LB.normal * 2.0 * d - viewer;
- 88:
- 89: var_TexCoords = 0.5 + vec2(0.5, -0.5) * reflected.yz;
- 90: }
- 91: #elif defined(USE_TCGEN_LIGHTMAP)
- 92: var_TexCoords = (u_TextureMatrix * vec4(lmCoord, 0.0, 1.0)).xy;
- 93: #else
- 94: var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).xy;
- 95: #endif
- 96:
- 97: #if defined(USE_DEPTH_FADE)
- 98: // compute z of end of fading effect
- 99: vec4 fadeDepth = u_ModelViewProjectionMatrix * (position - u_DepthScale * vec4(LB.normal, 0.0));
- 100: var_FadeDepth = fadeDepth.zw;
- 101: #elif defined(USE_VERTEX_SPRITE)
- 102: vec4 fadeDepth = u_ModelViewProjectionMatrix * (position - depthScale * vec4(LB.normal, 0.0));
- 103: var_FadeDepth = fadeDepth.zw;
- 104: #endif
- 105:
- 106: var_Color = color;
- 107: }
- Warn: Compile log:
- 0:58(9): preprocessor error: syntax error, unexpected '-', expecting INTEGER or INTEGER_STRING
- Warn: Unhandled exception (15ShaderException): Couldn't compile vertex shader: generic2D
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement