Shadergen fog

This commit is contained in:
offtkp 2024-07-21 16:32:45 +03:00
parent 4176a19256
commit b90c15919b
4 changed files with 53 additions and 1 deletions

View file

@ -29,6 +29,18 @@ namespace PICA {
std::array<u32, 4 * 6> tevConfigs;
};
struct FogConfig {
union {
u32 raw{};
BitField<0, 3, FogMode> mode;
BitField<3, 1, u32> flipDepth;
BitField<8, 8, u32> fogColorR;
BitField<16, 8, u32> fogColorG;
BitField<24, 8, u32> fogColorB;
};
};
struct Light {
union {
u16 raw;
@ -189,6 +201,7 @@ namespace PICA {
struct FragmentConfig {
OutputConfig outConfig;
TextureConfig texConfig;
FogConfig fogConfig;
LightingConfig lighting;
bool operator==(const FragmentConfig& config) const {
@ -220,12 +233,18 @@ namespace PICA {
setupTevStage(4);
setupTevStage(5);
#undef setupTevStage
fogConfig.mode = (FogMode)Helpers::getBits<0, 3>(regs[InternalRegs::TexEnvUpdateBuffer]);
fogConfig.flipDepth = Helpers::getBit<16>(regs[InternalRegs::TexEnvUpdateBuffer]);
fogConfig.fogColorR = Helpers::getBits<0, 8>(regs[InternalRegs::FogColor]);
fogConfig.fogColorG = Helpers::getBits<8, 8>(regs[InternalRegs::FogColor]);
fogConfig.fogColorB = Helpers::getBits<16, 8>(regs[InternalRegs::FogColor]);
}
};
static_assert(
std::has_unique_object_representations<OutputConfig>() && std::has_unique_object_representations<TextureConfig>() &&
std::has_unique_object_representations<Light>()
std::has_unique_object_representations<FogConfig>() && std::has_unique_object_representations<Light>()
);
} // namespace PICA