public void SetMappedLight(int idx, float4x4 m, float3 color, float4 worldPosOrDir, float range, float4 mask, bgfx.TextureHandle shadowMap, int shadowMapSize) { switch (idx) { case 0: mappedLight0.Set(m, color, worldPosOrDir, range, mask, shadowMap); mappedLight01sis.x = (float)shadowMapSize; mappedLight01sis.y = 1.0f / (float)shadowMapSize; break; case 1: mappedLight1.Set(m, color, worldPosOrDir, range, mask, shadowMap); mappedLight01sis.z = (float)shadowMapSize; mappedLight01sis.w = 1.0f / (float)shadowMapSize; break; case 2: csmLight.Set(m, color, worldPosOrDir, range, mask, shadowMap); csmLightsis.x = (float)shadowMapSize; // full size, not cascade size csmLightsis.y = 1.0f / (float)shadowMapSize; csmLightsis.z = 1.0f - 3.0f * csmLightsis.y; // border around cascades, in normalized [-1..1] break; default: throw new IndexOutOfRangeException(); } ; }
public void SetMappedLight(int idx, float4x4 m, float3 color, float4 worldPosOrDir, float range, float4 mask, bgfx.TextureHandle shadowMap, int shadowMapSize) { switch (idx) { case 0: mappedLight0.Set(m, color, worldPosOrDir, range, mask, shadowMap); mappedLight01sis.x = (float)shadowMapSize; mappedLight01sis.y = 1.0f / (float)shadowMapSize; break; case 1: mappedLight1.Set(m, color, worldPosOrDir, range, mask, shadowMap); mappedLight01sis.z = (float)shadowMapSize; mappedLight01sis.w = 1.0f / (float)shadowMapSize; break; default: throw new IndexOutOfRangeException(); } ; }