optimisations from gemini (not tested)

This commit is contained in:
DeMuenu
2026-03-24 15:45:31 +01:00
parent 9f986c3eb1
commit a1e808ad92
12 changed files with 231 additions and 117 deletions

View File

@@ -2,16 +2,20 @@
#define InLoopSetup(_Udon_LightPositions, LightCounter, count, i) \
if (LightCounter >= count) break; \
\
float distanceFromLight = length(i.worldPos - _Udon_LightPositions[LightCounter].xyz); \
float3 lightVec = _Udon_LightPositions[LightCounter].xyz - i.worldPos; \
float distanceFromLight = length(lightVec); \
if (distanceFromLight > _LightCutoffDistance) continue; \
\
float contrib = 0.0;
float contrib = 0.0; \
float3 L = lightVec / max(distanceFromLight, 1e-4);
#endif
#ifndef OutLoopSetup
#define OutLoopSetup(i, _Udon_PlayerCount) \
int count = (int)_Udon_PlayerCount; \
float invSqMul = max(1e-4, _InverseSqareMultiplier); \
bool shadowCastingEnabled = _EnableShadowCasting > 0.5; \
\
float4 dmax = float4(0,0,0,1); \
float dIntensity = 0;