mirror of https://github.com/AxioDL/metaforce.git
More CCubeRenderer imps
This commit is contained in:
parent
805065b6f2
commit
004d78100f
|
@ -220,7 +220,8 @@ void CCubeRenderer::DrawSortedGeometry(int areaIdx, int mask, int targetMask) {}
|
||||||
void CCubeRenderer::DrawStaticGeometry(int areaIdx, int mask, int targetMask) {}
|
void CCubeRenderer::DrawStaticGeometry(int areaIdx, int mask, int targetMask) {}
|
||||||
void CCubeRenderer::DrawAreaGeometry(int areaIdx, int mask, int targetMask) {}
|
void CCubeRenderer::DrawAreaGeometry(int areaIdx, int mask, int targetMask) {}
|
||||||
void CCubeRenderer::PostRenderFogs() {}
|
void CCubeRenderer::PostRenderFogs() {}
|
||||||
void CCubeRenderer::SetModelMatrix(const zeus::CTransform& xf) {}
|
void CCubeRenderer::SetModelMatrix(const zeus::CTransform& xf) { CGraphics::SetModelMatrix(xf); }
|
||||||
|
|
||||||
void CCubeRenderer::AddParticleGen(CParticleGen& gen) {
|
void CCubeRenderer::AddParticleGen(CParticleGen& gen) {
|
||||||
auto bounds = gen.GetBounds();
|
auto bounds = gen.GetBounds();
|
||||||
|
|
||||||
|
@ -265,18 +266,84 @@ void CCubeRenderer::AddDrawable(void* obj, const zeus::CVector3f& pos, const zeu
|
||||||
Buckets::Insert(pos, aabb, EDrawableType(mode + 2), obj, xb0_viewPlane, 0);
|
Buckets::Insert(pos, aabb, EDrawableType(mode + 2), obj, xb0_viewPlane, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void CCubeRenderer::SetDrawableCallback(IRenderer::TDrawableCallback cb, void* ctx) {}
|
void CCubeRenderer::SetDrawableCallback(IRenderer::TDrawableCallback cb, void* ctx) {
|
||||||
void CCubeRenderer::SetWorldViewpoint(const zeus::CTransform& xf) {}
|
xa8_drawableCallback = cb;
|
||||||
void CCubeRenderer::SetPerspective(float fovy, float aspect, float znear, float zfar) {}
|
xac_drawableCallbackUserData = ctx;
|
||||||
void CCubeRenderer::SetPerspective(float fovy, float width, float height, float znear, float zfar) {}
|
}
|
||||||
|
|
||||||
|
void CCubeRenderer::SetWorldViewpoint(const zeus::CTransform& xf) {
|
||||||
|
CGraphics::SetViewPointMatrix(xf);
|
||||||
|
auto front = xf.frontVector();
|
||||||
|
xb0_viewPlane = zeus::CPlane(front, front.dot(xf.origin));
|
||||||
|
}
|
||||||
|
void CCubeRenderer::SetPerspective(float fovy, float aspect, float znear, float zfar) {
|
||||||
|
CGraphics::SetPerspective(fovy, aspect, znear, zfar);
|
||||||
|
}
|
||||||
|
void CCubeRenderer::SetPerspective(float fovy, float width, float height, float znear, float zfar) {
|
||||||
|
CGraphics::SetPerspective(fovy, width / height, znear, zfar);
|
||||||
|
}
|
||||||
|
|
||||||
std::pair<zeus::CVector2f, zeus::CVector2f> CCubeRenderer::SetViewportOrtho(bool centered, float znear, float zfar) {
|
std::pair<zeus::CVector2f, zeus::CVector2f> CCubeRenderer::SetViewportOrtho(bool centered, float znear, float zfar) {
|
||||||
return std::pair<zeus::CVector2f, zeus::CVector2f>();
|
return std::pair<zeus::CVector2f, zeus::CVector2f>();
|
||||||
}
|
}
|
||||||
void CCubeRenderer::SetClippingPlanes(const zeus::CFrustum& frustum) {}
|
void CCubeRenderer::SetClippingPlanes(const zeus::CFrustum& frustum) { x44_frustumPlanes = frustum; }
|
||||||
void CCubeRenderer::SetViewport(int left, int bottom, int width, int height) {}
|
void CCubeRenderer::SetViewport(int left, int bottom, int width, int height) {
|
||||||
void CCubeRenderer::BeginScene() {}
|
CGraphics::SetViewport(left, bottom, width, height);
|
||||||
void CCubeRenderer::EndScene() {}
|
CGraphics::SetScissor(left, bottom, width, height);
|
||||||
void CCubeRenderer::SetDebugOption(IRenderer::EDebugOption, int) {}
|
}
|
||||||
|
void CCubeRenderer::BeginScene() {
|
||||||
|
CGraphics::SetUseVideoFilter(true);
|
||||||
|
CGraphics::SetViewport(0, 0, CGraphics::g_Viewport.x8_width, CGraphics::g_Viewport.xc_height);
|
||||||
|
|
||||||
|
CGraphics::SetClearColor(zeus::skClear);
|
||||||
|
CGraphics::SetCullMode(ERglCullMode::Front);
|
||||||
|
CGraphics::SetDepthWriteMode(true, ERglEnum::LEqual, true);
|
||||||
|
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::InvSrcAlpha,
|
||||||
|
ERglLogicOp::Clear);
|
||||||
|
CGraphics::SetPerspective(75.f, CGraphics::g_Viewport.x8_width / CGraphics::g_Viewport.xc_height, 1.f, 4096.f);
|
||||||
|
CGraphics::SetModelMatrix(zeus::CTransform());
|
||||||
|
if (x310_phazonSuitMaskCountdown != 0) {
|
||||||
|
--x310_phazonSuitMaskCountdown;
|
||||||
|
if (x310_phazonSuitMaskCountdown == 0) {
|
||||||
|
x314_phazonSuitMask.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!x318_31_persistRGBA6) {
|
||||||
|
x318_26_requestRGBA6 = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GXSetPixelFmt(x318_26_requestRGBA6, GX_ZC_LINEAR);
|
||||||
|
// GXSetAlphaUpdate(true);
|
||||||
|
// GXSetDstAlpha(true, 0);
|
||||||
|
CGraphics::BeginScene();
|
||||||
|
}
|
||||||
|
void CCubeRenderer::EndScene() {
|
||||||
|
x318_31_persistRGBA6 = !CGraphics::g_IsBeginSceneClearFb;
|
||||||
|
CGraphics::EndScene();
|
||||||
|
|
||||||
|
if (x2dc_reflectionAge < 2) {
|
||||||
|
++x2dc_reflectionAge;
|
||||||
|
} else {
|
||||||
|
x14c_reflectionTex.reset();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCubeRenderer::SetDebugOption(IRenderer::EDebugOption option, int value) {
|
||||||
|
if (option == EDebugOption::PVSState) {
|
||||||
|
xc8_pvs->SetState(EPVSVisSetState(value));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (option == EDebugOption::PVSMode) {
|
||||||
|
xc0_pvsMode = EPVSMode(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (option == EDebugOption::FogDisabled) {
|
||||||
|
x318_28_disableFog = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CCubeRenderer::BeginPrimitive(IRenderer::EPrimitiveType, int) {}
|
void CCubeRenderer::BeginPrimitive(IRenderer::EPrimitiveType, int) {}
|
||||||
void CCubeRenderer::BeginLines(int) {}
|
void CCubeRenderer::BeginLines(int) {}
|
||||||
void CCubeRenderer::BeginLineStrip(int) {}
|
void CCubeRenderer::BeginLineStrip(int) {}
|
||||||
|
@ -308,9 +375,12 @@ void CCubeRenderer::SetThermalColdScale(float scale) {}
|
||||||
void CCubeRenderer::DoThermalBlendCold() {}
|
void CCubeRenderer::DoThermalBlendCold() {}
|
||||||
void CCubeRenderer::DoThermalBlendHot() {}
|
void CCubeRenderer::DoThermalBlendHot() {}
|
||||||
u32 CCubeRenderer::GetStaticWorldDataSize() { return 0; }
|
u32 CCubeRenderer::GetStaticWorldDataSize() { return 0; }
|
||||||
void CCubeRenderer::SetGXRegister1Color(const zeus::CColor& color) {}
|
void CCubeRenderer::SetGXRegister1Color(const zeus::CColor& color) {
|
||||||
void CCubeRenderer::SetWorldLightFadeLevel(float level) {}
|
CGraphics::g_ColorRegs[1] = color;
|
||||||
void CCubeRenderer::SetWorldLightMultiplyColor(const zeus::CColor& color) {}
|
// GXSetTevColor(GX_TEVREG1, color);
|
||||||
|
}
|
||||||
|
void CCubeRenderer::SetWorldLightFadeLevel(float level) { x2fc_tevReg1Color = zeus::CColor(level, level, level, 1.f); }
|
||||||
|
void CCubeRenderer::SetWorldLightMultiplyColor(const zeus::CColor& color) { CGraphics::g_ColorRegs[2] = color; }
|
||||||
void CCubeRenderer::PrepareDynamicLights(const std::vector<CLight>& lights) {}
|
void CCubeRenderer::PrepareDynamicLights(const std::vector<CLight>& lights) {}
|
||||||
void CCubeRenderer::AllocatePhazonSuitMaskTexture() {}
|
void CCubeRenderer::AllocatePhazonSuitMaskTexture() {}
|
||||||
void CCubeRenderer::DrawPhazonSuitIndirectEffect(const zeus::CColor& nonIndirectMod,
|
void CCubeRenderer::DrawPhazonSuitIndirectEffect(const zeus::CColor& nonIndirectMod,
|
||||||
|
|
|
@ -65,7 +65,7 @@ private:
|
||||||
bool xdc_{};
|
bool xdc_{};
|
||||||
u32 xe0_pvsAreaIdx = UINT32_MAX;
|
u32 xe0_pvsAreaIdx = UINT32_MAX;
|
||||||
CTexture xe4_blackTex{ETexelFormat::RGB565, 4, 4, 1};
|
CTexture xe4_blackTex{ETexelFormat::RGB565, 4, 4, 1};
|
||||||
u32 x14c_ = 0;
|
std::unique_ptr<CTexture> x14c_reflectionTex;
|
||||||
CTexture x150_reflectionTex{ETexelFormat::IA8, 32, 32, 1};
|
CTexture x150_reflectionTex{ETexelFormat::IA8, 32, 32, 1};
|
||||||
CTexture x1b8_fogVolumeRamp{ETexelFormat::I8, 256, 256, 1};
|
CTexture x1b8_fogVolumeRamp{ETexelFormat::I8, 256, 256, 1};
|
||||||
CTexture x220_sphereRamp{ETexelFormat::I8, 32, 32, 1};
|
CTexture x220_sphereRamp{ETexelFormat::I8, 32, 32, 1};
|
||||||
|
@ -82,7 +82,7 @@ private:
|
||||||
zeus::CColor x2fc_tevReg1Color{1.f, 0.f, 1.f, 1.f};
|
zeus::CColor x2fc_tevReg1Color{1.f, 0.f, 1.f, 1.f};
|
||||||
std::vector<CLight> x300_dynamicLights;
|
std::vector<CLight> x300_dynamicLights;
|
||||||
u32 x310_phazonSuitMaskCountdown = 0;
|
u32 x310_phazonSuitMaskCountdown = 0;
|
||||||
CTexture* x314_phazonSuitMask = nullptr;
|
std::unique_ptr<CTexture> x314_phazonSuitMask;
|
||||||
bool x318_24_refectionDirty : 1 = false;
|
bool x318_24_refectionDirty : 1 = false;
|
||||||
bool x318_25_drawWireframe : 1 = false;
|
bool x318_25_drawWireframe : 1 = false;
|
||||||
bool x318_26_requestRGBA6 : 1 = false;
|
bool x318_26_requestRGBA6 : 1 = false;
|
||||||
|
@ -129,7 +129,7 @@ public:
|
||||||
void SetPerspective(float fovy, float width, float height, float znear, float zfar) override;
|
void SetPerspective(float fovy, float width, float height, float znear, float zfar) override;
|
||||||
std::pair<zeus::CVector2f, zeus::CVector2f> SetViewportOrtho(bool centered, float znear, float zfar) override;
|
std::pair<zeus::CVector2f, zeus::CVector2f> SetViewportOrtho(bool centered, float znear, float zfar) override;
|
||||||
void SetClippingPlanes(const zeus::CFrustum& frustum) override;
|
void SetClippingPlanes(const zeus::CFrustum& frustum) override;
|
||||||
void SetViewport(int left, int bottom, int width, int height) override;
|
void SetViewport(int left, int right, int width, int height) override;
|
||||||
void SetDepthReadWrite(bool read, bool write) override {
|
void SetDepthReadWrite(bool read, bool write) override {
|
||||||
CGraphics::SetDepthWriteMode(read, ERglEnum::LEqual, write);
|
CGraphics::SetDepthWriteMode(read, ERglEnum::LEqual, write);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,11 @@ zeus::CTransform CGraphics::g_GXViewPointMatrix;
|
||||||
zeus::CTransform CGraphics::g_CameraMatrix;
|
zeus::CTransform CGraphics::g_CameraMatrix;
|
||||||
SClipScreenRect CGraphics::g_CroppedViewport;
|
SClipScreenRect CGraphics::g_CroppedViewport;
|
||||||
bool CGraphics::g_IsGXModelMatrixIdentity = true;
|
bool CGraphics::g_IsGXModelMatrixIdentity = true;
|
||||||
SViewport g_Viewport = {
|
zeus::CColor CGraphics::g_ClearColor = zeus::skClear;
|
||||||
|
float CGraphics::g_ClearDepthValue = 1.f;
|
||||||
|
bool CGraphics::g_IsBeginSceneClearFb = true;
|
||||||
|
|
||||||
|
SViewport CGraphics::g_Viewport = {
|
||||||
0, 0, 640, 480, 640 / 2.f, 480 / 2.f, 0.0f,
|
0, 0, 640, 480, 640 / 2.f, 480 / 2.f, 0.0f,
|
||||||
};
|
};
|
||||||
u32 CGraphics::g_FrameCounter = 0;
|
u32 CGraphics::g_FrameCounter = 0;
|
||||||
|
@ -121,6 +125,7 @@ void CGraphics::BeginScene() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraphics::EndScene() {
|
void CGraphics::EndScene() {
|
||||||
|
//CGX::SetZMode(true, GX_LEQUAL, true);
|
||||||
/* Spinwait until g_NumBreakpointsWaiting is 0 */
|
/* Spinwait until g_NumBreakpointsWaiting is 0 */
|
||||||
/* ++g_NumBreakpointsWaiting; */
|
/* ++g_NumBreakpointsWaiting; */
|
||||||
/* GXCopyDisp to g_CurrenFrameBuf with clear enabled */
|
/* GXCopyDisp to g_CurrenFrameBuf with clear enabled */
|
||||||
|
@ -484,6 +489,28 @@ void CGraphics::UpdateFPSCounter() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool g_UseVideoFilter = false;
|
||||||
|
void CGraphics::SetUseVideoFilter(bool filter) {
|
||||||
|
g_UseVideoFilter = filter;
|
||||||
|
// GXSetCopyFilter(CGraphics::mRenderModeObj.aa, CGraphics::mRenderModeObj.sample_pattern, filter,
|
||||||
|
// CGraphics::mRenderModeObj.vfilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGraphics::SetClearColor(const zeus::CColor& color) {
|
||||||
|
g_ClearColor = color;
|
||||||
|
// GXSetCopyClear(g_ClearColor, g_ClearDepthValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGraphics::SetCopyClear(const zeus::CColor& color, float depth) {
|
||||||
|
g_ClearColor = color;
|
||||||
|
g_ClearDepthValue = depth; // 1.6777215E7 * depth; Metroid Prime needed this to convert float [0,1] depth into 24 bit
|
||||||
|
// range, we no longer have this requirement
|
||||||
|
// GXSetCopyClear(g_ClearColor, g_ClearDepthValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGraphics::SetIsBeginSceneClearFb(bool clear) {
|
||||||
|
g_IsBeginSceneClearFb = clear;
|
||||||
|
}
|
||||||
// boo::IGraphicsDataFactory::Platform CGraphics::g_BooPlatform = boo::IGraphicsDataFactory::Platform::Null;
|
// boo::IGraphicsDataFactory::Platform CGraphics::g_BooPlatform = boo::IGraphicsDataFactory::Platform::Null;
|
||||||
// boo::IGraphicsDataFactory* CGraphics::g_BooFactory = nullptr;
|
// boo::IGraphicsDataFactory* CGraphics::g_BooFactory = nullptr;
|
||||||
// boo::IGraphicsCommandQueue* CGraphics::g_BooMainCommandQueue = nullptr;
|
// boo::IGraphicsCommandQueue* CGraphics::g_BooMainCommandQueue = nullptr;
|
||||||
|
|
|
@ -181,6 +181,7 @@ public:
|
||||||
static CProjectionState g_Proj;
|
static CProjectionState g_Proj;
|
||||||
static zeus::CVector2f g_CachedDepthRange;
|
static zeus::CVector2f g_CachedDepthRange;
|
||||||
static CFogState g_Fog;
|
static CFogState g_Fog;
|
||||||
|
static SViewport g_Viewport;
|
||||||
static std::array<zeus::CColor, 3> g_ColorRegs;
|
static std::array<zeus::CColor, 3> g_ColorRegs;
|
||||||
static float g_ProjAspect;
|
static float g_ProjAspect;
|
||||||
static u32 g_NumLightsActive;
|
static u32 g_NumLightsActive;
|
||||||
|
@ -199,6 +200,9 @@ public:
|
||||||
static zeus::CTransform g_CameraMatrix;
|
static zeus::CTransform g_CameraMatrix;
|
||||||
static SClipScreenRect g_CroppedViewport;
|
static SClipScreenRect g_CroppedViewport;
|
||||||
static bool g_IsGXModelMatrixIdentity;
|
static bool g_IsGXModelMatrixIdentity;
|
||||||
|
static zeus::CColor g_ClearColor;
|
||||||
|
static float g_ClearDepthValue; // Was a 24bit value, we use a float range from [0,1]
|
||||||
|
static bool g_IsBeginSceneClearFb;
|
||||||
|
|
||||||
static ERglEnum g_depthFunc;
|
static ERglEnum g_depthFunc;
|
||||||
static ERglCullMode g_cullMode;
|
static ERglCullMode g_cullMode;
|
||||||
|
@ -254,6 +258,10 @@ public:
|
||||||
static u32 GetFrameCounter() { return g_FrameCounter; }
|
static u32 GetFrameCounter() { return g_FrameCounter; }
|
||||||
static u32 GetFPS() { return g_Framerate; }
|
static u32 GetFPS() { return g_Framerate; }
|
||||||
static void UpdateFPSCounter();
|
static void UpdateFPSCounter();
|
||||||
|
static void SetUseVideoFilter(bool);
|
||||||
|
static void SetClearColor(const zeus::CColor& color);
|
||||||
|
static void SetCopyClear(const zeus::CColor& color, float depth);
|
||||||
|
static void SetIsBeginSceneClearFb(bool clear);
|
||||||
|
|
||||||
// static boo::IGraphicsDataFactory::Platform g_BooPlatform;
|
// static boo::IGraphicsDataFactory::Platform g_BooPlatform;
|
||||||
// static const char* g_BooPlatformName;
|
// static const char* g_BooPlatformName;
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
EPVSVisSetState GetVisible(u32 idx) const;
|
EPVSVisSetState GetVisible(u32 idx) const;
|
||||||
void SetFromMemory(u32 numBits, u32 numLights, const u8* leafPtr);
|
void SetFromMemory(u32 numBits, u32 numLights, const u8* leafPtr);
|
||||||
void SetTestPoint(const CPVSVisOctree& octree, const zeus::CVector3f&);
|
void SetTestPoint(const CPVSVisOctree& octree, const zeus::CVector3f&);
|
||||||
|
void SetState(EPVSVisSetState state) { x0_state = state; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace metaforce
|
} // namespace metaforce
|
||||||
|
|
Loading…
Reference in New Issue