pica/lighting: split FresnelSelector into bitfields

The FresnelSelector was already working like a bitfield, so just make it actual bitfield to reduce redundant code. Also, it is already confirmed that this field also affects shadow on alpha. Given that the only two source that can affect alpha components are both controlled by this field, this field should be renamed to a general alpha switch
This commit is contained in:
wwylele 2018-04-01 14:31:26 +03:00
parent bdf7b46fbb
commit b5763cb952
4 changed files with 12 additions and 30 deletions

View file

@ -251,16 +251,12 @@ std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors(
lighting.lut_scale.fr, LightingRegs::LightingSampler::Fresnel);
// Enabled for diffuse lighting alpha component
if (lighting.config0.fresnel_selector ==
LightingRegs::LightingFresnelSelector::PrimaryAlpha ||
lighting.config0.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) {
if (lighting.config0.enable_primary_alpha) {
diffuse_sum.a() = lut_value;
}
// Enabled for the specular lighting alpha component
if (lighting.config0.fresnel_selector ==
LightingRegs::LightingFresnelSelector::SecondaryAlpha ||
lighting.config0.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) {
if (lighting.config0.enable_secondary_alpha) {
specular_sum.a() = lut_value;
}
}
@ -308,16 +304,12 @@ std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors(
if (lighting.config0.shadow_alpha) {
// Alpha shadow also uses the Fresnel selecotr to determine which alpha to apply
// Enabled for diffuse lighting alpha component
if (lighting.config0.fresnel_selector ==
LightingRegs::LightingFresnelSelector::PrimaryAlpha ||
lighting.config0.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) {
if (lighting.config0.enable_primary_alpha) {
diffuse_sum.a() *= shadow.w;
}
// Enabled for the specular lighting alpha component
if (lighting.config0.fresnel_selector ==
LightingRegs::LightingFresnelSelector::SecondaryAlpha ||
lighting.config0.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) {
if (lighting.config0.enable_secondary_alpha) {
specular_sum.a() *= shadow.w;
}
}