/////////////////////////////////////////////////////////////////////////////// // // ## ###### // ###### ### // ## ############### Shark 3D Engine (www.shark3d.com) // ########## # # # // ######## Copyright (c) 1996-2006 Spinor GmbH. // ######### # # # All rights reserved. // ## ########## // ## // /////////////////////////////////////////////////////////////////////////////// @include "levelutil/shader/prog/ogl_glsl/" \ "include_stddef_ogl_glsl_vs1x0.s3d_shadercode_run" /////////////////////////////////////////////////////////////////////////////// uniform vec4 lightCenRange; uniform vec4 lightExtrude; S3D_BONE_DECL_STD(boneWgh, boneSubscr) S3D_MATBONE_DECL_STD(matBone) /////////////////////////////////////////////////////////////////////////////// void main(void) { S3D_BONE_TRANSF_STD(matBoneFinal, matBone, boneWgh, boneSubscr); vec4 posView = matBoneFinal * gl_Vertex; vec3 normalView = normalize((matBoneFinal * vec4(gl_Normal, 0.0)).xyz); vec3 effLightCenRange = lightCenRange.xyz; @ifdef S3D_USE_BLOAT // Bloat: effLightCenRange.xyz -= normalView * lightExtrude.z; @endif // Calculate normalized extrusion direction vector: vec3 dirNrm = normalize(posView.xyz - effLightCenRange.xyz); // Extrude: float prod = dot(dirNrm, normalView) * lightExtrude.w; // Important! If the product is zero, extrusion must be off. float sign = (prod > 0.0) ? 1.0 : 0.0; float move = sign * lightExtrude.x + lightExtrude.y; posView.xyz = move * dirNrm + posView.xyz; // Transform: gl_Position = gl_ProjectionMatrix * posView; } ///////////////////////////////////////////////////////////////////////////////