mirror of https://github.com/AxioDL/metaforce.git
CGuiFrame & Model fixes; CModel::Draw impl; Document CModelFlags bits
This commit is contained in:
parent
b3daf4a527
commit
6c3e74b93e
|
@ -48,7 +48,7 @@ void CCubeMaterial::SetCurrent(const CModelFlags& flags, const CCubeSurface& sur
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 texCount = SBig(*reinterpret_cast<const u32*>(materialDataCur + 4));
|
u32 texCount = SBig(*reinterpret_cast<const u32*>(materialDataCur + 4));
|
||||||
if ((flags.x2_flags & 4) != 0) { // render without texture lock
|
if (flags.x2_flags & CModelFlagBits::NoTextureLock) {
|
||||||
materialDataCur += (2 + texCount) * 4;
|
materialDataCur += (2 + texCount) * 4;
|
||||||
} else {
|
} else {
|
||||||
materialDataCur += 8;
|
materialDataCur += 8;
|
||||||
|
@ -259,16 +259,16 @@ void CCubeMaterial::SetupBlendMode(u32 blendFactors, const CModelFlags& flags, b
|
||||||
aurora::gfx::set_blend_mode(ERglBlendMode::Blend, newSrcFactor, newDstFactor, ERglLogicOp::Clear);
|
aurora::gfx::set_blend_mode(ERglBlendMode::Blend, newSrcFactor, newDstFactor, ERglLogicOp::Clear);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCubeMaterial::HandleDepth(u16 modelFlags, CCubeMaterialFlags matFlags) {
|
void CCubeMaterial::HandleDepth(CModelFlagsFlags modelFlags, CCubeMaterialFlags matFlags) {
|
||||||
ERglEnum func = ERglEnum::Never;
|
ERglEnum func = ERglEnum::Never;
|
||||||
if ((modelFlags & 0x1) == 0) {
|
if (!(modelFlags & CModelFlagBits::DepthTest)) {
|
||||||
func = ERglEnum::Always;
|
func = ERglEnum::Always;
|
||||||
} else if ((modelFlags & 0x8) != 0) {
|
} else if (modelFlags & CModelFlagBits::DepthGreater) {
|
||||||
func = (modelFlags & 0x10) != 0 ? ERglEnum::Greater : ERglEnum::GEqual;
|
func = modelFlags & CModelFlagBits::DepthNonInclusive ? ERglEnum::Greater : ERglEnum::GEqual;
|
||||||
} else {
|
} else {
|
||||||
func = (modelFlags & 0x10) != 0 ? ERglEnum::Less : ERglEnum::LEqual;
|
func = modelFlags & CModelFlagBits::DepthNonInclusive ? ERglEnum::Less : ERglEnum::LEqual;
|
||||||
}
|
}
|
||||||
bool depthWrite = (modelFlags & 0x2) != 0 && matFlags & CCubeMaterialFlagBits::fDepthWrite;
|
bool depthWrite = modelFlags & CModelFlagBits::DepthUpdate && matFlags & CCubeMaterialFlagBits::fDepthWrite;
|
||||||
aurora::gfx::set_depth_mode(true, func, depthWrite);
|
aurora::gfx::set_depth_mode(true, func, depthWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
#include "CToken.hpp"
|
#include "CToken.hpp"
|
||||||
#include "GCNTypes.hpp"
|
#include "GCNTypes.hpp"
|
||||||
#include "Graphics/CTexture.hpp"
|
#include "Graphics/CTexture.hpp"
|
||||||
|
#include "Graphics/CModel.hpp"
|
||||||
#include "IObjectStore.hpp"
|
#include "IObjectStore.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
class CCubeModel;
|
class CCubeModel;
|
||||||
class CCubeSurface;
|
class CCubeSurface;
|
||||||
struct CModelFlags;
|
|
||||||
|
|
||||||
enum class CCubeMaterialFlagBits : u32 {
|
enum class CCubeMaterialFlagBits : u32 {
|
||||||
fKonstValues = 0x8,
|
fKonstValues = 0x8,
|
||||||
|
@ -93,7 +93,7 @@ private:
|
||||||
void SetCurrentBlack();
|
void SetCurrentBlack();
|
||||||
|
|
||||||
static void SetupBlendMode(u32 blendFactors, const CModelFlags& flags, bool alphaTest);
|
static void SetupBlendMode(u32 blendFactors, const CModelFlags& flags, bool alphaTest);
|
||||||
static void HandleDepth(u16 modelFlags, CCubeMaterialFlags matFlags);
|
static void HandleDepth(CModelFlagsFlags modelFlags, CCubeMaterialFlags matFlags);
|
||||||
static u32 HandleColorChannels(u32 chanCount, u32 firstChan);
|
static u32 HandleColorChannels(u32 chanCount, u32 firstChan);
|
||||||
static void HandleTev(u32 tevCur, const u8* materialDataCur, const u32* texMapTexCoordFlags, bool shadowMapsEnabled);
|
static void HandleTev(u32 tevCur, const u8* materialDataCur, const u32* texMapTexCoordFlags, bool shadowMapsEnabled);
|
||||||
static u32 HandleAnimatedUV(const u32* uvAnim, u32 texMtx, u32 pttTexMtx);
|
static u32 HandleAnimatedUV(const u32* uvAnim, u32 texMtx, u32 pttTexMtx);
|
||||||
|
|
|
@ -377,7 +377,7 @@ u32 CCubeRenderer::GetFPS() { return CGraphics::GetFPS(); }
|
||||||
void CCubeRenderer::CacheReflection(IRenderer::TReflectionCallback cb, void* ctx, bool clearAfter) {}
|
void CCubeRenderer::CacheReflection(IRenderer::TReflectionCallback cb, void* ctx, bool clearAfter) {}
|
||||||
void CCubeRenderer::DrawSpaceWarp(const zeus::CVector3f& pt, float strength) {}
|
void CCubeRenderer::DrawSpaceWarp(const zeus::CVector3f& pt, float strength) {}
|
||||||
void CCubeRenderer::DrawThermalModel(const CModel& model, const zeus::CColor& multCol, const zeus::CColor& addCol,
|
void CCubeRenderer::DrawThermalModel(const CModel& model, const zeus::CColor& multCol, const zeus::CColor& addCol,
|
||||||
TVectorRef positions, TVectorRef normals, CModelFlags flags) {}
|
TVectorRef positions, TVectorRef normals, const CModelFlags& flags) {}
|
||||||
void CCubeRenderer::DrawModelDisintegrate(const CModel& model, const CTexture& tex, const zeus::CColor& color,
|
void CCubeRenderer::DrawModelDisintegrate(const CModel& model, const CTexture& tex, const zeus::CColor& color,
|
||||||
TVectorRef positions, TVectorRef normals) {}
|
TVectorRef positions, TVectorRef normals) {}
|
||||||
void CCubeRenderer::DrawModelFlat(const CModel& model, const CModelFlags& flags, bool unsortedOnly) {}
|
void CCubeRenderer::DrawModelFlat(const CModel& model, const CModelFlags& flags, bool unsortedOnly) {}
|
||||||
|
|
|
@ -179,7 +179,7 @@ public:
|
||||||
void CacheReflection(TReflectionCallback cb, void* ctx, bool clearAfter) override;
|
void CacheReflection(TReflectionCallback cb, void* ctx, bool clearAfter) override;
|
||||||
void DrawSpaceWarp(const zeus::CVector3f& pt, float strength) override;
|
void DrawSpaceWarp(const zeus::CVector3f& pt, float strength) override;
|
||||||
void DrawThermalModel(const CModel& model, const zeus::CColor& multCol, const zeus::CColor& addCol,
|
void DrawThermalModel(const CModel& model, const zeus::CColor& multCol, const zeus::CColor& addCol,
|
||||||
TVectorRef positions, TVectorRef normals, CModelFlags flags) override;
|
TVectorRef positions, TVectorRef normals, const CModelFlags& flags) override;
|
||||||
void DrawModelDisintegrate(const CModel& model, const CTexture& tex, const zeus::CColor& color, TVectorRef positions,
|
void DrawModelDisintegrate(const CModel& model, const CTexture& tex, const zeus::CColor& color, TVectorRef positions,
|
||||||
TVectorRef normals) override;
|
TVectorRef normals) override;
|
||||||
void DrawModelFlat(const CModel& model, const CModelFlags& flags, bool unsortedOnly) override;
|
void DrawModelFlat(const CModel& model, const CModelFlags& flags, bool unsortedOnly) override;
|
||||||
|
|
|
@ -249,12 +249,28 @@ void CModel::Touch(u32 matIdx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModel::Draw(CModelFlags flags) const {}
|
void CModel::Draw(CModelFlags flags) {
|
||||||
|
if (flags.x2_flags & CModelFlagBits::DrawNormal) {
|
||||||
|
x28_modelInst->DrawNormal(nullptr, nullptr, ESurfaceSelection::All);
|
||||||
|
}
|
||||||
|
CCubeMaterial::ResetCachedMaterials();
|
||||||
|
MoveToThisFrameList();
|
||||||
|
VerifyCurrentShader(flags.x1_matSetIdx);
|
||||||
|
x28_modelInst->Draw(flags);
|
||||||
|
}
|
||||||
|
|
||||||
void CModel::Draw(TVectorRef positions, TVectorRef normals, CModelFlags flags) {}
|
void CModel::Draw(TVectorRef positions, TVectorRef normals, const CModelFlags& flags) {
|
||||||
|
if (flags.x2_flags & CModelFlagBits::DrawNormal) {
|
||||||
|
x28_modelInst->DrawNormal(positions, normals, ESurfaceSelection::All);
|
||||||
|
}
|
||||||
|
CCubeMaterial::ResetCachedMaterials();
|
||||||
|
MoveToThisFrameList();
|
||||||
|
VerifyCurrentShader(flags.x1_matSetIdx);
|
||||||
|
x28_modelInst->Draw(positions, normals, flags);
|
||||||
|
}
|
||||||
|
|
||||||
void CModel::DrawSortedParts(CModelFlags flags) {
|
void CModel::DrawSortedParts(CModelFlags flags) {
|
||||||
if ((flags.x2_flags & 0x20) != 0) {
|
if (flags.x2_flags & CModelFlagBits::DrawNormal) {
|
||||||
x28_modelInst->DrawNormal(nullptr, nullptr, ESurfaceSelection::Sorted);
|
x28_modelInst->DrawNormal(nullptr, nullptr, ESurfaceSelection::Sorted);
|
||||||
}
|
}
|
||||||
CCubeMaterial::ResetCachedMaterials();
|
CCubeMaterial::ResetCachedMaterials();
|
||||||
|
@ -264,7 +280,7 @@ void CModel::DrawSortedParts(CModelFlags flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModel::DrawUnsortedParts(CModelFlags flags) {
|
void CModel::DrawUnsortedParts(CModelFlags flags) {
|
||||||
if ((flags.x2_flags & 0x20) != 0) {
|
if (flags.x2_flags & CModelFlagBits::DrawNormal) {
|
||||||
x28_modelInst->DrawNormal(nullptr, nullptr, ESurfaceSelection::Unsorted);
|
x28_modelInst->DrawNormal(nullptr, nullptr, ESurfaceSelection::Unsorted);
|
||||||
}
|
}
|
||||||
CCubeMaterial::ResetCachedMaterials();
|
CCubeMaterial::ResetCachedMaterials();
|
||||||
|
|
|
@ -13,6 +13,17 @@ namespace metaforce {
|
||||||
class CCubeSurface;
|
class CCubeSurface;
|
||||||
class CCubeMaterial;
|
class CCubeMaterial;
|
||||||
|
|
||||||
|
enum class CModelFlagBits : u16 {
|
||||||
|
DepthTest = 0x1,
|
||||||
|
DepthUpdate = 0x2,
|
||||||
|
NoTextureLock = 0x4,
|
||||||
|
DepthGreater = 0x8,
|
||||||
|
DepthNonInclusive = 0x10,
|
||||||
|
DrawNormal = 0x20,
|
||||||
|
Unknown1 = 0x40,
|
||||||
|
};
|
||||||
|
using CModelFlagsFlags = Flags<CModelFlagBits>;
|
||||||
|
|
||||||
struct CModelFlags {
|
struct CModelFlags {
|
||||||
/**
|
/**
|
||||||
* 2: add color
|
* 2: add color
|
||||||
|
@ -22,14 +33,7 @@ struct CModelFlags {
|
||||||
*/
|
*/
|
||||||
u8 x0_blendMode = 0;
|
u8 x0_blendMode = 0;
|
||||||
u8 x1_matSetIdx = 0;
|
u8 x1_matSetIdx = 0;
|
||||||
/**
|
CModelFlagsFlags x2_flags{};
|
||||||
* 0x1: depth equal
|
|
||||||
* 0x2: depth update
|
|
||||||
* 0x4: render without texture lock
|
|
||||||
* 0x8: depth greater
|
|
||||||
* 0x10: depth non-inclusive
|
|
||||||
*/
|
|
||||||
u16 x2_flags = 0;
|
|
||||||
/**
|
/**
|
||||||
* Set into kcolor slot specified by material
|
* Set into kcolor slot specified by material
|
||||||
*/
|
*/
|
||||||
|
@ -38,6 +42,8 @@ struct CModelFlags {
|
||||||
constexpr CModelFlags() = default;
|
constexpr CModelFlags() = default;
|
||||||
constexpr CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col)
|
constexpr CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col)
|
||||||
: x0_blendMode(blendMode), x1_matSetIdx(shadIdx), x2_flags(flags), x4_color(col) {}
|
: x0_blendMode(blendMode), x1_matSetIdx(shadIdx), x2_flags(flags), x4_color(col) {}
|
||||||
|
constexpr CModelFlags(u8 blendMode, u8 shadIdx, CModelFlagsFlags flags, const zeus::CColor& col)
|
||||||
|
: x0_blendMode(blendMode), x1_matSetIdx(shadIdx), x2_flags(flags), x4_color(col) {}
|
||||||
|
|
||||||
bool operator==(const CModelFlags& other) const {
|
bool operator==(const CModelFlags& other) const {
|
||||||
return x0_blendMode == other.x0_blendMode && x1_matSetIdx == other.x1_matSetIdx && x2_flags == other.x2_flags &&
|
return x0_blendMode == other.x0_blendMode && x1_matSetIdx == other.x1_matSetIdx && x2_flags == other.x2_flags &&
|
||||||
|
@ -92,8 +98,8 @@ public:
|
||||||
void RemoveFromList();
|
void RemoveFromList();
|
||||||
void VerifyCurrentShader(u32 matIdx);
|
void VerifyCurrentShader(u32 matIdx);
|
||||||
void Touch(u32 matIdx);
|
void Touch(u32 matIdx);
|
||||||
void Draw(CModelFlags flags) const;
|
void Draw(CModelFlags flags);
|
||||||
void Draw(TVectorRef positions, TVectorRef normals, CModelFlags flags);
|
void Draw(TVectorRef positions, TVectorRef normals, const CModelFlags& flags);
|
||||||
void DrawSortedParts(CModelFlags flags);
|
void DrawSortedParts(CModelFlags flags);
|
||||||
void DrawUnsortedParts(CModelFlags flags);
|
void DrawUnsortedParts(CModelFlags flags);
|
||||||
bool IsLoaded(u32 matIdx);
|
bool IsLoaded(u32 matIdx);
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
virtual void CacheReflection(TReflectionCallback cb, void* ctx, bool clearAfter) = 0;
|
virtual void CacheReflection(TReflectionCallback cb, void* ctx, bool clearAfter) = 0;
|
||||||
virtual void DrawSpaceWarp(const zeus::CVector3f& pt, float strength) = 0;
|
virtual void DrawSpaceWarp(const zeus::CVector3f& pt, float strength) = 0;
|
||||||
virtual void DrawThermalModel(const CModel& model, const zeus::CColor& multCol, const zeus::CColor& addCol,
|
virtual void DrawThermalModel(const CModel& model, const zeus::CColor& multCol, const zeus::CColor& addCol,
|
||||||
TVectorRef positions, TVectorRef normals, CModelFlags flags) = 0;
|
TVectorRef positions, TVectorRef normals, const CModelFlags& flags) = 0;
|
||||||
virtual void DrawModelDisintegrate(const CModel& model, const CTexture& tex, const zeus::CColor& color,
|
virtual void DrawModelDisintegrate(const CModel& model, const CTexture& tex, const zeus::CColor& color,
|
||||||
TVectorRef positions, TVectorRef normals) = 0;
|
TVectorRef positions, TVectorRef normals) = 0;
|
||||||
virtual void DrawModelFlat(const CModel& model, const CModelFlags& flags, bool unsortedOnly) = 0;
|
virtual void DrawModelFlat(const CModel& model, const CModelFlags& flags, bool unsortedOnly) = 0;
|
||||||
|
|
|
@ -502,7 +502,7 @@ void CCompoundTargetReticle::Draw(const CStateManager& mgr, bool hideLockon) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompoundTargetReticle::DrawGrapplePoint(const CScriptGrapplePoint& point, float t, const CStateManager& mgr,
|
void CCompoundTargetReticle::DrawGrapplePoint(const CScriptGrapplePoint& point, float t, const CStateManager& mgr,
|
||||||
const zeus::CMatrix3f& rot, bool zEqual) const {
|
const zeus::CMatrix3f& rot, bool zEqual) {
|
||||||
zeus::CVector3f orbitPos = point.GetOrbitPosition(mgr);
|
zeus::CVector3f orbitPos = point.GetOrbitPosition(mgr);
|
||||||
zeus::CColor color;
|
zeus::CColor color;
|
||||||
|
|
||||||
|
@ -524,7 +524,7 @@ void CCompoundTargetReticle::DrawGrapplePoint(const CScriptGrapplePoint& point,
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompoundTargetReticle::DrawGrappleGroup(const zeus::CMatrix3f& rot, const CStateManager& mgr,
|
void CCompoundTargetReticle::DrawGrappleGroup(const zeus::CMatrix3f& rot, const CStateManager& mgr,
|
||||||
bool hideLockon) const {
|
bool hideLockon) {
|
||||||
if (x28_noDrawTicks > 0) {
|
if (x28_noDrawTicks > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +569,7 @@ void CCompoundTargetReticle::DrawGrappleGroup(const zeus::CMatrix3f& rot, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager& mgr) const {
|
void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager& mgr) {
|
||||||
if (x28_noDrawTicks > 0) {
|
if (x28_noDrawTicks > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -677,7 +677,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con
|
||||||
1.f / x10c_currGroupInterp.GetFactor() * g_tweakTargeting->GetOuterBeamSquaresScale());
|
1.f / x10c_currGroupInterp.GetFactor() * g_tweakTargeting->GetOuterBeamSquaresScale());
|
||||||
zeus::CMatrix3f outerBeamXf = rot * scale;
|
zeus::CMatrix3f outerBeamXf = rot * scale;
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
const SOuterItemInfo& info = xe0_outerBeamIconSquares[i];
|
SOuterItemInfo& info = xe0_outerBeamIconSquares[i];
|
||||||
if (info.x0_model.IsLoaded()) {
|
if (info.x0_model.IsLoaded()) {
|
||||||
zeus::CTransform modelXf(lockBreakXf * outerBeamXf * zeus::CMatrix3f::RotateY(info.x10_rotAng),
|
zeus::CTransform modelXf(lockBreakXf * outerBeamXf * zeus::CMatrix3f::RotateY(info.x10_rotAng),
|
||||||
x10c_currGroupInterp.GetTargetPositionWorld());
|
x10c_currGroupInterp.GetTargetPositionWorld());
|
||||||
|
@ -925,7 +925,7 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompoundTargetReticle::DrawOrbitZoneGroup(const zeus::CMatrix3f& rot, const CStateManager& mgr) const {
|
void CCompoundTargetReticle::DrawOrbitZoneGroup(const zeus::CMatrix3f& rot, const CStateManager& mgr) {
|
||||||
if (x28_noDrawTicks > 0) {
|
if (x28_noDrawTicks > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ private:
|
||||||
SScanReticuleRenderer m_scanRetRenderer;
|
SScanReticuleRenderer m_scanRetRenderer;
|
||||||
|
|
||||||
void DrawGrapplePoint(const CScriptGrapplePoint& point, float t, const CStateManager& mgr, const zeus::CMatrix3f& rot,
|
void DrawGrapplePoint(const CScriptGrapplePoint& point, float t, const CStateManager& mgr, const zeus::CMatrix3f& rot,
|
||||||
bool zEqual) const;
|
bool zEqual);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CCompoundTargetReticle(const CStateManager&);
|
explicit CCompoundTargetReticle(const CStateManager&);
|
||||||
|
@ -146,10 +146,10 @@ public:
|
||||||
void UpdateNextLockOnGroup(float, const CStateManager&);
|
void UpdateNextLockOnGroup(float, const CStateManager&);
|
||||||
void UpdateOrbitZoneGroup(float, const CStateManager&);
|
void UpdateOrbitZoneGroup(float, const CStateManager&);
|
||||||
void Draw(const CStateManager&, bool hideLockon);
|
void Draw(const CStateManager&, bool hideLockon);
|
||||||
void DrawGrappleGroup(const zeus::CMatrix3f& rot, const CStateManager&, bool) const;
|
void DrawGrappleGroup(const zeus::CMatrix3f& rot, const CStateManager&, bool);
|
||||||
void DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager&) const;
|
void DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager&);
|
||||||
void DrawNextLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager&);
|
void DrawNextLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager&);
|
||||||
void DrawOrbitZoneGroup(const zeus::CMatrix3f& rot, const CStateManager&) const;
|
void DrawOrbitZoneGroup(const zeus::CMatrix3f& rot, const CStateManager&);
|
||||||
void UpdateTargetParameters(CTargetReticleRenderState&, const CStateManager&);
|
void UpdateTargetParameters(CTargetReticleRenderState&, const CStateManager&);
|
||||||
float CalculateRadiusWorld(const CActor&, const CStateManager&) const;
|
float CalculateRadiusWorld(const CActor&, const CStateManager&) const;
|
||||||
zeus::CVector3f CalculatePositionWorld(const CActor&, const CStateManager&) const;
|
zeus::CVector3f CalculatePositionWorld(const CActor&, const CStateManager&) const;
|
||||||
|
|
|
@ -45,42 +45,36 @@ void CGuiFrame::SortDrawOrder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuiFrame::EnableLights(u32 lights) const {
|
void CGuiFrame::EnableLights(u32 lights) const {
|
||||||
std::vector<CLight> lightsOut;
|
|
||||||
lightsOut.reserve(m_indexedLights.size() + 1);
|
|
||||||
CGraphics::DisableAllLights();
|
CGraphics::DisableAllLights();
|
||||||
|
|
||||||
zeus::CColor ambColor(zeus::skBlack);
|
zeus::CColor ambColor(zeus::skBlack);
|
||||||
ERglLight lightId = ERglLight::Zero;
|
ERglLight lightId = ERglLight::Zero;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
int enabledLights = 0;
|
||||||
for (CGuiLight* light : m_indexedLights) {
|
for (CGuiLight* light : m_indexedLights) {
|
||||||
if (!light || !light->GetIsVisible()) {
|
if (light == nullptr || !light->GetIsVisible()) {
|
||||||
++reinterpret_cast<std::underlying_type_t<ERglLight>&>(lightId);
|
++reinterpret_cast<std::underlying_type_t<ERglLight>&>(lightId);
|
||||||
++idx;
|
++idx;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((lights & (1 << idx)) != 0) {
|
if ((lights & (1 << idx)) != 0) {
|
||||||
// const zeus::CColor& geomCol = light->GetGeometryColor();
|
const zeus::CColor& geomCol = light->GetGeometryColor();
|
||||||
// if (geomCol.r || geomCol.g || geomCol.b)
|
if (geomCol.r() != 0.f || geomCol.g() != 0.f || geomCol.b() != 0.f) {
|
||||||
//{
|
CGraphics::LoadLight(lightId, light->BuildLight());
|
||||||
// CGraphics::LoadLight(lightId, light->BuildLight());
|
|
||||||
lightsOut.push_back(light->BuildLight());
|
|
||||||
CGraphics::EnableLight(lightId);
|
CGraphics::EnableLight(lightId);
|
||||||
//}
|
}
|
||||||
// accumulate ambient color
|
// accumulate ambient color
|
||||||
ambColor += light->GetAmbientLightColor();
|
ambColor += light->GetAmbientLightColor();
|
||||||
|
++enabledLights;
|
||||||
}
|
}
|
||||||
++reinterpret_cast<std::underlying_type_t<ERglLight>&>(lightId);
|
++reinterpret_cast<std::underlying_type_t<ERglLight>&>(lightId);
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
if (lightsOut.empty()) {
|
if (enabledLights == 0) {
|
||||||
// CGraphics::SetAmbientColor(zeus::skWhite);
|
CGraphics::SetAmbientColor(zeus::skWhite);
|
||||||
lightsOut.push_back(CLight::BuildLocalAmbient(zeus::skZero3f, zeus::skWhite));
|
|
||||||
} else {
|
} else {
|
||||||
// CGraphics::SetAmbientColor(ambColor);
|
CGraphics::SetAmbientColor(ambColor);
|
||||||
lightsOut.push_back(CLight::BuildLocalAmbient(zeus::skZero3f, ambColor));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO model.ActivateLights(lightsOut);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuiFrame::DisableLights() const { CGraphics::DisableAllLights(); }
|
void CGuiFrame::DisableLights() const { CGraphics::DisableAllLights(); }
|
||||||
|
|
|
@ -10,9 +10,9 @@ namespace metaforce {
|
||||||
|
|
||||||
CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag)
|
CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag)
|
||||||
: CGuiWidget(parms), xc8_modelId(modelId), xcc_lightMask(lightMask) {
|
: CGuiWidget(parms), xc8_modelId(modelId), xcc_lightMask(lightMask) {
|
||||||
if (!flag || !modelId.IsValid() || parms.x0_frame->GetGuiSys().GetUsageMode() == CGuiSys::EUsageMode::Two)
|
if (!flag || !modelId.IsValid() || parms.x0_frame->GetGuiSys().GetUsageMode() == CGuiSys::EUsageMode::Two) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
xb8_model = sp->GetObj({SBIG('CMDL'), modelId});
|
xb8_model = sp->GetObj({SBIG('CMDL'), modelId});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,23 +23,17 @@ bool CGuiModel::GetIsFinishedLoadingWidgetSpecific() {
|
||||||
if (!xb8_model.IsLoaded()) {
|
if (!xb8_model.IsLoaded()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//xb8_model->GetInstance().Touch(0);
|
xb8_model->Touch(0);
|
||||||
return true; //xb8_model->IsLoaded(0);
|
return xb8_model->IsLoaded(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuiModel::Touch() {
|
void CGuiModel::Touch() {
|
||||||
return;
|
if (CModel* const model = xb8_model.GetObj()) {
|
||||||
CModel* const model = xb8_model.GetObj();
|
|
||||||
|
|
||||||
if (model == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
model->Touch(0);
|
model->Touch(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) {
|
void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) {
|
||||||
return;
|
|
||||||
CGraphics::SetModelMatrix(x34_worldXF);
|
CGraphics::SetModelMatrix(x34_worldXF);
|
||||||
if (!xb8_model) {
|
if (!xb8_model) {
|
||||||
return;
|
return;
|
||||||
|
@ -48,7 +42,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CModel* const model = xb8_model.GetObj();
|
CModel* const model = xb8_model.GetObj();
|
||||||
if (!model) {
|
if (model == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,58 +50,48 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CGuiModel::Draw {}"), m_name).c_str(), zeus::skCyan);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CGuiModel::Draw {}"), m_name).c_str(), zeus::skCyan);
|
||||||
zeus::CColor moduCol = xa8_color2;
|
zeus::CColor moduCol = xa8_color2;
|
||||||
moduCol.a() *= parms.x0_alphaMod;
|
moduCol.a() *= parms.x0_alphaMod;
|
||||||
// TODO xb0_frame->EnableLights(xcc_lightMask, model->GetInstance());
|
xb0_frame->EnableLights(xcc_lightMask);
|
||||||
// if (xb6_29_cullFaces)
|
if (xb6_29_cullFaces) {
|
||||||
// CGraphics::SetCullMode(ERglCullMode::Front);
|
CGraphics::SetCullMode(ERglCullMode::Front);
|
||||||
|
}
|
||||||
|
|
||||||
switch (xac_drawFlags) {
|
switch (xac_drawFlags) {
|
||||||
case EGuiModelDrawFlags::Shadeless: {
|
case EGuiModelDrawFlags::Shadeless: {
|
||||||
CModelFlags flags(0, 0, 3, zeus::skWhite);
|
constexpr CModelFlags flags(0, 0, 3, zeus::skWhite);
|
||||||
// flags.m_extendedShader = EExtendedShader::Flat;
|
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EGuiModelDrawFlags::Opaque: {
|
case EGuiModelDrawFlags::Opaque: {
|
||||||
CModelFlags flags(1, 0, 3, moduCol);
|
CModelFlags flags(1, 0, 3, moduCol);
|
||||||
// flags.m_extendedShader = EExtendedShader::Lighting;
|
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EGuiModelDrawFlags::Alpha: {
|
case EGuiModelDrawFlags::Alpha: {
|
||||||
CModelFlags flags(5, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
|
CModelFlags flags(5, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
|
||||||
// flags.m_noCull = !xb6_29_cullFaces;
|
|
||||||
// flags.m_noZWrite = !xb7_24_depthWrite;
|
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EGuiModelDrawFlags::Additive: {
|
case EGuiModelDrawFlags::Additive: {
|
||||||
CModelFlags flags(7, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
|
CModelFlags flags(7, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
|
||||||
// flags.m_noCull = !xb6_29_cullFaces;
|
|
||||||
// flags.m_noZWrite = !xb7_24_depthWrite;
|
|
||||||
// flags.m_depthGreater = xb6_30_depthGreater;
|
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EGuiModelDrawFlags::AlphaAdditiveOverdraw: {
|
case EGuiModelDrawFlags::AlphaAdditiveOverdraw: {
|
||||||
CModelFlags flags(5, 0, xb6_31_depthTest, moduCol);
|
const CModelFlags flags(5, 0, (u32(xb6_30_depthGreater) << 4) | u32(xb6_31_depthTest), moduCol);
|
||||||
// flags.m_noCull = !xb6_29_cullFaces;
|
|
||||||
// flags.m_noZWrite = !xb7_24_depthWrite;
|
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
|
|
||||||
flags.x0_blendMode = 7;
|
const CModelFlags overdrawFlags(
|
||||||
flags.x1_matSetIdx = 0;
|
8, 0, (u32(xb6_30_depthGreater) << 4) | (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
|
||||||
flags.x2_flags = (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest);
|
model->Draw(overdrawFlags);
|
||||||
flags.x4_color = moduCol;
|
|
||||||
// flags.m_noCull = !xb6_29_cullFaces;
|
|
||||||
model->Draw(flags);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (xb6_29_cullFaces)
|
if (xb6_29_cullFaces) {
|
||||||
// CGraphics::SetCullMode(ERglCullMode::None);
|
CGraphics::SetCullMode(ERglCullMode::None);
|
||||||
|
}
|
||||||
xb0_frame->DisableLights();
|
xb0_frame->DisableLights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,15 +99,16 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGuiModel::TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2f& point) const {
|
bool CGuiModel::TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2f& point) const {
|
||||||
if (!xb8_model || !xb8_model.IsLoaded())
|
if (!xb8_model || !xb8_model.IsLoaded()) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return xb8_model->GetAABB().projectedPointTest(vp * x34_worldXF.toMatrix4f(), point);
|
return xb8_model->GetAABB().projectedPointTest(vp * x34_worldXF.toMatrix4f(), point);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CGuiWidget> CGuiModel::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) {
|
std::shared_ptr<CGuiWidget> CGuiModel::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) {
|
||||||
CGuiWidgetParms parms = ReadWidgetHeader(frame, in);
|
CGuiWidgetParms parms = ReadWidgetHeader(frame, in);
|
||||||
|
|
||||||
CAssetId model = in.Get<CAssetId>();
|
auto model = in.Get<CAssetId>();
|
||||||
in.ReadLong();
|
in.ReadLong();
|
||||||
u32 lightMask = in.ReadLong();
|
u32 lightMask = in.ReadLong();
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ void COrbitPointMarker::Update(float dt, const CStateManager& mgr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void COrbitPointMarker::Draw(const CStateManager& mgr) const {
|
void COrbitPointMarker::Draw(const CStateManager& mgr) {
|
||||||
if ((x1c_lastFreeOrbit || x20_interpTimer > 0.f) && g_tweakTargeting->DrawOrbitPoint() &&
|
if ((x1c_lastFreeOrbit || x20_interpTimer > 0.f) && g_tweakTargeting->DrawOrbitPoint() &&
|
||||||
x28_orbitPointModel.IsLoaded()) {
|
x28_orbitPointModel.IsLoaded()) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP("COrbitPointMarker::Draw", zeus::skCyan);
|
SCOPED_GRAPHICS_DEBUG_GROUP("COrbitPointMarker::Draw", zeus::skCyan);
|
||||||
|
|
|
@ -24,6 +24,6 @@ public:
|
||||||
COrbitPointMarker();
|
COrbitPointMarker();
|
||||||
bool CheckLoadComplete() const;
|
bool CheckLoadComplete() const;
|
||||||
void Update(float dt, const CStateManager& mgr);
|
void Update(float dt, const CStateManager& mgr);
|
||||||
void Draw(const CStateManager& mgr) const;
|
void Draw(const CStateManager& mgr);
|
||||||
};
|
};
|
||||||
} // namespace metaforce
|
} // namespace metaforce
|
||||||
|
|
|
@ -56,7 +56,7 @@ int CPlayerVisor::FindCachedInactiveScanTarget(TUniqueId uid) const {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlayerVisor::DrawScanObjectIndicators(const CStateManager& mgr) const {
|
bool CPlayerVisor::DrawScanObjectIndicators(const CStateManager& mgr) {
|
||||||
if (!x124_scanIconNoncritical.IsLoaded() || !x130_scanIconCritical.IsLoaded())
|
if (!x124_scanIconNoncritical.IsLoaded() || !x130_scanIconCritical.IsLoaded())
|
||||||
return false;
|
return false;
|
||||||
if (!x114_scanShield.IsLoaded())
|
if (!x114_scanShield.IsLoaded())
|
||||||
|
@ -89,7 +89,7 @@ bool CPlayerVisor::DrawScanObjectIndicators(const CStateManager& mgr) const {
|
||||||
if (!act->GetMaterialList().HasMaterial(EMaterialTypes::Scannable))
|
if (!act->GetMaterialList().HasMaterial(EMaterialTypes::Scannable))
|
||||||
continue;
|
continue;
|
||||||
const CScannableObjectInfo* scanInfo = act->GetScannableObjectInfo();
|
const CScannableObjectInfo* scanInfo = act->GetScannableObjectInfo();
|
||||||
const CModel* useModel;
|
CModel* useModel;
|
||||||
const zeus::CColor* useColor;
|
const zeus::CColor* useColor;
|
||||||
const zeus::CColor* useDimColor;
|
const zeus::CColor* useDimColor;
|
||||||
if (scanInfo->IsImportant()) {
|
if (scanInfo->IsImportant()) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ class CPlayerVisor {
|
||||||
|
|
||||||
int FindEmptyInactiveScanTarget() const;
|
int FindEmptyInactiveScanTarget() const;
|
||||||
int FindCachedInactiveScanTarget(TUniqueId uid) const;
|
int FindCachedInactiveScanTarget(TUniqueId uid) const;
|
||||||
bool DrawScanObjectIndicators(const CStateManager& mgr) const;
|
bool DrawScanObjectIndicators(const CStateManager& mgr);
|
||||||
void UpdateScanObjectIndicators(const CStateManager& mgr, float dt);
|
void UpdateScanObjectIndicators(const CStateManager& mgr, float dt);
|
||||||
void UpdateScanWindow(float dt, const CStateManager& mgr);
|
void UpdateScanWindow(float dt, const CStateManager& mgr);
|
||||||
EScanWindowState GetDesiredScanWindowState(const CStateManager& mgr) const;
|
EScanWindowState GetDesiredScanWindowState(const CStateManager& mgr) const;
|
||||||
|
|
|
@ -59,9 +59,7 @@ void CAtomicAlpha::Render(CStateManager& mgr) {
|
||||||
GetTransform() * GetScaledLocatorTransform(bomb.x0_locatorName) *
|
GetTransform() * GetScaledLocatorTransform(bomb.x0_locatorName) *
|
||||||
zeus::CTransform::Scale(
|
zeus::CTransform::Scale(
|
||||||
std::min(1.f, std::max(0.f, bomb.x14_scaleTime - x570_bombReappearDelay) / x570_bombReappearDelay));
|
std::min(1.f, std::max(0.f, bomb.x14_scaleTime - x570_bombReappearDelay) / x570_bombReappearDelay));
|
||||||
CModelFlags flags;
|
CModelFlags flags{0, 0, 3, zeus::skWhite};
|
||||||
flags.x2_flags = 1 | 2;
|
|
||||||
flags.x4_color = zeus::skWhite;
|
|
||||||
x690_bombModel.Render(mgr, locatorXf, x90_actorLights.get(), flags);
|
x690_bombModel.Render(mgr, locatorXf, x90_actorLights.get(), flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,9 +617,9 @@ void CRidley::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
|
||||||
CPlayerState::EPlayerVisor r28 = mgr.GetPlayerState()->GetActiveVisor(mgr);
|
CPlayerState::EPlayerVisor r28 = mgr.GetPlayerState()->GetActiveVisor(mgr);
|
||||||
bool atLastMat = GetModelData()->GetNumMaterialSets() == (matSet + 1);
|
bool atLastMat = GetModelData()->GetNumMaterialSets() == (matSet + 1);
|
||||||
if (r28 == CPlayerState::EPlayerVisor::Thermal && atLastMat) {
|
if (r28 == CPlayerState::EPlayerVisor::Thermal && atLastMat) {
|
||||||
xb4_drawFlags.x2_flags |= 0x40;
|
xb4_drawFlags.x2_flags |= CModelFlagBits::Unknown1;
|
||||||
} else {
|
} else {
|
||||||
xb4_drawFlags.x2_flags &= 0x40;
|
xb4_drawFlags.x2_flags &= CModelFlagBits::Unknown1;
|
||||||
}
|
}
|
||||||
xb4_drawFlags.x1_matSetIdx = matSet;
|
xb4_drawFlags.x1_matSetIdx = matSet;
|
||||||
|
|
||||||
|
|
|
@ -108,10 +108,7 @@ void CSeedling::Think(float dt, CStateManager& mgr) {
|
||||||
void CSeedling::Render(CStateManager& mgr) {
|
void CSeedling::Render(CStateManager& mgr) {
|
||||||
if (x400_25_alive && x6bc_spikeData) {
|
if (x400_25_alive && x6bc_spikeData) {
|
||||||
const size_t index = x722_24_renderOnlyClusterA ? 0 : size_t(x722_25_curNeedleCluster);
|
const size_t index = x722_24_renderOnlyClusterA ? 0 : size_t(x722_25_curNeedleCluster);
|
||||||
CModelFlags flags;
|
CModelFlags flags{0, 0, 3, zeus::skWhite};
|
||||||
flags.x2_flags = 3;
|
|
||||||
flags.x4_color = zeus::skWhite;
|
|
||||||
|
|
||||||
for (const auto& sv : skNeedleLocators[index]) {
|
for (const auto& sv : skNeedleLocators[index]) {
|
||||||
x6bc_spikeData->Render(mgr, GetLctrTransform(sv), x90_actorLights.get(), flags);
|
x6bc_spikeData->Render(mgr, GetLctrTransform(sv), x90_actorLights.get(), flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ void CDecal::RenderQuad(CQuadDecal& decal, const SQuadDescr& desc) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDecal::RenderMdl() {
|
void CDecal::RenderMdl() {
|
||||||
const CDecalDescription& desc = *x0_description;
|
CDecalDescription& desc = *x0_description;
|
||||||
zeus::CColor color = zeus::skWhite;
|
zeus::CColor color = zeus::skWhite;
|
||||||
zeus::CVector3f dmop;
|
zeus::CVector3f dmop;
|
||||||
zeus::CTransform rotXf;
|
zeus::CTransform rotXf;
|
||||||
|
|
|
@ -149,11 +149,13 @@ void CScriptActor::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum)
|
||||||
|
|
||||||
if (x2e2_24_noThermalHotZ && xe6_27_thermalVisorFlags == 2) {
|
if (x2e2_24_noThermalHotZ && xe6_27_thermalVisorFlags == 2) {
|
||||||
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Thermal) {
|
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Thermal) {
|
||||||
xb4_drawFlags.x2_flags &= ~3; // Disable Z test/update
|
// Disable Z test/update
|
||||||
// xb4_drawFlags.m_noZTest = true;
|
xb4_drawFlags.x2_flags &= CModelFlagBits::DepthTest;
|
||||||
|
xb4_drawFlags.x2_flags &= CModelFlagBits::DepthUpdate;
|
||||||
} else {
|
} else {
|
||||||
xb4_drawFlags.x2_flags |= 3; // Enable Z test/update
|
// Enable Z test/update
|
||||||
// xb4_drawFlags.m_noZTest = false;
|
xb4_drawFlags.x2_flags |= CModelFlagBits::DepthTest;
|
||||||
|
xb4_drawFlags.x2_flags |= CModelFlagBits::DepthUpdate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,83 +109,38 @@ void CScriptColorModulate::Think(float dt, CStateManager& mgr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CModelFlags CScriptColorModulate::CalculateFlags(const zeus::CColor& col) const {
|
CModelFlags CScriptColorModulate::CalculateFlags(const zeus::CColor& col) const {
|
||||||
CModelFlags ret;
|
|
||||||
if (x54_28_depthBackwards) {
|
if (x54_28_depthBackwards) {
|
||||||
if (x48_blendMode == EBlendMode::Alpha) {
|
if (x48_blendMode == EBlendMode::Alpha) {
|
||||||
ret.x0_blendMode = 5;
|
return {5, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8), col};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8;
|
|
||||||
ret.x4_color = col;
|
|
||||||
} else if (x48_blendMode == EBlendMode::Additive) {
|
} else if (x48_blendMode == EBlendMode::Additive) {
|
||||||
ret.x0_blendMode = 7;
|
return {7, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8), col};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8;
|
|
||||||
ret.x4_color = col;
|
|
||||||
} else if (x48_blendMode == EBlendMode::Additive2) {
|
} else if (x48_blendMode == EBlendMode::Additive2) {
|
||||||
ret.x0_blendMode = 8;
|
return {8, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8), col};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8;
|
|
||||||
ret.x4_color = col;
|
|
||||||
} else if (x48_blendMode == EBlendMode::Opaque) {
|
} else if (x48_blendMode == EBlendMode::Opaque) {
|
||||||
ret.x0_blendMode = 1;
|
return {1, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8), col};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8;
|
|
||||||
ret.x4_color = col;
|
|
||||||
} else if (x48_blendMode == EBlendMode::OpaqueAdd) {
|
} else if (x48_blendMode == EBlendMode::OpaqueAdd) {
|
||||||
ret.x0_blendMode = 2;
|
return {2, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8), col};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8;
|
|
||||||
// ret.addColor = col;
|
|
||||||
} else {
|
|
||||||
ret.x2_flags = 3;
|
|
||||||
ret.x4_color = zeus::skWhite;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else if (x48_blendMode == EBlendMode::Alpha) {
|
||||||
if (x48_blendMode == EBlendMode::Alpha) {
|
|
||||||
if (col == zeus::skWhite) {
|
if (col == zeus::skWhite) {
|
||||||
ret.x0_blendMode = 0;
|
return {0, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), zeus::skWhite};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
|
||||||
ret.x4_color = zeus::skWhite;
|
|
||||||
} else {
|
} else {
|
||||||
ret.x0_blendMode = 5;
|
return {5, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), col};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
|
||||||
ret.x4_color = col;
|
|
||||||
}
|
}
|
||||||
} else if (x48_blendMode == EBlendMode::Additive) {
|
} else if (x48_blendMode == EBlendMode::Additive) {
|
||||||
ret.x0_blendMode = 7;
|
return {7, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), col};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
|
||||||
ret.x4_color = col;
|
|
||||||
} else if (x48_blendMode == EBlendMode::Additive2) {
|
} else if (x48_blendMode == EBlendMode::Additive2) {
|
||||||
ret.x0_blendMode = 8;
|
return {8, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), col};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
|
||||||
ret.x4_color = col;
|
|
||||||
} else if (x48_blendMode == EBlendMode::Opaque) {
|
} else if (x48_blendMode == EBlendMode::Opaque) {
|
||||||
if (col == zeus::skWhite) {
|
if (col == zeus::skWhite) {
|
||||||
ret.x0_blendMode = 0;
|
return {0, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), zeus::skWhite};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
|
||||||
ret.x4_color = zeus::skWhite;
|
|
||||||
} else {
|
} else {
|
||||||
ret.x0_blendMode = 1;
|
return {1, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), col};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
|
||||||
ret.x4_color = col;
|
|
||||||
}
|
}
|
||||||
} else if (x48_blendMode == EBlendMode::OpaqueAdd) {
|
} else if (x48_blendMode == EBlendMode::OpaqueAdd) {
|
||||||
ret.x0_blendMode = 2;
|
return {2, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), col};
|
||||||
ret.x1_matSetIdx = 0;
|
|
||||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
|
||||||
// ret.addColor = col;
|
|
||||||
} else {
|
|
||||||
ret.x2_flags = 3;
|
|
||||||
ret.x4_color = zeus::skWhite;
|
|
||||||
}
|
}
|
||||||
}
|
return {0, 0, 3, zeus::skWhite};
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptColorModulate::SetTargetFlags(CStateManager& stateMgr, const CModelFlags& flags) {
|
void CScriptColorModulate::SetTargetFlags(CStateManager& stateMgr, const CModelFlags& flags) {
|
||||||
|
|
|
@ -539,10 +539,7 @@ void CScriptGunTurret::Render(CStateManager& mgr) {
|
||||||
if (x4a4_extensionModel && x4f8_extensionT > 0.f) {
|
if (x4a4_extensionModel && x4f8_extensionT > 0.f) {
|
||||||
zeus::CTransform xf = GetTransform();
|
zeus::CTransform xf = GetTransform();
|
||||||
xf.origin = x4fc_extensionOffset + (x4f4_extensionRange * 0.5f * zeus::skDown);
|
xf.origin = x4fc_extensionOffset + (x4f4_extensionRange * 0.5f * zeus::skDown);
|
||||||
CModelFlags flags;
|
CModelFlags flags{0, 0, 3, zeus::skWhite};
|
||||||
flags.x2_flags = 3;
|
|
||||||
flags.x1_matSetIdx = 0;
|
|
||||||
flags.x4_color = zeus::skWhite;
|
|
||||||
x4a4_extensionModel->Render(mgr, xf, x90_actorLights.get(), flags);
|
x4a4_extensionModel->Render(mgr, xf, x90_actorLights.get(), flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,7 @@ CScriptPickup::CScriptPickup(TUniqueId uid, std::string_view name, const CEntity
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x278_delayTimer != 0.f) {
|
if (x278_delayTimer != 0.f) {
|
||||||
xb4_drawFlags = CModelFlags(5, 0, 3, zeus::CColor(1.f, 1.f, 1.f, 0.f));
|
xb4_drawFlags = CModelFlags(5, 0, 1, zeus::CColor(1.f, 1.f, 1.f, 0.f));
|
||||||
xb4_drawFlags.x2_flags &= 0xFFFC;
|
|
||||||
xb4_drawFlags.x2_flags |= 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,9 +64,7 @@ void CScriptPickup::Think(float dt, CStateManager& mgr) {
|
||||||
|
|
||||||
if (x268_fadeInTime != 0.f) {
|
if (x268_fadeInTime != 0.f) {
|
||||||
if (x270_curTime < x268_fadeInTime) {
|
if (x270_curTime < x268_fadeInTime) {
|
||||||
drawFlags = CModelFlags(5, 0, 3, zeus::CColor(1.f, x270_curTime / x268_fadeInTime));
|
drawFlags = CModelFlags(5, 0, 1, zeus::CColor(1.f, x270_curTime / x268_fadeInTime));
|
||||||
drawFlags.x2_flags &= 0xFFFC;
|
|
||||||
drawFlags.x2_flags |= 1;
|
|
||||||
} else {
|
} else {
|
||||||
x268_fadeInTime = 0.f;
|
x268_fadeInTime = 0.f;
|
||||||
}
|
}
|
||||||
|
@ -80,9 +76,7 @@ void CScriptPickup::Think(float dt, CStateManager& mgr) {
|
||||||
alpha = (x26c_lifeTime - x270_curTime) * 0.5f;
|
alpha = (x26c_lifeTime - x270_curTime) * 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawFlags = CModelFlags(5, 0, 3, zeus::CColor(1.f, alpha));
|
drawFlags = CModelFlags(5, 0, 1, zeus::CColor(1.f, alpha));
|
||||||
drawFlags.x2_flags &= 0xFFFC;
|
|
||||||
drawFlags.x2_flags |= 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xb4_drawFlags = drawFlags;
|
xb4_drawFlags = drawFlags;
|
||||||
|
|
|
@ -654,8 +654,8 @@ void CWorld::TouchSky() {
|
||||||
xb4_skyboxOverride.value()->Touch(0);
|
xb4_skyboxOverride.value()->Touch(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorld::DrawSky(const zeus::CTransform& xf) const {
|
void CWorld::DrawSky(const zeus::CTransform& xf) {
|
||||||
const CModel* model;
|
CModel* model;
|
||||||
if (xa4_skyboxWorldLoaded)
|
if (xa4_skyboxWorldLoaded)
|
||||||
model = xa4_skyboxWorldLoaded->GetObj();
|
model = xa4_skyboxWorldLoaded->GetObj();
|
||||||
else if (xb4_skyboxOverride)
|
else if (xb4_skyboxOverride)
|
||||||
|
@ -674,7 +674,6 @@ void CWorld::DrawSky(const zeus::CTransform& xf) const {
|
||||||
CGraphics::SetDepthRange(DEPTH_SKY, DEPTH_FAR);
|
CGraphics::SetDepthRange(DEPTH_SKY, DEPTH_FAR);
|
||||||
|
|
||||||
CModelFlags flags(0, 0, 1, zeus::skWhite);
|
CModelFlags flags(0, 0, 1, zeus::skWhite);
|
||||||
// flags.m_noZWrite = true;
|
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
|
|
||||||
CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR);
|
CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR);
|
||||||
|
|
|
@ -227,7 +227,7 @@ public:
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
void PreRender();
|
void PreRender();
|
||||||
void TouchSky();
|
void TouchSky();
|
||||||
void DrawSky(const zeus::CTransform& xf) const;
|
void DrawSky(const zeus::CTransform& xf);
|
||||||
void StopGlobalSound(u16 id);
|
void StopGlobalSound(u16 id);
|
||||||
bool HasGlobalSound(u16 id) const;
|
bool HasGlobalSound(u16 id) const;
|
||||||
void AddGlobalSound(const CSfxHandle& hnd);
|
void AddGlobalSound(const CSfxHandle& hnd);
|
||||||
|
|
Loading…
Reference in New Issue