Advertisement
Guest User

9310a62897cf71f6_V.glsl

a guest
Sep 18th, 2015
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.22 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. struct VertexData
  34. {
  35.    vec4 position;
  36.    vec2 tcImposterParams;
  37.    vec3 tcImposterUpVec;
  38.    vec3 tcImposterRightVec;
  39. } IN;
  40.  
  41. in vec4 vPosition;
  42. #define IN_position IN.position
  43. in vec2 vTexCoord0;
  44. #define IN_tcImposterParams IN.tcImposterParams
  45. in vec3 vTexCoord1;
  46. #define IN_tcImposterUpVec IN.tcImposterUpVec
  47. in vec3 vTexCoord2;
  48. #define IN_tcImposterRightVec IN.tcImposterRightVec
  49.  
  50. out float _TEXCOORD0_;
  51. out vec2 _TEXCOORD1_;
  52. out vec4 _TEXCOORD2_;
  53. out vec4 _TEXCOORD3_;
  54.  
  55. // Struct defines
  56. #define OUT_imposterFade _TEXCOORD0_
  57. #define OUT_out_texCoord _TEXCOORD1_
  58. #define OUT_screenspacePos _TEXCOORD2_
  59. #define OUT_outVpos _TEXCOORD3_
  60.  
  61. //-----------------------------------------------------------------------------
  62. // Main                                                                        
  63. //-----------------------------------------------------------------------------
  64. uniform vec4     imposterLimits ;
  65. uniform vec4     imposterUVs    [64];
  66. uniform vec3     eyePosWorld    ;
  67. uniform float4x4 modelview      ;
  68.  
  69.  
  70. void main()
  71. {
  72.  
  73.    //-------------------------
  74.    IN.position = vPosition;
  75.    IN.tcImposterParams = vTexCoord0;
  76.    IN.tcImposterUpVec = vTexCoord1;
  77.    IN.tcImposterRightVec = vTexCoord2;
  78.    //-------------------------
  79.  
  80.    // Imposter Vert
  81.    vec3 inPosition;
  82.    vec2 texCoord;
  83.    float3x3 worldToTangent;
  84.    OUT_imposterFade = IN_tcImposterParams.y;
  85.    imposter_v( IN_position.xyz, int(IN_position.w), IN_tcImposterParams.x * length(IN_tcImposterRightVec), normalize(IN_tcImposterUpVec), normalize(IN_tcImposterRightVec), int(imposterLimits.y), int(imposterLimits.x), imposterLimits.z, bool(imposterLimits.w), eyePosWorld, imposterUVs, inPosition, texCoord, worldToTangent );
  86.    vec3 wsPosition = inPosition.xyz;
  87.    float3x3 viewToTangent = worldToTangent;
  88.    
  89.    // Vert Position
  90.    gl_Position = tMul(modelview, float4(inPosition.xyz,1));
  91.    
  92.    // Base Texture
  93.    OUT_out_texCoord = vec2(texCoord);
  94.    
  95.    // Alpha Test
  96.    
  97.    // Bumpmap [Deferred]
  98.    
  99.    // Deferred RT Lighting
  100.    OUT_screenspacePos = gl_Position;
  101.    
  102.    // Visibility
  103.    OUT_outVpos = gl_Position;
  104.    
  105.    // HDR Output
  106.    
  107.    // DXTnm
  108.    
  109.    gl_Position.y *= -1;
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement