Nyom part 2

This commit is contained in:
offtkp 2024-07-20 00:21:26 +03:00
parent 75f839509e
commit a903e1b2a4
2 changed files with 4 additions and 5 deletions

View file

@ -73,7 +73,7 @@ namespace PICA {
BitField<22, 2, u32> shadowSelector;
};
LightingLUTConfig luts[7]{};
std::array<LightingLUTConfig, 7> luts{};
std::array<Light, 8> lights{};

View file

@ -595,14 +595,13 @@ bool FragmentGenerator::isSamplerEnabled(u32 environmentID, u32 lutID) {
void FragmentGenerator::compileLUTLookup(std::string& shader, const PICA::FragmentConfig& config, u32 lightIndex, u32 lutID) {
uint lutIndex = 0;
int bitInConfig1 = 0;
bool spotAttenuationEnable = true;
if (lutID == spotlightLutIndex) {
// These are the spotlight attenuation LUTs
bitInConfig1 = 8 + (lightIndex & 0x7);
lutIndex = 8u + lightIndex;
spotAttenuationEnable = config.lighting.lights[lightIndex].spotAttenuationEnable;
} else if (lutID <= 6) {
bitInConfig1 = 16 + lutID;
lutIndex = lutID;
} else {
Helpers::warn("Shadergen: Unimplemented LUT value");
@ -611,7 +610,7 @@ void FragmentGenerator::compileLUTLookup(std::string& shader, const PICA::Fragme
const bool samplerEnabled = isSamplerEnabled(config.lighting.config, lutID);
const LightingLUTConfig& lut = config.lighting.luts[lutID];
if (!samplerEnabled || !lut.enable) {
if (!samplerEnabled || !lut.enable || !spotAttenuationEnable) {
shader += "lut_lookup_result = 1.0;\n";
return;
}