Advertisement
Guest User

9310a62897cf71f6_P.glsl

a guest
Sep 18th, 2015
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.85 KB | None | 0 0
  1. //*****************************************************************************
  2. // Torque -- GLSL procedural shader
  3. //*****************************************************************************
  4. #include "shaders/common/gl/hlslCompat.glsl"
  5.  
  6. // Dependencies:
  7. #include "shaders/common/gl/imposter.glsl"
  8. #include "shaders/common/gl/lighting.glsl"
  9. //------------------------------------------------------------------------------
  10. // Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method
  11. //------------------------------------------------------------------------------
  12. void autogenUncondition_bde4cbab(in vec4 bufferSample, out vec3 lightColor, out float NL_att, out float specular)
  13. {
  14.    lightColor = bufferSample.rgb;
  15.    NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192));
  16.    specular = bufferSample.a;
  17. }
  18.  
  19.  
  20. #include "shaders/common/gl/torque.glsl"
  21.  
  22. // Features:
  23. // Imposter Vert
  24. // Vert Position
  25. // Base Texture
  26. // Alpha Test
  27. // Bumpmap [Deferred]
  28. // Deferred RT Lighting
  29. // Visibility
  30. // HDR Output
  31. // DXTnm
  32.  
  33. in float _TEXCOORD0_;
  34. in vec2 _TEXCOORD1_;
  35. in vec4 _TEXCOORD2_;
  36. in vec4 _TEXCOORD3_;
  37.  
  38. // Struct defines
  39.  
  40. //Fragment shader OUT
  41. out vec4 OUT_col;
  42.  
  43.  
  44. //-----------------------------------------------------------------------------
  45. // Main                                                                        
  46. //-----------------------------------------------------------------------------
  47. uniform float    visibility     ;
  48. uniform sampler2D diffuseMap     ;
  49. uniform float    alphaTestValue ;
  50. uniform vec4     rtParamslightInfoBuffer;
  51. uniform sampler2D lightInfoBuffer;
  52.  
  53. void main()
  54. {
  55.    float visibility = visibility;
  56.    float alphaTestValue = alphaTestValue;
  57.    vec4 rtParamslightInfoBuffer = rtParamslightInfoBuffer;
  58.  
  59.    //-------------------------
  60.    float IN_imposterFade = _TEXCOORD0_;
  61.    vec2 IN_texCoord = _TEXCOORD1_;
  62.    vec4 IN_screenspacePos = _TEXCOORD2_;
  63.    vec4 IN_inVpos = _TEXCOORD3_;
  64.    //-------------------------
  65.  
  66.    // Imposter Vert
  67.    visibility *= IN_imposterFade;
  68.    
  69.    // Vert Position
  70.    
  71.    // Base Texture
  72.    OUT_col = tex2D(diffuseMap, IN_texCoord);
  73.    
  74.    // Alpha Test
  75.    clip( OUT_col.a - alphaTestValue );
  76.    
  77.    // Bumpmap [Deferred]
  78.    
  79.    // Deferred RT Lighting
  80.    vec2 uvScene = IN_screenspacePos.xy / IN_screenspacePos.w;
  81.    uvScene = ( uvScene + 1.0 ) / 2.0;
  82.    uvScene.y = 1.0 - uvScene.y;
  83.    uvScene = ( uvScene * rtParamslightInfoBuffer.zw ) + rtParamslightInfoBuffer.xy;
  84.    vec3 d_lightcolor;
  85.    float d_NL_Att;
  86.    float d_specular;
  87.    lightinfoUncondition(tex2D(lightInfoBuffer, uvScene), d_lightcolor, d_NL_Att, d_specular);
  88.    OUT_col *= float4(d_lightcolor, 1.0);
  89.    
  90.    // Visibility
  91.    vec2 vpos = IN_inVpos.xy / IN_inVpos.w;
  92.    fizzle( vpos, visibility );
  93.    
  94.    // HDR Output
  95.    OUT_col = hdrEncode( OUT_col );
  96.    
  97.    // DXTnm
  98.    
  99.    
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement