yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
5398d55e
16.6.0
1#version 460 2uniform int uTDInstanceIDOffset ; 3uniform int uTDNumInstances ; 4uniform float uTDAlphaTestVal ; 5#define TD_NUM_COLOR_BUFFERS 1 6#define TD_NUM_LIGHTS 0 7#define TD_NUM_SHADOWED_LIGHTS 0 8#define TD_NUM_ENV_LIGHTS 0 9#define TD_LIGHTS_ARRAY_SIZE 1 10#define TD_ENV_LIGHTS_ARRAY_SIZE 1 11#define TD_NUM_CAMERAS 1 12struct TDPhongResult 13{ 14vec3 diffuse ; 15vec3 specular ; 16vec3 specular2 ; 17float shadowStrength ; 18} ; 19struct TDPBRResult 20{ 21vec3 diffuse ; 22vec3 specular ; 23float shadowStrength ; 24} ; 25struct TDMatrix 26{ 27mat4 world ; 28mat4 worldInverse ; 29mat4 worldCam ; 30mat4 worldCamInverse ; 31mat4 cam ; 32mat4 camInverse ; 33mat4 camProj ; 34mat4 camProjInverse ; 35mat4 proj ; 36mat4 projInverse ; 37mat4 worldCamProj ; 38mat4 worldCamProjInverse ; 39mat4 quadReproject ; 40mat3 worldForNormals ; 41mat3 camForNormals ; 42mat3 worldCamForNormals ; 43} ; 44layout ( std140 ) uniform TDMatricesBlock { 45TDMatrix uTDMats [ TD_NUM_CAMERAS ] ; 46} ; 47struct TDCameraInfo 48{ 49vec4 nearFar ; 50vec4 fog ; 51vec4 fogColor ; 52int renderTOPCameraIndex ; 53} ; 54layout ( std140 ) uniform TDCameraInfoBlock { 55TDCameraInfo uTDCamInfos [ TD_NUM_CAMERAS ] ; 56} ; 57struct TDGeneral 58{ 59vec4 ambientColor ; 60vec4 nearFar ; 61vec4 viewport ; 62vec4 viewportRes ; 63vec4 fog ; 64vec4 fogColor ; 65} ; 66layout ( std140 ) uniform TDGeneralBlock { 67TDGeneral uTDGeneral ; 68} ; 69 70void TDAlphaTest ( float alpha ) ; 71vec4 TDDither ( vec4 color ) ; 72vec4 TDOutputSwizzle ( vec4 v ) ; 73uvec4 TDOutputSwizzle ( uvec4 v ) ; 74void TDCheckOrderIndTrans () ; 75void TDCheckDiscard () ; 76uniform vec3 uConstant ; 77uniform float uShadowStrength ; 78uniform vec3 uShadowColor ; 79uniform vec4 uDiffuseColor ; 80uniform vec4 uAmbientColor ; 81 82uniform sampler2DArray sColorMap ; 83 84in Vertex 85{ 86vec4 color ; 87vec3 worldSpacePos ; 88vec3 texCoord0 ; 89flat int cameraIndex ; 90flat int instance ; 91} iVert ; 92 93// Output variable for the color 94layout ( location = 0 ) out vec4 oFragColor [ TD_NUM_COLOR_BUFFERS ] ; 95void main () 96{ 97// This allows things such as order independent transparency 98// and Dual-Paraboloid rendering to work properly 99TDCheckDiscard () ; 100 101vec4 outcol = vec4 ( 0.0 , 0.0 , 0.0 , 0.0 ) ; 102 103vec3 texCoord0 = iVert . texCoord0 . stp ; 104float actualTexZ = mod ( int ( texCoord0 . z ) , 2048 ) ; 105float instanceLoop = floor ( int ( texCoord0 . z ) / 2048 ) ; 106texCoord0 . z = actualTexZ ; 107vec4 colorMapColor = texture ( sColorMap , texCoord0 . stp ) ; 108 109float red = colorMapColor [ int ( instanceLoop )] ; 110colorMapColor = vec4 ( red ) ; 111// Constant Light Contribution 112outcol . rgb += uConstant * iVert . color . rgb ; 113 114outcol *= colorMapColor ; 115 116// Alpha Calculation 117float alpha = iVert . color . a * colorMapColor . a ; 118 119// Dithering, does nothing if dithering is disabled 120outcol = TDDither ( outcol ) ; 121 122outcol . rgb *= alpha ; 123 124// Modern GL removed the implicit alpha test, so we need to apply 125// it manually here. This function does nothing if alpha test is disabled. 126TDAlphaTest ( alpha ) ; 127 128outcol . a = alpha ; 129oFragColor [ 0 ] = TDOutputSwizzle ( outcol ) ; 130 131 132// TD_NUM_COLOR_BUFFERS will be set to the number of color buffers 133// active in the render. By default we want to output zero to every 134// buffer except the first one. 135for ( int i = 1 ; i < TD_NUM_COLOR_BUFFERS ; i ++ ) 136{ 137oFragColor [ i ] = vec4 ( 0.0 ) ; 138} 139}