Shadergen: Fix small register decoding oopsie
This commit is contained in:
@@ -116,7 +116,7 @@ namespace PICA {
|
|||||||
|
|
||||||
for (int i = 0; i < totalLightCount; i++) {
|
for (int i = 0; i < totalLightCount; i++) {
|
||||||
auto& light = lights[i];
|
auto& light = lights[i];
|
||||||
const u32 lightConfig = 0x149 + 0x10 * i;
|
const u32 lightConfig = regs[InternalRegs::Light0Config + 0x10 * i];
|
||||||
|
|
||||||
light.num = (regs[InternalRegs::LightPermutation] >> (i * 4)) & 0x7;
|
light.num = (regs[InternalRegs::LightPermutation] >> (i * 4)) & 0x7;
|
||||||
light.directional = Helpers::getBit<0>(lightConfig);
|
light.directional = Helpers::getBit<0>(lightConfig);
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ namespace PICA {
|
|||||||
Light0Z = 0x145,
|
Light0Z = 0x145,
|
||||||
Light0SpotlightXY = 0x146,
|
Light0SpotlightXY = 0x146,
|
||||||
Light0SpotlightZ = 0x147,
|
Light0SpotlightZ = 0x147,
|
||||||
|
Light0Config = 0x149,
|
||||||
Light0AttenuationBias = 0x14A,
|
Light0AttenuationBias = 0x14A,
|
||||||
Light0AttenuationScale = 0x14B,
|
Light0AttenuationScale = 0x14B,
|
||||||
|
|
||||||
|
|||||||
@@ -485,9 +485,9 @@ void FragmentGenerator::compileLights(std::string& shader, const PICA::FragmentC
|
|||||||
shader += "light_position = lightSources[" + std::to_string(lightID) + "].position;\n";
|
shader += "light_position = lightSources[" + std::to_string(lightID) + "].position;\n";
|
||||||
|
|
||||||
if (lightConfig.directional) { // Directional lighting
|
if (lightConfig.directional) { // Directional lighting
|
||||||
shader += "light_vector = light_position + v_view;\n";
|
|
||||||
} else { // Positional lighting
|
|
||||||
shader += "light_vector = light_position;\n";
|
shader += "light_vector = light_position;\n";
|
||||||
|
} else { // Positional lighting
|
||||||
|
shader += "light_vector = light_position + v_view;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
shader += R"(
|
shader += R"(
|
||||||
|
|||||||
Reference in New Issue
Block a user