2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 17:04:55 +00:00

Reformat pass

This commit is contained in:
2021-06-07 12:29:18 -07:00
parent d7559823ea
commit a9bcb7a9ce
424 changed files with 4377 additions and 4790 deletions

View File

@@ -990,9 +990,7 @@ void CBooRenderer::PostRenderFogs() {
x2ac_fogVolumes.clear();
}
void CBooRenderer::SetModelMatrix(const zeus::CTransform& xf) {
CGraphics::SetModelMatrix(xf);
}
void CBooRenderer::SetModelMatrix(const zeus::CTransform& xf) { CGraphics::SetModelMatrix(xf); }
void CBooRenderer::AddParticleGen(CParticleGen& gen) {
if (auto bounds = gen.GetBounds()) {
zeus::CVector3f pt = bounds.value().closestPointAlongVector(xb0_viewPlane.normal());
@@ -1250,7 +1248,7 @@ void CBooRenderer::PrepareDynamicLights(const std::vector<CLight>& lights) {
void CBooRenderer::SetGXRegister1Color(const zeus::CColor& color) { CGraphics::g_ColorRegs[1] = color; }
void CBooRenderer::SetWorldLightFadeLevel(float level) { x2fc_tevReg1Color = zeus::CColor(level, level, level, 1.f); }
void CBooRenderer::SetWorldLightMultiplyColor(const zeus::CColor& color) { CGraphics::g_ColorRegs[2] = color;}
void CBooRenderer::SetWorldLightMultiplyColor(const zeus::CColor& color) { CGraphics::g_ColorRegs[2] = color; }
void CBooRenderer::ReallyDrawPhazonSuitIndirectEffect(const zeus::CColor& vertColor, /*const CTexture& maskTex,*/
const CTexture& indTex, const zeus::CColor& modColor, float scale,

View File

@@ -40,13 +40,7 @@ class IObjectStore;
class Buckets;
enum class EWorldShadowMode {
None,
WorldOnActorShadow,
BallOnWorldShadow,
BallOnWorldIds,
MAX
};
enum class EWorldShadowMode { None, WorldOnActorShadow, BallOnWorldShadow, BallOnWorldIds, MAX };
class CBooRenderer final : public IRenderer {
friend class CBooModel;
@@ -197,8 +191,8 @@ public:
int areaIdx, const SShader* shaderSet) override;
void EnablePVS(const CPVSVisSet& set, u32 areaIdx) override;
void DisablePVS() override;
void UpdateAreaUniforms(int areaIdx, EWorldShadowMode shadowMode = EWorldShadowMode::None,
bool activateLights = true, int cubeFace = -1, const CModelFlags* ballShadowFlags = nullptr);
void UpdateAreaUniforms(int areaIdx, EWorldShadowMode shadowMode = EWorldShadowMode::None, bool activateLights = true,
int cubeFace = -1, const CModelFlags* ballShadowFlags = nullptr);
void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*) override;
void DrawAreaGeometry(int areaIdx, int mask, int targetMask) override;
void DrawUnsortedGeometry(int areaIdx, int mask, int targetMask, bool shadowRender = false) override;

View File

@@ -450,15 +450,15 @@ void CGraphics::TickRenderTimings() {
g_DefaultSeconds = g_RenderTimings / 60.f;
}
static constexpr u64 FPS_REFRESH_RATE = 1000;
static constexpr u64 FPS_REFRESH_RATE = 1000;
void CGraphics::UpdateFPSCounter() {
++g_FramesPast;
std::chrono::duration<double, std::milli> timeElapsed = frame_clock::now() - g_FrameStartTime;
if (timeElapsed.count() > FPS_REFRESH_RATE) {
g_Framerate = g_FramesPast;
g_FrameStartTime = frame_clock::now();
g_FramesPast = 0;
g_Framerate = g_FramesPast;
g_FrameStartTime = frame_clock::now();
g_FramesPast = 0;
}
}
@@ -468,48 +468,58 @@ boo::IGraphicsCommandQueue* CGraphics::g_BooMainCommandQueue = nullptr;
boo::ObjToken<boo::ITextureR> CGraphics::g_SpareTexture;
const boo::SystemChar* CGraphics::g_BooPlatformName = nullptr;
const CTevCombiners::CTevPass CGraphics::sTevPass805a564c(
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA});
const CTevCombiners::CTevPass CGraphics::sTevPass805a564c({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO,
GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO,
GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5698(
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_C0, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_A0, GX::TevAlphaArg::CA_ZERO});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5698({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC,
GX::TevColorArg::CC_C0, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA,
GX::TevAlphaArg::CA_A0, GX::TevAlphaArg::CA_ZERO});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5e70(
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_C0},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_A0});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5e70({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO,
GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_C0},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO,
GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_A0});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5ebc(
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_ZERO});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5ebc({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC,
GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA,
GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_ZERO});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5f08(
{GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_TEXA, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5f08({GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_TEXC,
GX::TevColorArg::CC_TEXA, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO,
GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5f54(
{GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ONE, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5f54({GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ONE,
GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA,
GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5fa0(
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5fa0({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO,
GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO,
GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA});
const CTevCombiners::CTevPass CGraphics::sTevPass804bfcc0(
{GX::TevColorArg::CC_C0, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA});
const CTevCombiners::CTevPass CGraphics::sTevPass804bfcc0({GX::TevColorArg::CC_C0, GX::TevColorArg::CC_TEXC,
GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO,
GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5fec(
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO});
const CTevCombiners::CTevPass CGraphics::sTevPass805a5fec({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO,
GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA,
GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO});
const CTevCombiners::CTevPass CGraphics::sTevPass805a6038(
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_KONST, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO});
const CTevCombiners::CTevPass CGraphics::sTevPass805a6038({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC,
GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_KONST,
GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO});
const CTevCombiners::CTevPass CGraphics::sTevPass805a6084(
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_CPREV, GX::TevColorArg::CC_APREV, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_APREV});
const CTevCombiners::CTevPass CGraphics::sTevPass805a6084({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_CPREV,
GX::TevColorArg::CC_APREV, GX::TevColorArg::CC_ZERO},
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO,
GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_APREV});
} // namespace metaforce

View File

@@ -221,14 +221,15 @@ class CTevPass {
CTevOp x38_alphaOp;
public:
CTevPass(const ColorPass& colPass, const AlphaPass& alphaPass, const CTevOp& colorOp = CTevOp(), const CTevOp alphaOp = CTevOp())
: x0_id(++sNextUniquePass)
, x4_colorPass(colPass)
, x14_alphaPass(alphaPass)
, x24_colorOp(colorOp)
, x38_alphaOp(alphaOp) {}
};
CTevPass(const ColorPass& colPass, const AlphaPass& alphaPass, const CTevOp& colorOp = CTevOp(),
const CTevOp alphaOp = CTevOp())
: x0_id(++sNextUniquePass)
, x4_colorPass(colPass)
, x14_alphaPass(alphaPass)
, x24_colorOp(colorOp)
, x38_alphaOp(alphaOp) {}
};
}; // namespace CTevCombiners
class CGraphics {
public:
@@ -364,7 +365,7 @@ public:
g_BooMainCommandQueue->drawInstances(start, count, instCount, startInst);
}
static void DrawArray(size_t start, size_t count) { g_BooMainCommandQueue->draw(start, count); }
static void DrawArrayIndexed(size_t start, size_t count) { g_BooMainCommandQueue->drawIndexed(start, count); }\
static void DrawArrayIndexed(size_t start, size_t count) { g_BooMainCommandQueue->drawIndexed(start, count); }
static const CTevCombiners::CTevPass sTevPass805a564c;
static const CTevCombiners::CTevPass sTevPass805a5698;
@@ -428,14 +429,13 @@ class GraphicsDebugGroup {
void operator delete(void*);
void* operator new[](size_t);
void operator delete[](void*);
public:
explicit GraphicsDebugGroup(const char* name, const zeus::CColor& color = zeus::skWhite) {
zeus::simd_floats f(color.mSimd);
CGraphics::g_BooMainCommandQueue->pushDebugGroup(name, f.array());
}
~GraphicsDebugGroup() {
CGraphics::g_BooMainCommandQueue->popDebugGroup();
}
~GraphicsDebugGroup() { CGraphics::g_BooMainCommandQueue->popDebugGroup(); }
};
#define SCOPED_GRAPHICS_DEBUG_GROUP(...) GraphicsDebugGroup _GfxDbg_(__VA_ARGS__);
#else

View File

@@ -1,49 +1,49 @@
set(GRAPHICS_SOURCES
IRenderer.hpp
IWeaponRenderer.hpp IWeaponRenderer.cpp
CBooRenderer.hpp CBooRenderer.cpp
CDrawable.hpp
CDrawablePlaneObject.hpp
CLineRenderer.hpp CLineRenderer.cpp
CMetroidModelInstance.hpp
CLight.hpp CLight.cpp
CTexture.hpp CTextureBoo.cpp
CModel.hpp CModelBoo.cpp
CSkinnedModel.hpp CSkinnedModel.cpp
CVertexMorphEffect.hpp CVertexMorphEffect.cpp
CMoviePlayer.hpp CMoviePlayer.cpp
CGraphicsPalette.hpp
CPVSVisSet.hpp CPVSVisSet.cpp
CPVSVisOctree.hpp CPVSVisOctree.cpp
CPVSAreaSet.hpp CPVSAreaSet.cpp
CGraphics.hpp CGraphics.cpp
CSimpleShadow.hpp CSimpleShadow.cpp
CRainSplashGenerator.hpp CRainSplashGenerator.cpp
Shaders/CLineRendererShaders.hpp Shaders/CLineRendererShaders.cpp
Shaders/CTexturedQuadFilter.hpp Shaders/CTexturedQuadFilter.cpp
Shaders/CColoredQuadFilter.hpp Shaders/CColoredQuadFilter.cpp
Shaders/CColoredStripShader.hpp Shaders/CColoredStripShader.cpp
Shaders/CModelShaders.hpp Shaders/CModelShaders.cpp
Shaders/CThermalColdFilter.hpp Shaders/CThermalColdFilter.cpp
Shaders/CThermalHotFilter.hpp Shaders/CThermalHotFilter.cpp
Shaders/CSpaceWarpFilter.hpp Shaders/CSpaceWarpFilter.cpp
Shaders/CCameraBlurFilter.hpp Shaders/CCameraBlurFilter.cpp
Shaders/CXRayBlurFilter.hpp Shaders/CXRayBlurFilter.cpp
Shaders/CTextSupportShader.hpp Shaders/CTextSupportShader.cpp
Shaders/CFogVolumePlaneShader.hpp Shaders/CFogVolumePlaneShader.cpp
Shaders/CFogVolumeFilter.hpp Shaders/CFogVolumeFilter.cpp
Shaders/CEnergyBarShader.hpp Shaders/CEnergyBarShader.cpp
Shaders/CRadarPaintShader.hpp Shaders/CRadarPaintShader.cpp
Shaders/CMapSurfaceShader.hpp Shaders/CMapSurfaceShader.cpp
Shaders/CPhazonSuitFilter.hpp Shaders/CPhazonSuitFilter.cpp
Shaders/CScanLinesFilter.hpp Shaders/CScanLinesFilter.cpp
Shaders/CRandomStaticFilter.hpp Shaders/CRandomStaticFilter.cpp
Shaders/CElementGenShaders.hpp Shaders/CElementGenShaders.cpp
Shaders/CDecalShaders.hpp Shaders/CDecalShaders.cpp
Shaders/CParticleSwooshShaders.hpp Shaders/CParticleSwooshShaders.cpp
Shaders/CFluidPlaneShader.hpp Shaders/CFluidPlaneShader.cpp
Shaders/CAABoxShader.hpp Shaders/CAABoxShader.cpp
Shaders/CWorldShadowShader.hpp Shaders/CWorldShadowShader.cpp
Shaders/CEnvFxShaders.hpp Shaders/CEnvFxShaders.cpp)
IRenderer.hpp
IWeaponRenderer.hpp IWeaponRenderer.cpp
CBooRenderer.hpp CBooRenderer.cpp
CDrawable.hpp
CDrawablePlaneObject.hpp
CLineRenderer.hpp CLineRenderer.cpp
CMetroidModelInstance.hpp
CLight.hpp CLight.cpp
CTexture.hpp CTextureBoo.cpp
CModel.hpp CModelBoo.cpp
CSkinnedModel.hpp CSkinnedModel.cpp
CVertexMorphEffect.hpp CVertexMorphEffect.cpp
CMoviePlayer.hpp CMoviePlayer.cpp
CGraphicsPalette.hpp
CPVSVisSet.hpp CPVSVisSet.cpp
CPVSVisOctree.hpp CPVSVisOctree.cpp
CPVSAreaSet.hpp CPVSAreaSet.cpp
CGraphics.hpp CGraphics.cpp
CSimpleShadow.hpp CSimpleShadow.cpp
CRainSplashGenerator.hpp CRainSplashGenerator.cpp
Shaders/CLineRendererShaders.hpp Shaders/CLineRendererShaders.cpp
Shaders/CTexturedQuadFilter.hpp Shaders/CTexturedQuadFilter.cpp
Shaders/CColoredQuadFilter.hpp Shaders/CColoredQuadFilter.cpp
Shaders/CColoredStripShader.hpp Shaders/CColoredStripShader.cpp
Shaders/CModelShaders.hpp Shaders/CModelShaders.cpp
Shaders/CThermalColdFilter.hpp Shaders/CThermalColdFilter.cpp
Shaders/CThermalHotFilter.hpp Shaders/CThermalHotFilter.cpp
Shaders/CSpaceWarpFilter.hpp Shaders/CSpaceWarpFilter.cpp
Shaders/CCameraBlurFilter.hpp Shaders/CCameraBlurFilter.cpp
Shaders/CXRayBlurFilter.hpp Shaders/CXRayBlurFilter.cpp
Shaders/CTextSupportShader.hpp Shaders/CTextSupportShader.cpp
Shaders/CFogVolumePlaneShader.hpp Shaders/CFogVolumePlaneShader.cpp
Shaders/CFogVolumeFilter.hpp Shaders/CFogVolumeFilter.cpp
Shaders/CEnergyBarShader.hpp Shaders/CEnergyBarShader.cpp
Shaders/CRadarPaintShader.hpp Shaders/CRadarPaintShader.cpp
Shaders/CMapSurfaceShader.hpp Shaders/CMapSurfaceShader.cpp
Shaders/CPhazonSuitFilter.hpp Shaders/CPhazonSuitFilter.cpp
Shaders/CScanLinesFilter.hpp Shaders/CScanLinesFilter.cpp
Shaders/CRandomStaticFilter.hpp Shaders/CRandomStaticFilter.cpp
Shaders/CElementGenShaders.hpp Shaders/CElementGenShaders.cpp
Shaders/CDecalShaders.hpp Shaders/CDecalShaders.cpp
Shaders/CParticleSwooshShaders.hpp Shaders/CParticleSwooshShaders.cpp
Shaders/CFluidPlaneShader.hpp Shaders/CFluidPlaneShader.cpp
Shaders/CAABoxShader.hpp Shaders/CAABoxShader.cpp
Shaders/CWorldShadowShader.hpp Shaders/CWorldShadowShader.cpp
Shaders/CEnvFxShaders.hpp Shaders/CEnvFxShaders.cpp)
runtime_add_list(Graphics GRAPHICS_SOURCES)

View File

@@ -201,8 +201,7 @@ public:
const zeus::CAABox& aabb, u8 renderMask, int numInsts);
static void MakeTexturesFromMats(const MaterialSet& matSet,
std::unordered_map<CAssetId, TCachedToken<CTexture>>& toksOut,
IObjectStore& store);
std::unordered_map<CAssetId, TCachedToken<CTexture>>& toksOut, IObjectStore& store);
void MakeTexturesFromMats(std::unordered_map<CAssetId, TCachedToken<CTexture>>& toksOut, IObjectStore& store);
bool IsOpaque() const { return x3c_firstSortedSurface == nullptr; }

View File

@@ -244,7 +244,8 @@ GeometryUniformLayout::GeometryUniformLayout(const CModel* model, const Material
}
}
CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf, boo::IGraphicsDataFactory::Context* ctx) {
CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf,
boo::IGraphicsDataFactory::Context* ctx) {
OPTICK_EVENT();
if (!x40_24_texturesLoaded && !g_DummyTextures) {
return nullptr;
@@ -370,10 +371,8 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf, b
EExtendedShader idx{};
for (const auto& pipeline : *pipelines) {
if (idx == EExtendedShader::ThermalModel ||
idx == EExtendedShader::ThermalModelNoZTestNoZWrite ||
idx == EExtendedShader::ThermalStatic ||
idx == EExtendedShader::ThermalStaticNoZWrite) {
if (idx == EExtendedShader::ThermalModel || idx == EExtendedShader::ThermalModelNoZTestNoZWrite ||
idx == EExtendedShader::ThermalStatic || idx == EExtendedShader::ThermalStaticNoZWrite) {
texs[8] = g_Renderer->x220_sphereRamp.get();
} else if (idx == EExtendedShader::MorphBallShadow) {
texs[8] = g_Renderer->m_ballShadowId.get();
@@ -390,7 +389,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf, b
else
texs[8] = g_Renderer->x220_sphereRamp.get();
} else if (hecl::com_cubemaps->toBoolean() && (idx == EExtendedShader::LightingCubeReflection ||
idx == EExtendedShader::LightingCubeReflectionWorldShadow)) {
idx == EExtendedShader::LightingCubeReflectionWorldShadow)) {
if (m_lastDrawnReflectionCube)
texs[11] = m_lastDrawnReflectionCube.get();
else
@@ -404,7 +403,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf, b
}
return true;
};
if (ctx) {
withContext(*ctx);
} else {
@@ -588,9 +587,8 @@ static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data,
if (intermediateExtended == EExtendedShader::Lighting) {
/* Transform lighting into thermal if the thermal visor is active */
if (g_Renderer->IsThermalVisorHotPass())
return flags.m_noZTest
? EExtendedShader::LightingAlphaWriteNoZTestNoZWrite
: (noZWrite ? EExtendedShader::ThermalStaticNoZWrite : EExtendedShader::ThermalStatic);
return flags.m_noZTest ? EExtendedShader::LightingAlphaWriteNoZTestNoZWrite
: (noZWrite ? EExtendedShader::ThermalStaticNoZWrite : EExtendedShader::ThermalStatic);
else if (g_Renderer->IsThermalVisorActive())
return EExtendedShader::ThermalCold;
if (data.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Opaque) {
@@ -600,17 +598,17 @@ static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data,
extended = EExtendedShader::ForcedAdditiveNoZWriteDepthGreater;
else
extended =
flags.m_noCull
? (noZWrite ? EExtendedShader::ForcedAdditiveNoCullNoZWrite : EExtendedShader::ForcedAdditiveNoCull)
: (noZWrite ? EExtendedShader::ForcedAdditiveNoZWrite : EExtendedShader::ForcedAdditive);
flags.m_noCull
? (noZWrite ? EExtendedShader::ForcedAdditiveNoCullNoZWrite : EExtendedShader::ForcedAdditiveNoCull)
: (noZWrite ? EExtendedShader::ForcedAdditiveNoZWrite : EExtendedShader::ForcedAdditive);
} else if (flags.x0_blendMode > 4) {
extended = flags.m_noCull
? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull)
: (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::ForcedAlpha);
? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull)
: (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::ForcedAlpha);
} else {
extended = flags.m_noCull
? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull)
: (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::Lighting);
? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull)
: (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::Lighting);
}
} else if (flags.m_noCull && noZWrite) {
/* Substitute no-cull,no-zwrite pipeline if available */
@@ -1002,7 +1000,8 @@ boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFl
}
/* Invalidate instances if new reflection cube being drawn */
if (hecl::com_cubemaps->toBoolean() && (flags.m_extendedShader == EExtendedShader::LightingCubeReflection ||
if (hecl::com_cubemaps->toBoolean() &&
(flags.m_extendedShader == EExtendedShader::LightingCubeReflection ||
flags.m_extendedShader == EExtendedShader::LightingCubeReflectionWorldShadow) &&
m_lastDrawnReflectionCube != g_reflectionCube) {
m_lastDrawnReflectionCube = g_reflectionCube;

View File

@@ -147,10 +147,7 @@ u32 CMoviePlayer::THPAudioDecode(s16* buffer, const u8* audioFrame, bool stereo)
}
CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bool deinterlace)
: CDvdFile(path)
, xec_preLoadSeconds(preLoadSeconds)
, xf4_24_loop(loop)
, m_deinterlace(deinterlace) {
: CDvdFile(path), xec_preLoadSeconds(preLoadSeconds), xf4_24_loop(loop), m_deinterlace(deinterlace) {
/* Read THP header information */
u8 buf[64];
SyncRead(buf, 64);

View File

@@ -158,8 +158,7 @@ u32 CRainSplashGenerator::GetNextBestPt(u32 pt, const std::vector<std::pair<zeus
const auto idx = u32(rand.Range(0, int(vn.size() - 1)));
const auto& vert = vn[idx];
const float distSq = (refVert.first - vert.first).magSquared();
if (distSq > maxDist && vert.second.dot(zeus::skUp) >= 0.f &&
(vert.first.z() <= 0.f || vert.first.z() > minZ)) {
if (distSq > maxDist && vert.second.dot(zeus::skUp) >= 0.f && (vert.first.z() <= 0.f || vert.first.z() > minZ)) {
nextPt = idx;
maxDist = distSq;
}

View File

@@ -59,8 +59,8 @@ void CSimpleShadow::Calculate(const zeus::CAABox& aabb, const zeus::CTransform&
if (height > 0.1f + halfHeight) {
TUniqueId cid = kInvalidUniqueId;
EntityList nearList;
CRayCastResult resD = CGameCollision::RayDynamicIntersection(
mgr, cid, pos, zeus::skDown, x40_maxObjHeight, CMaterialFilter::skPassEverything, nearList);
CRayCastResult resD = CGameCollision::RayDynamicIntersection(mgr, cid, pos, zeus::skDown, x40_maxObjHeight,
CMaterialFilter::skPassEverything, nearList);
if (resD.IsValid() && resD.GetT() < height) {
x48_24_collision = true;
height = resD.GetT();

View File

@@ -29,8 +29,7 @@ CSkinnedModel::CSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinR
store.GetObj(SObjectTag{FOURCC('CINF'), layoutInfo}), shaderIdx, drawInsts) {}
void CSkinnedModel::Calculate(const CPoseAsTransforms& pose, const CModelFlags& drawFlags,
const std::optional<CVertexMorphEffect>& morphEffect,
const float* morphMagnitudes) {
const std::optional<CVertexMorphEffect>& morphEffect, const float* morphMagnitudes) {
if (morphEffect || g_PointGenFunc) {
if (boo::ObjToken<boo::IGraphicsBufferD> vertBuf = m_modelInst->UpdateUniformData(drawFlags, nullptr, nullptr)) {
x10_skinRules->TransformVerticesCPU(m_vertWorkspace, pose, *x4_model);

View File

@@ -894,7 +894,7 @@ CFactoryFnReturn FTextureFactory(const metaforce::SObjectTag& tag, std::unique_p
u32 u32Owned = vparms.GetOwnedObj<u32>();
const CTextureInfo* inf = nullptr;
if (g_TextureCache)
inf = g_TextureCache->GetTextureInfo(tag.id);
inf = g_TextureCache->GetTextureInfo(tag.id);
return TToken<CTexture>::GetIObjObjectFor(
std::make_unique<CTexture>(std::move(in), len, u32Owned == SBIG('OTEX'), inf));
}

View File

@@ -86,4 +86,4 @@ void CColoredStripShader::draw(const zeus::CColor& color, size_t numVerts, const
CGraphics::DrawArray(0, numVerts);
}
}
} // namespace metaforce

View File

@@ -9,12 +9,8 @@ namespace metaforce {
class CColoredStripShader {
public:
enum class Mode {
Alpha,
Additive,
FullAdditive,
Subtractive
};
enum class Mode { Alpha, Additive, FullAdditive, Subtractive };
private:
struct Uniform {
zeus::CMatrix4f m_matrix;
@@ -27,6 +23,7 @@ private:
void BuildResources(boo::IGraphicsDataFactory::Context& ctx, size_t maxVerts, Mode mode,
boo::ObjToken<boo::ITexture> tex);
public:
struct Vert {
zeus::CVector3f m_pos;
@@ -41,4 +38,4 @@ public:
void draw(const zeus::CColor& color, size_t numVerts, const Vert* verts);
};
}
} // namespace metaforce

View File

@@ -63,33 +63,57 @@ void CElementGenShaders::Initialize() {
}
void CElementGenShaders::Shutdown() {
for (auto& s : m_texZTestZWrite) s.reset();
for (auto& s : m_texNoZTestZWrite) s.reset();
for (auto& s : m_texZTestNoZWrite) s.reset();
for (auto& s : m_texNoZTestNoZWrite) s.reset();
for (auto& s : m_texAdditiveZTest) s.reset();
for (auto& s : m_texAdditiveNoZTest) s.reset();
for (auto& s : m_texRedToAlphaZTest) s.reset();
for (auto& s : m_texRedToAlphaNoZTest) s.reset();
for (auto& s : m_texZTestNoZWriteSub) s.reset();
for (auto& s : m_texNoZTestNoZWriteSub) s.reset();
for (auto& s : m_texRedToAlphaZTestSub) s.reset();
for (auto& s : m_texRedToAlphaNoZTestSub) s.reset();
for (auto& s : m_texZTestZWrite)
s.reset();
for (auto& s : m_texNoZTestZWrite)
s.reset();
for (auto& s : m_texZTestNoZWrite)
s.reset();
for (auto& s : m_texNoZTestNoZWrite)
s.reset();
for (auto& s : m_texAdditiveZTest)
s.reset();
for (auto& s : m_texAdditiveNoZTest)
s.reset();
for (auto& s : m_texRedToAlphaZTest)
s.reset();
for (auto& s : m_texRedToAlphaNoZTest)
s.reset();
for (auto& s : m_texZTestNoZWriteSub)
s.reset();
for (auto& s : m_texNoZTestNoZWriteSub)
s.reset();
for (auto& s : m_texRedToAlphaZTestSub)
s.reset();
for (auto& s : m_texRedToAlphaNoZTestSub)
s.reset();
for (auto& s : m_indTexZWrite) s.reset();
for (auto& s : m_indTexNoZWrite) s.reset();
for (auto& s : m_indTexAdditive) s.reset();
for (auto& s : m_indTexZWrite)
s.reset();
for (auto& s : m_indTexNoZWrite)
s.reset();
for (auto& s : m_indTexAdditive)
s.reset();
for (auto& s : m_cindTexZWrite) s.reset();
for (auto& s : m_cindTexNoZWrite) s.reset();
for (auto& s : m_cindTexAdditive) s.reset();
for (auto& s : m_cindTexZWrite)
s.reset();
for (auto& s : m_cindTexNoZWrite)
s.reset();
for (auto& s : m_cindTexAdditive)
s.reset();
for (auto& s : m_noTexZTestZWrite) s.reset();
for (auto& s : m_noTexNoZTestZWrite) s.reset();
for (auto& s : m_noTexZTestNoZWrite) s.reset();
for (auto& s : m_noTexNoZTestNoZWrite) s.reset();
for (auto& s : m_noTexAdditiveZTest) s.reset();
for (auto& s : m_noTexAdditiveNoZTest) s.reset();
for (auto& s : m_noTexZTestZWrite)
s.reset();
for (auto& s : m_noTexNoZTestZWrite)
s.reset();
for (auto& s : m_noTexZTestNoZWrite)
s.reset();
for (auto& s : m_noTexNoZTestNoZWrite)
s.reset();
for (auto& s : m_noTexAdditiveZTest)
s.reset();
for (auto& s : m_noTexAdditiveNoZTest)
s.reset();
}
CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen& gen) {

View File

@@ -168,8 +168,7 @@ public:
void doneDrawing() { m_lastBind = -1; }
void loadVerts(const std::vector<Vertex>& verts, const std::vector<PatchVertex>& pVerts);
bool isReady() const {
return m_pipelines.m_regular->isReady() &&
(!m_pipelines.m_tessellation || m_pipelines.m_tessellation->isReady());
return m_pipelines.m_regular->isReady() && (!m_pipelines.m_tessellation || m_pipelines.m_tessellation->isReady());
}
static void Shutdown();

View File

@@ -33,15 +33,24 @@ void CLineRendererShaders::Initialize() {
}
void CLineRendererShaders::Shutdown() {
for (auto& s : m_texAlpha) s.reset();
for (auto& s : m_texAdditive) s.reset();
for (auto& s : m_noTexAlpha) s.reset();
for (auto& s : m_noTexAdditive) s.reset();
for (auto& s : m_texAlphaZ) s.reset();
for (auto& s : m_texAdditiveZ) s.reset();
for (auto& s : m_noTexAlphaZ) s.reset();
for (auto& s : m_noTexAdditiveZ) s.reset();
for (auto& s : m_noTexAlphaZGEqual) s.reset();
for (auto& s : m_texAlpha)
s.reset();
for (auto& s : m_texAdditive)
s.reset();
for (auto& s : m_noTexAlpha)
s.reset();
for (auto& s : m_noTexAdditive)
s.reset();
for (auto& s : m_texAlphaZ)
s.reset();
for (auto& s : m_texAdditiveZ)
s.reset();
for (auto& s : m_noTexAlphaZ)
s.reset();
for (auto& s : m_noTexAdditiveZ)
s.reset();
for (auto& s : m_noTexAlphaZGEqual)
s.reset();
}
void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,

View File

@@ -93,11 +93,11 @@ static std::array<hecl::Backend::ExtensionSlot, size_t(EExtendedShader::MAX)> g_
{1, ThermalTextures.data(), hecl::Backend::BlendFactor::One, hecl::Backend::BlendFactor::One,
hecl::Backend::ZTest::None, hecl::Backend::CullMode::Backface, true, false, false, true},
/* Thermal static shading */
{0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One,
hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, false, false, false, true, false, false, true},
{0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
hecl::Backend::CullMode::Backface, false, false, false, true, false, false, true},
/* Thermal static shading without Z-write */
{0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One,
hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, true, false, false, true, false, false, false},
{0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
hecl::Backend::CullMode::Backface, true, false, false, true, false, false, false},
/* Forced alpha shading */
{0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::InvSrcAlpha,
hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, false, false, true},
@@ -162,8 +162,8 @@ static std::array<hecl::Backend::ExtensionSlot, size_t(EExtendedShader::MAX)> g_
{0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original,
hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface},
/* Normal lit shading with alpha without Z-write or depth test */
{0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original,
hecl::Backend::ZTest::None, hecl::Backend::CullMode::Backface, true},
{0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::None,
hecl::Backend::CullMode::Backface, true},
/* Normal lit shading with cube reflection */
{0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original,
hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, false, false, true},

View File

@@ -39,14 +39,22 @@ void CParticleSwooshShaders::Initialize() {
}
void CParticleSwooshShaders::Shutdown() {
for (auto& s : m_texZWrite) s.reset();
for (auto& s : m_texNoZWrite) s.reset();
for (auto& s : m_texAdditiveZWrite) s.reset();
for (auto& s : m_texAdditiveNoZWrite) s.reset();
for (auto& s : m_noTexZWrite) s.reset();
for (auto& s : m_noTexNoZWrite) s.reset();
for (auto& s : m_noTexAdditiveZWrite) s.reset();
for (auto& s : m_noTexAdditiveNoZWrite) s.reset();
for (auto& s : m_texZWrite)
s.reset();
for (auto& s : m_texNoZWrite)
s.reset();
for (auto& s : m_texAdditiveZWrite)
s.reset();
for (auto& s : m_texAdditiveNoZWrite)
s.reset();
for (auto& s : m_noTexZWrite)
s.reset();
for (auto& s : m_noTexNoZWrite)
s.reset();
for (auto& s : m_noTexAdditiveZWrite)
s.reset();
for (auto& s : m_noTexAdditiveNoZWrite)
s.reset();
}
CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CParticleSwoosh& gen) {