| 1 |
#include <metal_stdlib> |
| 2 |
#include <simd/simd.h> |
| 3 |
|
| 4 |
using namespace metal; |
| 5 |
|
| 6 |
struct type_View |
| 7 |
{ |
| 8 |
float4x4 View_TranslatedWorldToClip; |
| 9 |
float4x4 View_WorldToClip; |
| 10 |
float4x4 View_TranslatedWorldToView; |
| 11 |
float4x4 View_ViewToTranslatedWorld; |
| 12 |
float4x4 View_TranslatedWorldToCameraView; |
| 13 |
float4x4 View_CameraViewToTranslatedWorld; |
| 14 |
float4x4 View_ViewToClip; |
| 15 |
float4x4 View_ViewToClipNoAA; |
| 16 |
float4x4 View_ClipToView; |
| 17 |
float4x4 View_ClipToTranslatedWorld; |
| 18 |
float4x4 View_SVPositionToTranslatedWorld; |
| 19 |
float4x4 View_ScreenToWorld; |
| 20 |
float4x4 View_ScreenToTranslatedWorld; |
| 21 |
packed_float3 View_ViewForward; |
| 22 |
float PrePadding_View_844; |
| 23 |
packed_float3 View_ViewUp; |
| 24 |
float PrePadding_View_860; |
| 25 |
packed_float3 View_ViewRight; |
| 26 |
float PrePadding_View_876; |
| 27 |
packed_float3 View_HMDViewNoRollUp; |
| 28 |
float PrePadding_View_892; |
| 29 |
packed_float3 View_HMDViewNoRollRight; |
| 30 |
float PrePadding_View_908; |
| 31 |
float4 View_InvDeviceZToWorldZTransform; |
| 32 |
float4 View_ScreenPositionScaleBias; |
| 33 |
packed_float3 View_WorldCameraOrigin; |
| 34 |
float PrePadding_View_956; |
| 35 |
packed_float3 View_TranslatedWorldCameraOrigin; |
| 36 |
float PrePadding_View_972; |
| 37 |
packed_float3 View_WorldViewOrigin; |
| 38 |
float PrePadding_View_988; |
| 39 |
packed_float3 View_PreViewTranslation; |
| 40 |
float PrePadding_View_1004; |
| 41 |
float4x4 View_PrevProjection; |
| 42 |
float4x4 View_PrevViewProj; |
| 43 |
float4x4 View_PrevViewRotationProj; |
| 44 |
float4x4 View_PrevViewToClip; |
| 45 |
float4x4 View_PrevClipToView; |
| 46 |
float4x4 View_PrevTranslatedWorldToClip; |
| 47 |
float4x4 View_PrevTranslatedWorldToView; |
| 48 |
float4x4 View_PrevViewToTranslatedWorld; |
| 49 |
float4x4 View_PrevTranslatedWorldToCameraView; |
| 50 |
float4x4 View_PrevCameraViewToTranslatedWorld; |
| 51 |
packed_float3 View_PrevWorldCameraOrigin; |
| 52 |
float PrePadding_View_1660; |
| 53 |
packed_float3 View_PrevWorldViewOrigin; |
| 54 |
float PrePadding_View_1676; |
| 55 |
packed_float3 View_PrevPreViewTranslation; |
| 56 |
float PrePadding_View_1692; |
| 57 |
float4x4 View_PrevInvViewProj; |
| 58 |
float4x4 View_PrevScreenToTranslatedWorld; |
| 59 |
float4x4 View_ClipToPrevClip; |
| 60 |
float4 View_TemporalAAJitter; |
| 61 |
float4 View_GlobalClippingPlane; |
| 62 |
float2 View_FieldOfViewWideAngles; |
| 63 |
float2 View_PrevFieldOfViewWideAngles; |
| 64 |
float4 View_ViewRectMin; |
| 65 |
float4 View_ViewSizeAndInvSize; |
| 66 |
float4 View_BufferSizeAndInvSize; |
| 67 |
float4 View_BufferBilinearUVMinMax; |
| 68 |
int View_NumSceneColorMSAASamples; |
| 69 |
float View_PreExposure; |
| 70 |
float View_OneOverPreExposure; |
| 71 |
float PrePadding_View_2012; |
| 72 |
float4 View_DiffuseOverrideParameter; |
| 73 |
float4 View_SpecularOverrideParameter; |
| 74 |
float4 View_NormalOverrideParameter; |
| 75 |
float2 View_RoughnessOverrideParameter; |
| 76 |
float View_PrevFrameGameTime; |
| 77 |
float View_PrevFrameRealTime; |
| 78 |
float View_OutOfBoundsMask; |
| 79 |
float PrePadding_View_2084; |
| 80 |
float PrePadding_View_2088; |
| 81 |
float PrePadding_View_2092; |
| 82 |
packed_float3 View_WorldCameraMovementSinceLastFrame; |
| 83 |
float View_CullingSign; |
| 84 |
float View_NearPlane; |
| 85 |
float View_AdaptiveTessellationFactor; |
| 86 |
float View_GameTime; |
| 87 |
float View_RealTime; |
| 88 |
float View_DeltaTime; |
| 89 |
float View_MaterialTextureMipBias; |
| 90 |
float View_MaterialTextureDerivativeMultiply; |
| 91 |
uint View_Random; |
| 92 |
uint View_FrameNumber; |
| 93 |
uint View_StateFrameIndexMod8; |
| 94 |
uint View_StateFrameIndex; |
| 95 |
float View_CameraCut; |
| 96 |
float View_UnlitViewmodeMask; |
| 97 |
float PrePadding_View_2164; |
| 98 |
float PrePadding_View_2168; |
| 99 |
float PrePadding_View_2172; |
| 100 |
float4 View_DirectionalLightColor; |
| 101 |
packed_float3 View_DirectionalLightDirection; |
| 102 |
float PrePadding_View_2204; |
| 103 |
float4 View_TranslucencyLightingVolumeMin[2]; |
| 104 |
float4 View_TranslucencyLightingVolumeInvSize[2]; |
| 105 |
float4 View_TemporalAAParams; |
| 106 |
float4 View_CircleDOFParams; |
| 107 |
float View_DepthOfFieldSensorWidth; |
| 108 |
float View_DepthOfFieldFocalDistance; |
| 109 |
float View_DepthOfFieldScale; |
| 110 |
float View_DepthOfFieldFocalLength; |
| 111 |
float View_DepthOfFieldFocalRegion; |
| 112 |
float View_DepthOfFieldNearTransitionRegion; |
| 113 |
float View_DepthOfFieldFarTransitionRegion; |
| 114 |
float View_MotionBlurNormalizedToPixel; |
| 115 |
float View_bSubsurfacePostprocessEnabled; |
| 116 |
float View_GeneralPurposeTweak; |
| 117 |
float View_DemosaicVposOffset; |
| 118 |
float PrePadding_View_2348; |
| 119 |
packed_float3 View_IndirectLightingColorScale; |
| 120 |
float View_HDR32bppEncodingMode; |
| 121 |
packed_float3 View_AtmosphericFogSunDirection; |
| 122 |
float View_AtmosphericFogSunPower; |
| 123 |
float View_AtmosphericFogPower; |
| 124 |
float View_AtmosphericFogDensityScale; |
| 125 |
float View_AtmosphericFogDensityOffset; |
| 126 |
float View_AtmosphericFogGroundOffset; |
| 127 |
float View_AtmosphericFogDistanceScale; |
| 128 |
float View_AtmosphericFogAltitudeScale; |
| 129 |
float View_AtmosphericFogHeightScaleRayleigh; |
| 130 |
float View_AtmosphericFogStartDistance; |
| 131 |
float View_AtmosphericFogDistanceOffset; |
| 132 |
float View_AtmosphericFogSunDiscScale; |
| 133 |
uint View_AtmosphericFogRenderMask; |
| 134 |
uint View_AtmosphericFogInscatterAltitudeSampleNum; |
| 135 |
float4 View_AtmosphericFogSunColor; |
| 136 |
packed_float3 View_NormalCurvatureToRoughnessScaleBias; |
| 137 |
float View_RenderingReflectionCaptureMask; |
| 138 |
float4 View_AmbientCubemapTint; |
| 139 |
float View_AmbientCubemapIntensity; |
| 140 |
float View_SkyLightParameters; |
| 141 |
float PrePadding_View_2488; |
| 142 |
float PrePadding_View_2492; |
| 143 |
float4 View_SkyLightColor; |
| 144 |
float4 View_SkyIrradianceEnvironmentMap[7]; |
| 145 |
float View_MobilePreviewMode; |
| 146 |
float View_HMDEyePaddingOffset; |
| 147 |
float View_ReflectionCubemapMaxMip; |
| 148 |
float View_ShowDecalsMask; |
| 149 |
uint View_DistanceFieldAOSpecularOcclusionMode; |
| 150 |
float View_IndirectCapsuleSelfShadowingIntensity; |
| 151 |
float PrePadding_View_2648; |
| 152 |
float PrePadding_View_2652; |
| 153 |
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; |
| 154 |
int View_StereoPassIndex; |
| 155 |
float4 View_GlobalVolumeCenterAndExtent[4]; |
| 156 |
float4 View_GlobalVolumeWorldToUVAddAndMul[4]; |
| 157 |
float View_GlobalVolumeDimension; |
| 158 |
float View_GlobalVolumeTexelSize; |
| 159 |
float View_MaxGlobalDistance; |
| 160 |
float View_bCheckerboardSubsurfaceProfileRendering; |
| 161 |
packed_float3 View_VolumetricFogInvGridSize; |
| 162 |
float PrePadding_View_2828; |
| 163 |
packed_float3 View_VolumetricFogGridZParams; |
| 164 |
float PrePadding_View_2844; |
| 165 |
float2 View_VolumetricFogSVPosToVolumeUV; |
| 166 |
float View_VolumetricFogMaxDistance; |
| 167 |
float PrePadding_View_2860; |
| 168 |
packed_float3 View_VolumetricLightmapWorldToUVScale; |
| 169 |
float PrePadding_View_2876; |
| 170 |
packed_float3 View_VolumetricLightmapWorldToUVAdd; |
| 171 |
float PrePadding_View_2892; |
| 172 |
packed_float3 View_VolumetricLightmapIndirectionTextureSize; |
| 173 |
float View_VolumetricLightmapBrickSize; |
| 174 |
packed_float3 View_VolumetricLightmapBrickTexelSize; |
| 175 |
float View_StereoIPD; |
| 176 |
float View_IndirectLightingCacheShowFlag; |
| 177 |
float View_EyeToPixelSpreadAngle; |
| 178 |
}; |
| 179 |
|
| 180 |
struct type_MobileDirectionalLight |
| 181 |
{ |
| 182 |
float4 MobileDirectionalLight_DirectionalLightColor; |
| 183 |
float4 MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition; |
| 184 |
float4 MobileDirectionalLight_DirectionalLightShadowSize; |
| 185 |
float4 MobileDirectionalLight_DirectionalLightDistanceFadeMAD; |
| 186 |
float4 MobileDirectionalLight_DirectionalLightShadowDistances; |
| 187 |
float4x4 MobileDirectionalLight_DirectionalLightScreenToShadow[4]; |
| 188 |
}; |
| 189 |
|
| 190 |
struct type_Globals |
| 191 |
{ |
| 192 |
int NumDynamicPointLights; |
| 193 |
float4 LightPositionAndInvRadius[4]; |
| 194 |
float4 LightColorAndFalloffExponent[4]; |
| 195 |
float4 MobileReflectionParams; |
| 196 |
}; |
| 197 |
|
| 198 |
constant float3 _136 = {}; |
| 199 |
constant float4 _137 = {}; |
| 200 |
constant float _138 = {}; |
| 201 |
constant float3 _139 = {}; |
| 202 |
|
| 203 |
struct main0_out |
| 204 |
{ |
| 205 |
float4 out_var_SV_Target0 [[color(0)]]; |
| 206 |
}; |
| 207 |
|
| 208 |
struct main0_in |
| 209 |
{ |
| 210 |
float2 in_var_TEXCOORD0 [[user(locn0)]]; |
| 211 |
float4 in_var_TEXCOORD7 [[user(locn1)]]; |
| 212 |
float4 in_var_TEXCOORD8 [[user(locn2)]]; |
| 213 |
}; |
| 214 |
|
| 215 |
fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_MobileDirectionalLight& MobileDirectionalLight [[buffer(1)]], constant type_Globals& _Globals [[buffer(2)]], texture2d<float> MobileDirectionalLight_DirectionalLightShadowTexture [[texture(0)]], texture2d<float> Material_Texture2D_0 [[texture(1)]], texture2d<float> Material_Texture2D_1 [[texture(2)]], texturecube<float> ReflectionCubemap [[texture(3)]], sampler MobileDirectionalLight_DirectionalLightShadowSampler [[sampler(0)]], sampler Material_Texture2D_0Sampler [[sampler(1)]], sampler Material_Texture2D_1Sampler [[sampler(2)]], sampler ReflectionCubemapSampler [[sampler(3)]], float4 gl_FragCoord [[position]]) |
| 216 |
{ |
| 217 |
main0_out out = {}; |
| 218 |
float4 _177 = float4((((gl_FragCoord.xy - View.View_ViewRectMin.xy) * View.View_ViewSizeAndInvSize.zw) - float2(0.5)) * float2(2.0, -2.0), _138, 1.0) * float4(gl_FragCoord.w); |
| 219 |
float3 _179 = in.in_var_TEXCOORD8.xyz - float3(View.View_PreViewTranslation); |
| 220 |
float3 _181 = normalize(-in.in_var_TEXCOORD8.xyz); |
| 221 |
float4 _187 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (in.in_var_TEXCOORD0 * float2(10.0))); |
| 222 |
float2 _190 = (_187.xy * float2(2.0)) - float2(1.0); |
| 223 |
float3 _206 = normalize(float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0)) * (((float4(_190, sqrt(fast::clamp(1.0 - dot(_190, _190), 0.0, 1.0)), 1.0).xyz * float3(0.300000011920928955078125, 0.300000011920928955078125, 1.0)) * float3(View.View_NormalOverrideParameter.w)) + View.View_NormalOverrideParameter.xyz)); |
| 224 |
float _208 = dot(_206, _181); |
| 225 |
float4 _217 = Material_Texture2D_1.sample(Material_Texture2D_1Sampler, (in.in_var_TEXCOORD0 * float2(20.0))); |
| 226 |
float _219 = mix(0.4000000059604644775390625, 1.0, _217.x); |
| 227 |
float4 _223 = Material_Texture2D_1.sample(Material_Texture2D_1Sampler, (in.in_var_TEXCOORD0 * float2(5.0))); |
| 228 |
float _224 = _177.w; |
| 229 |
float _228 = fast::min(fast::max((_224 - 24.0) * 0.000666666659526526927947998046875, 0.0), 1.0); |
| 230 |
float _229 = _223.y; |
| 231 |
float4 _233 = Material_Texture2D_1.sample(Material_Texture2D_1Sampler, (in.in_var_TEXCOORD0 * float2(0.5))); |
| 232 |
float _235 = _233.y; |
| 233 |
float _253 = fast::clamp((fast::min(fast::max(mix(0.0, 0.5, _235) + mix(mix(0.699999988079071044921875, 1.0, _229), 1.0, _228), 0.0), 1.0) * View.View_RoughnessOverrideParameter.y) + View.View_RoughnessOverrideParameter.x, 0.119999997317790985107421875, 1.0); |
| 234 |
float2 _257 = (float2(_253) * float2(-1.0, -0.0274999998509883880615234375)) + float2(1.0, 0.0425000004470348358154296875); |
| 235 |
float _258 = _257.x; |
| 236 |
float3 _270 = (fast::clamp(float3(mix(_219, 1.0 - _219, mix(_229, 1.0, _228)) * (mix(0.2949999868869781494140625, 0.660000026226043701171875, mix(_235 + mix(_229, 0.0, _228), 0.5, 0.5)) * 0.5)), float3(0.0), float3(1.0)) * float3(View.View_DiffuseOverrideParameter.w)) + View.View_DiffuseOverrideParameter.xyz; |
| 237 |
float3 _275 = float3(((fast::min(_258 * _258, exp2((-9.27999973297119140625) * fast::max(_208, 0.0))) * _258) + _257.y) * View.View_SpecularOverrideParameter.w) + View.View_SpecularOverrideParameter.xyz; |
| 238 |
float _276 = _275.x; |
| 239 |
float4 _303; |
| 240 |
int _286 = 0; |
| 241 |
for (;;) |
| 242 |
{ |
| 243 |
if (_286 < 2) |
| 244 |
{ |
| 245 |
if (_224 < MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowDistances[uint(_286)]) |
| 246 |
{ |
| 247 |
_303 = MobileDirectionalLight.MobileDirectionalLight_DirectionalLightScreenToShadow[_286] * float4(_177.xy, _224, 1.0); |
| 248 |
break; |
| 249 |
} |
| 250 |
_286++; |
| 251 |
continue; |
| 252 |
} |
| 253 |
else |
| 254 |
{ |
| 255 |
_303 = float4(0.0); |
| 256 |
break; |
| 257 |
} |
| 258 |
} |
| 259 |
float _423; |
| 260 |
if (_303.z > 0.0) |
| 261 |
{ |
| 262 |
float2 _311 = _303.xy * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.xy; |
| 263 |
float2 _312 = fract(_311); |
| 264 |
float2 _313 = floor(_311); |
| 265 |
float3 _320 = _139; |
| 266 |
_320.x = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(-0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; |
| 267 |
float3 _326 = _320; |
| 268 |
_326.y = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(0.5, -0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; |
| 269 |
float3 _332 = _326; |
| 270 |
_332.z = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(1.5, -0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; |
| 271 |
float3 _335 = float3(MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.w); |
| 272 |
float3 _337 = float3((fast::min(_303.z, 0.999989986419677734375) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.w) - 1.0); |
| 273 |
float3 _339 = fast::clamp((_332 * _335) - _337, float3(0.0), float3(1.0)); |
| 274 |
float3 _345 = _139; |
| 275 |
_345.x = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(-0.5, 0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; |
| 276 |
float3 _351 = _345; |
| 277 |
_351.y = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; |
| 278 |
float3 _357 = _351; |
| 279 |
_357.z = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(1.5, 0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; |
| 280 |
float3 _360 = fast::clamp((_357 * _335) - _337, float3(0.0), float3(1.0)); |
| 281 |
float3 _366 = _139; |
| 282 |
_366.x = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(-0.5, 1.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; |
| 283 |
float3 _372 = _366; |
| 284 |
_372.y = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(0.5, 1.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; |
| 285 |
float3 _378 = _372; |
| 286 |
_378.z = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(1.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; |
| 287 |
float3 _381 = fast::clamp((_378 * _335) - _337, float3(0.0), float3(1.0)); |
| 288 |
float _383 = _312.x; |
| 289 |
float _384 = 1.0 - _383; |
| 290 |
float3 _399 = _136; |
| 291 |
_399.x = ((_339.x * _384) + _339.y) + (_339.z * _383); |
| 292 |
float3 _403 = _399; |
| 293 |
_403.y = ((_360.x * _384) + _360.y) + (_360.z * _383); |
| 294 |
float3 _407 = _403; |
| 295 |
_407.z = ((_381.x * _384) + _381.y) + (_381.z * _383); |
| 296 |
float _408 = _312.y; |
| 297 |
float _420 = fast::clamp((_224 * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDistanceFadeMAD.x) + MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDistanceFadeMAD.y, 0.0, 1.0); |
| 298 |
_423 = mix(fast::clamp(0.25 * dot(_407, float3(1.0 - _408, 1.0, _408)), 0.0, 1.0), 1.0, _420 * _420); |
| 299 |
} |
| 300 |
else |
| 301 |
{ |
| 302 |
_423 = 1.0; |
| 303 |
} |
| 304 |
float3 _429 = normalize(_181 + MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.xyz); |
| 305 |
float _439 = (_253 * 0.25) + 0.25; |
| 306 |
float3 _440 = cross(_206, _429); |
| 307 |
float _442 = _253 * _253; |
| 308 |
float _443 = fast::max(0.0, dot(_206, _429)) * _442; |
| 309 |
float _446 = _442 / (dot(_440, _440) + (_443 * _443)); |
| 310 |
bool _458 = float(_Globals.MobileReflectionParams.w > 0.0) != 0.0; |
| 311 |
float4 _468 = ReflectionCubemap.sample(ReflectionCubemapSampler, ((-_181) + ((_206 * float3(_208)) * float3(2.0))), level(((_458 ? _Globals.MobileReflectionParams.w : View.View_ReflectionCubemapMaxMip) - 1.0) - (1.0 - (1.2000000476837158203125 * log2(_253))))); |
| 312 |
float3 _481; |
| 313 |
if (_458) |
| 314 |
{ |
| 315 |
_481 = _468.xyz * View.View_SkyLightColor.xyz; |
| 316 |
} |
| 317 |
else |
| 318 |
{ |
| 319 |
float3 _476 = _468.xyz * float3(_468.w * 16.0); |
| 320 |
_481 = _476 * _476; |
| 321 |
} |
| 322 |
float3 _484 = float3(_276); |
| 323 |
float3 _488; |
| 324 |
_488 = ((float3(_423 * fast::max(0.0, dot(_206, MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.xyz))) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightColor.xyz) * (_270 + float3(_276 * (_439 * fast::min(_446 * _446, 65504.0))))) + ((_481 * float3(fast::clamp(1.0, 0.0, 1.0))) * _484); |
| 325 |
float3 _507; |
| 326 |
float _509; |
| 327 |
float _511; |
| 328 |
float _537; |
| 329 |
int _491 = 0; |
| 330 |
for (;;) |
| 331 |
{ |
| 332 |
if (_491 < _Globals.NumDynamicPointLights) |
| 333 |
{ |
| 334 |
float3 _501 = _Globals.LightPositionAndInvRadius[_491].xyz - _179; |
| 335 |
float _502 = dot(_501, _501); |
| 336 |
float3 _505 = _501 * float3(rsqrt(_502)); |
| 337 |
_507 = normalize(_181 + _505); |
| 338 |
_509 = fast::max(0.0, dot(_206, _505)); |
| 339 |
_511 = fast::max(0.0, dot(_206, _507)); |
| 340 |
if (_Globals.LightColorAndFalloffExponent[_491].w == 0.0) |
| 341 |
{ |
| 342 |
float _531 = _502 * (_Globals.LightPositionAndInvRadius[_491].w * _Globals.LightPositionAndInvRadius[_491].w); |
| 343 |
float _534 = fast::clamp(1.0 - (_531 * _531), 0.0, 1.0); |
| 344 |
_537 = (1.0 / (_502 + 1.0)) * (_534 * _534); |
| 345 |
} |
| 346 |
else |
| 347 |
{ |
| 348 |
float3 _521 = _501 * float3(_Globals.LightPositionAndInvRadius[_491].w); |
| 349 |
_537 = pow(1.0 - fast::clamp(dot(_521, _521), 0.0, 1.0), _Globals.LightColorAndFalloffExponent[_491].w); |
| 350 |
} |
| 351 |
float3 _544 = cross(_206, _507); |
| 352 |
float _546 = _511 * _442; |
| 353 |
float _549 = _442 / (dot(_544, _544) + (_546 * _546)); |
| 354 |
_488 += fast::min(float3(65000.0), ((float3(_537 * _509) * _Globals.LightColorAndFalloffExponent[_491].xyz) * float3(0.3183098733425140380859375)) * (_270 + float3(_276 * (_439 * fast::min(_549 * _549, 65504.0))))); |
| 355 |
_491++; |
| 356 |
continue; |
| 357 |
} |
| 358 |
else |
| 359 |
{ |
| 360 |
break; |
| 361 |
} |
| 362 |
} |
| 363 |
float3 _567 = (mix(_488 + fast::max(float3(0.0), float3(0.0)), _270 + _484, float3(View.View_UnlitViewmodeMask)) * float3(in.in_var_TEXCOORD7.w)) + in.in_var_TEXCOORD7.xyz; |
| 364 |
float4 _571 = float4(_567.x, _567.y, _567.z, _137.w); |
| 365 |
_571.w = fast::min(in.in_var_TEXCOORD8.w, 65500.0); |
| 366 |
out.out_var_SV_Target0 = _571; |
| 367 |
return out; |
| 368 |
} |
| 369 |
|