mirror of https://github.com/AxioDL/metaforce.git
CCubeMaterial: Set color channel flags from material
This commit is contained in:
parent
b403edb804
commit
bbdad137af
|
@ -305,7 +305,7 @@ u32 CCubeMaterial::HandleColorChannels(u32 chanCount, u32 firstChan) {
|
||||||
CGX::SetChanMatColor(CGX::EChannelId::Channel1, zeus::skWhite);
|
CGX::SetChanMatColor(CGX::EChannelId::Channel1, zeus::skWhite);
|
||||||
|
|
||||||
auto chan0Lights = CGraphics::g_LightActive & ~CCubeModel::sChannel0DisableLightMask;
|
auto chan0Lights = CGraphics::g_LightActive & ~CCubeModel::sChannel0DisableLightMask;
|
||||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, chan0Lights); // TODO use firstChan flags
|
CGX::SetChanCtrl(CGX::EChannelId::Channel0, firstChan, chan0Lights);
|
||||||
CGX::SetChanCtrl(CGX::EChannelId::Channel1, CCubeModel::sChannel1EnableLightMask);
|
CGX::SetChanCtrl(CGX::EChannelId::Channel1, CCubeModel::sChannel1EnableLightMask);
|
||||||
if (chan0Lights.any()) {
|
if (chan0Lights.any()) {
|
||||||
CGX::SetChanMatColor(CGX::EChannelId::Channel0, zeus::skWhite);
|
CGX::SetChanMatColor(CGX::EChannelId::Channel0, zeus::skWhite);
|
||||||
|
@ -326,8 +326,7 @@ u32 CCubeMaterial::HandleColorChannels(u32 chanCount, u32 firstChan) {
|
||||||
if (chanCount == 0) {
|
if (chanCount == 0) {
|
||||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, {});
|
CGX::SetChanCtrl(CGX::EChannelId::Channel0, {});
|
||||||
} else {
|
} else {
|
||||||
// TODO use firstChan flags
|
CGX::SetChanCtrl(CGX::EChannelId::Channel0, firstChan, CGraphics::g_LightActive);
|
||||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, CGraphics::g_LightActive);
|
|
||||||
if (CGraphics::g_LightActive.any()) {
|
if (CGraphics::g_LightActive.any()) {
|
||||||
CGX::SetChanMatColor(CGX::EChannelId::Channel0, zeus::skWhite);
|
CGX::SetChanMatColor(CGX::EChannelId::Channel0, zeus::skWhite);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -159,6 +159,13 @@ static inline void SetChanCtrl(EChannelId id, GXBool enable, GX::ColorSrc ambSrc
|
||||||
sGXState.x4c_dirtyChans = 7; // TODO
|
sGXState.x4c_dirtyChans = 7; // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Flags with lights override
|
||||||
|
static inline void SetChanCtrl(EChannelId id, u32 flags, GX::LightMask lights) noexcept {
|
||||||
|
const auto idx = std::underlying_type_t<EChannelId>(id);
|
||||||
|
sGXState.x34_chanCtrls[idx] = lights.any() ? (flags | lights.to_ulong() << 3) : (flags & 0xFFFFFFFE);
|
||||||
|
sGXState.x4c_dirtyChans = 7; // TODO
|
||||||
|
}
|
||||||
|
|
||||||
// Helper function for common logic
|
// Helper function for common logic
|
||||||
static inline void SetChanCtrl(EChannelId id, GX::LightMask lights) noexcept {
|
static inline void SetChanCtrl(EChannelId id, GX::LightMask lights) noexcept {
|
||||||
const bool hasLights = lights.any();
|
const bool hasLights = lights.any();
|
||||||
|
|
Loading…
Reference in New Issue