mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-04 15:55:51 +00:00
CAABoxShader: Pull pipeline configuration from GX state
This commit is contained in:
parent
96ed5c7cee
commit
485e0afb43
@ -1051,6 +1051,10 @@ void CBooRenderer::SetDebugOption(EDebugOption, int) {}
|
|||||||
|
|
||||||
void CBooRenderer::BeginScene() {
|
void CBooRenderer::BeginScene() {
|
||||||
CGraphics::SetViewport(0, 0, g_Viewport.x8_width, g_Viewport.xc_height);
|
CGraphics::SetViewport(0, 0, g_Viewport.x8_width, g_Viewport.xc_height);
|
||||||
|
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_ProjAspect, 1.f, 4096.f);
|
CGraphics::SetPerspective(75.f, CGraphics::g_ProjAspect, 1.f, 4096.f);
|
||||||
CGraphics::SetModelMatrix(zeus::CTransform());
|
CGraphics::SetModelMatrix(zeus::CTransform());
|
||||||
#if 0
|
#if 0
|
||||||
@ -1065,6 +1069,8 @@ void CBooRenderer::BeginScene() {
|
|||||||
if (!x318_31_persistRGBA6)
|
if (!x318_31_persistRGBA6)
|
||||||
x318_26_requestRGBA6 = false;
|
x318_26_requestRGBA6 = false;
|
||||||
// GXSetPixelFmt(x318_27_currentRGBA6);
|
// GXSetPixelFmt(x318_27_currentRGBA6);
|
||||||
|
CGraphics::SetAlphaUpdate(true);
|
||||||
|
// GXSetDstAlpha(true, 0);
|
||||||
CGraphics::BeginScene();
|
CGraphics::BeginScene();
|
||||||
m_nextFogVolumePlaneShader = m_fogVolumePlaneShaders.begin();
|
m_nextFogVolumePlaneShader = m_fogVolumePlaneShaders.begin();
|
||||||
m_nextFogVolumeFilter = m_fogVolumeFilters.begin();
|
m_nextFogVolumeFilter = m_fogVolumeFilters.begin();
|
||||||
|
@ -40,13 +40,10 @@ class IObjectStore;
|
|||||||
|
|
||||||
class Buckets;
|
class Buckets;
|
||||||
|
|
||||||
enum class EWorldShadowMode {
|
enum class EWorldShadowMode { None, WorldOnActorShadow, BallOnWorldShadow, BallOnWorldIds, MAX };
|
||||||
None,
|
|
||||||
WorldOnActorShadow,
|
constexpr u32 skBallShadowIdSize = 64;
|
||||||
BallOnWorldShadow,
|
constexpr u32 skReflectionDrawTargetSize = 256;
|
||||||
BallOnWorldIds,
|
|
||||||
MAX
|
|
||||||
};
|
|
||||||
|
|
||||||
class CBooRenderer final : public IRenderer {
|
class CBooRenderer final : public IRenderer {
|
||||||
friend class CBooModel;
|
friend class CBooModel;
|
||||||
@ -128,9 +125,6 @@ class CBooRenderer final : public IRenderer {
|
|||||||
hsh::owner<hsh::vertex_buffer<ScanlinesVert>> m_scanLinesEvenVBO;
|
hsh::owner<hsh::vertex_buffer<ScanlinesVert>> m_scanLinesEvenVBO;
|
||||||
hsh::owner<hsh::vertex_buffer<ScanlinesVert>> m_scanLinesOddVBO;
|
hsh::owner<hsh::vertex_buffer<ScanlinesVert>> m_scanLinesOddVBO;
|
||||||
|
|
||||||
uint32_t m_ballShadowIdW = 64;
|
|
||||||
uint32_t m_ballShadowIdH = 64;
|
|
||||||
|
|
||||||
CRandom16 x2a8_thermalRand;
|
CRandom16 x2a8_thermalRand;
|
||||||
std::list<CFogVolumeListItem> x2ac_fogVolumes;
|
std::list<CFogVolumeListItem> x2ac_fogVolumes;
|
||||||
std::list<CFogVolumePlaneShader> m_fogVolumePlaneShaders;
|
std::list<CFogVolumePlaneShader> m_fogVolumePlaneShaders;
|
||||||
@ -202,8 +196,8 @@ public:
|
|||||||
int areaIdx, const SShader* shaderSet) override;
|
int areaIdx, const SShader* shaderSet) override;
|
||||||
void EnablePVS(const CPVSVisSet& set, u32 areaIdx) override;
|
void EnablePVS(const CPVSVisSet& set, u32 areaIdx) override;
|
||||||
void DisablePVS() override;
|
void DisablePVS() override;
|
||||||
void UpdateAreaUniforms(int areaIdx, EWorldShadowMode shadowMode = EWorldShadowMode::None,
|
void UpdateAreaUniforms(int areaIdx, EWorldShadowMode shadowMode = EWorldShadowMode::None, bool activateLights = true,
|
||||||
bool activateLights = true, int cubeFace = -1, const CModelFlags* ballShadowFlags = nullptr);
|
int cubeFace = -1, const CModelFlags* ballShadowFlags = nullptr);
|
||||||
void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*) override;
|
void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*) override;
|
||||||
void DrawAreaGeometry(int areaIdx, int mask, int targetMask) override;
|
void DrawAreaGeometry(int areaIdx, int mask, int targetMask) override;
|
||||||
void DrawUnsortedGeometry(int areaIdx, int mask, int targetMask, bool shadowRender = false) override;
|
void DrawUnsortedGeometry(int areaIdx, int mask, int targetMask, bool shadowRender = false) override;
|
||||||
@ -224,15 +218,35 @@ public:
|
|||||||
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 bottom, int width, int height) override;
|
||||||
// void SetDepthReadWrite(bool, bool);
|
void SetDepthReadWrite(bool test, bool write) override {
|
||||||
// void SetBlendMode_AdditiveAlpha();
|
CGraphics::SetDepthWriteMode(test, ERglEnum::LEqual, write);
|
||||||
// void SetBlendMode_AlphaBlended();
|
}
|
||||||
// void SetBlendMode_NoColorWrite();
|
void SetBlendMode_AdditiveAlpha() override {
|
||||||
// void SetBlendMode_ColorMultiply();
|
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::One, ERglLogicOp::Clear);
|
||||||
// void SetBlendMode_InvertDst();
|
}
|
||||||
// void SetBlendMode_InvertSrc();
|
void SetBlendMode_AlphaBlended() override {
|
||||||
// void SetBlendMode_Replace();
|
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::InvSrcAlpha,
|
||||||
// void SetBlendMode_AdditiveDestColor();
|
ERglLogicOp::Clear);
|
||||||
|
}
|
||||||
|
void SetBlendMode_NoColorWrite() override {
|
||||||
|
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::Zero, ERglBlendFactor::One, ERglLogicOp::Clear);
|
||||||
|
}
|
||||||
|
void SetBlendMode_ColorMultiply() override {
|
||||||
|
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::Zero, ERglBlendFactor::SrcColor, ERglLogicOp::Clear);
|
||||||
|
}
|
||||||
|
void SetBlendMode_InvertDst() override {
|
||||||
|
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::InvSrcColor, ERglBlendFactor::Zero,
|
||||||
|
ERglLogicOp::Clear);
|
||||||
|
}
|
||||||
|
void SetBlendMode_InvertSrc() override {
|
||||||
|
CGraphics::SetBlendMode(ERglBlendMode::Logic, ERglBlendFactor::One, ERglBlendFactor::Zero, ERglLogicOp::InvCopy);
|
||||||
|
}
|
||||||
|
void SetBlendMode_Replace() override {
|
||||||
|
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::One, ERglBlendFactor::Zero, ERglLogicOp::Clear);
|
||||||
|
}
|
||||||
|
void SetBlendMode_AdditiveDestColor() override {
|
||||||
|
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcColor, ERglBlendFactor::One, ERglLogicOp::Clear);
|
||||||
|
}
|
||||||
void SetDebugOption(EDebugOption, int) override;
|
void SetDebugOption(EDebugOption, int) override;
|
||||||
void BeginScene() override;
|
void BeginScene() override;
|
||||||
void EndScene() override;
|
void EndScene() override;
|
||||||
|
@ -10,6 +10,18 @@
|
|||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
|
|
||||||
|
/// GX global state
|
||||||
|
ERglEnum gx_DepthTest;
|
||||||
|
bool gx_DepthWrite;
|
||||||
|
ERglBlendMode gx_BlendMode;
|
||||||
|
ERglBlendFactor gx_BlendSrcFac;
|
||||||
|
ERglBlendFactor gx_BlendDstFac;
|
||||||
|
ERglLogicOp gx_BlendOp;
|
||||||
|
bool gx_AlphaWrite;
|
||||||
|
ERglCullMode gx_CullMode;
|
||||||
|
std::array<zeus::CColor, 2> gx_AmbientColors;
|
||||||
|
/// End GX state
|
||||||
|
|
||||||
CGraphics::CProjectionState CGraphics::g_Proj;
|
CGraphics::CProjectionState CGraphics::g_Proj;
|
||||||
CGraphics::CFogState CGraphics::g_Fog;
|
CGraphics::CFogState CGraphics::g_Fog;
|
||||||
std::array<zeus::CColor, 3> CGraphics::g_ColorRegs{};
|
std::array<zeus::CColor, 3> CGraphics::g_ColorRegs{};
|
||||||
@ -77,7 +89,8 @@ void CGraphics::SetLightState(ERglLightBits lightState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CGraphics::SetAmbientColor(const zeus::CColor& col) {
|
void CGraphics::SetAmbientColor(const zeus::CColor& col) {
|
||||||
// TODO: set for real
|
gx_AmbientColors[0] = col;
|
||||||
|
gx_AmbientColors[1] = col;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraphics::SetFog(ERglFogMode mode, float startz, float endz, const zeus::CColor& color) {
|
void CGraphics::SetFog(ERglFogMode mode, float startz, float endz, const zeus::CColor& color) {
|
||||||
@ -96,11 +109,22 @@ void CGraphics::SetFog(ERglFogMode mode, float startz, float endz, const zeus::C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraphics::SetDepthWriteMode(bool test, ERglEnum comp, bool write) {}
|
void CGraphics::SetDepthWriteMode(bool test, ERglEnum comp, bool write) {
|
||||||
|
gx_DepthTest = test ? ERglEnum::Always : comp;
|
||||||
|
gx_DepthWrite = write;
|
||||||
|
}
|
||||||
|
|
||||||
void CGraphics::SetBlendMode(ERglBlendMode, ERglBlendFactor, ERglBlendFactor, ERglLogicOp) {}
|
void CGraphics::SetBlendMode(ERglBlendMode type, ERglBlendFactor srcFac, ERglBlendFactor dstFac, ERglLogicOp op) {
|
||||||
|
gx_BlendMode = type;
|
||||||
|
gx_BlendSrcFac = srcFac;
|
||||||
|
gx_BlendDstFac = dstFac;
|
||||||
|
gx_BlendOp = op;
|
||||||
|
}
|
||||||
|
|
||||||
void CGraphics::SetCullMode(ERglCullMode) {}
|
void CGraphics::SetCullMode(ERglCullMode mode) { gx_CullMode = mode; }
|
||||||
|
|
||||||
|
// URDE addition (GXSetAlphaUpdate)
|
||||||
|
void CGraphics::SetAlphaUpdate(bool value) { gx_AlphaWrite = value; }
|
||||||
|
|
||||||
void CGraphics::BeginScene() {}
|
void CGraphics::BeginScene() {}
|
||||||
|
|
||||||
@ -441,4 +465,3 @@ const CTevCombiners::CTevPass CGraphics::sTevPass805a6084(
|
|||||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_CPREV, GX::TevColorArg::CC_APREV, GX::TevColorArg::CC_ZERO},
|
{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});
|
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_APREV});
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
||||||
|
@ -112,6 +112,19 @@ struct SViewport {
|
|||||||
float aspect;
|
float aspect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// GX global state
|
||||||
|
extern ERglEnum gx_DepthTest;
|
||||||
|
extern bool gx_DepthWrite;
|
||||||
|
extern ERglBlendMode gx_BlendMode;
|
||||||
|
extern ERglBlendFactor gx_BlendSrcFac;
|
||||||
|
extern ERglBlendFactor gx_BlendDstFac;
|
||||||
|
extern ERglLogicOp gx_BlendOp;
|
||||||
|
extern bool gx_AlphaWrite;
|
||||||
|
extern ERglCullMode gx_CullMode;
|
||||||
|
// GX_COLOR0A0 & GX_COLOR1A1
|
||||||
|
extern std::array<zeus::CColor, 2> gx_AmbientColors;
|
||||||
|
/// End GX state
|
||||||
|
|
||||||
extern SViewport g_Viewport;
|
extern SViewport g_Viewport;
|
||||||
|
|
||||||
struct SClipScreenRect {
|
struct SClipScreenRect {
|
||||||
@ -283,8 +296,9 @@ public:
|
|||||||
static void SetAmbientColor(const zeus::CColor& col);
|
static void SetAmbientColor(const zeus::CColor& col);
|
||||||
static void SetFog(ERglFogMode mode, float startz, float endz, const zeus::CColor& color);
|
static void SetFog(ERglFogMode mode, float startz, float endz, const zeus::CColor& color);
|
||||||
static void SetDepthWriteMode(bool test, ERglEnum comp, bool write);
|
static void SetDepthWriteMode(bool test, ERglEnum comp, bool write);
|
||||||
static void SetBlendMode(ERglBlendMode, ERglBlendFactor, ERglBlendFactor, ERglLogicOp);
|
static void SetBlendMode(ERglBlendMode type, ERglBlendFactor srcFac, ERglBlendFactor dstFac, ERglLogicOp op);
|
||||||
static void SetCullMode(ERglCullMode);
|
static void SetCullMode(ERglCullMode mode);
|
||||||
|
static void SetAlphaUpdate(bool value);
|
||||||
static void BeginScene();
|
static void BeginScene();
|
||||||
static void EndScene();
|
static void EndScene();
|
||||||
static void SetAlphaCompare(ERglAlphaFunc comp0, u8 ref0, ERglAlphaOp op, ERglAlphaFunc comp1, u8 ref1);
|
static void SetAlphaCompare(ERglAlphaFunc comp0, u8 ref0, ERglAlphaOp op, ERglAlphaFunc comp1, u8 ref1);
|
||||||
@ -466,7 +480,7 @@ using SubtractAttachmentExt = hsh::pipeline::color_attachment<
|
|||||||
|
|
||||||
template <AlphaMode Alpha = AlphaMode::NoAlpha>
|
template <AlphaMode Alpha = AlphaMode::NoAlpha>
|
||||||
using InvDstMultiplyAttachmentExt =
|
using InvDstMultiplyAttachmentExt =
|
||||||
hsh::pipeline::color_attachment<hsh::Zero, hsh::InvDstColor, hsh::Add, AlphaSrc<Alpha, hsh::Zero>::Factor,
|
hsh::pipeline::color_attachment<hsh::Zero, hsh::InvDstColor, hsh::Add, AlphaSrc<Alpha, hsh::Zero>::Factor,
|
||||||
AlphaDst<Alpha, hsh::InvDstAlpha>::Factor, hsh::Add,
|
AlphaDst<Alpha, hsh::InvDstAlpha>::Factor, hsh::Add,
|
||||||
hsh::ColorComponentFlags(
|
hsh::ColorComponentFlags(
|
||||||
hsh::CC_Red | hsh::CC_Green | hsh::CC_Blue |
|
hsh::CC_Red | hsh::CC_Green | hsh::CC_Blue |
|
||||||
@ -520,6 +534,90 @@ using NoColorAttachment = NoColorAttachmentExt<AlphaWrite ? AlphaMode::AlphaWrit
|
|||||||
#define FOG_OUT(out, fog, colorIn) \
|
#define FOG_OUT(out, fog, colorIn) \
|
||||||
out = hsh::float4(hsh::lerp((colorIn), (fog).m_color, hsh::saturate(fogZ)).xyz(), (colorIn).w);
|
out = hsh::float4(hsh::lerp((colorIn), (fog).m_color, hsh::saturate(fogZ)).xyz(), (colorIn).w);
|
||||||
|
|
||||||
|
template <ERglCullMode CullMode>
|
||||||
|
struct ERglCullModeAttachmentExt {
|
||||||
|
using type = hsh::pipeline::cull_mode<>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglCullModeAttachmentExt<ERglCullMode::None> {
|
||||||
|
using type = hsh::pipeline::cull_mode<hsh::CullNone>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglCullModeAttachmentExt<ERglCullMode::All> {
|
||||||
|
using type = hsh::pipeline::cull_mode<hsh::CullFrontAndBack>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglCullModeAttachmentExt<ERglCullMode::Front> {
|
||||||
|
using type = hsh::pipeline::cull_mode<hsh::CullFront>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglCullModeAttachmentExt<ERglCullMode::Back> {
|
||||||
|
using type = hsh::pipeline::cull_mode<hsh::CullBack>;
|
||||||
|
};
|
||||||
|
template <ERglCullMode CullMode>
|
||||||
|
using ERglCullModeAttachment = typename ERglCullModeAttachmentExt<CullMode>::type;
|
||||||
|
|
||||||
|
template <ERglEnum Compare>
|
||||||
|
struct ERglDepthCompareAttachmentExt {
|
||||||
|
using type = hsh::pipeline::depth_compare<>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglDepthCompareAttachmentExt<ERglEnum::Never> {
|
||||||
|
using type = hsh::pipeline::depth_compare<hsh::Never>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglDepthCompareAttachmentExt<ERglEnum::Less> {
|
||||||
|
using type = hsh::pipeline::depth_compare<hsh::Less>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglDepthCompareAttachmentExt<ERglEnum::Equal> {
|
||||||
|
using type = hsh::pipeline::depth_compare<hsh::Equal>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglDepthCompareAttachmentExt<ERglEnum::LEqual> {
|
||||||
|
using type = hsh::pipeline::depth_compare<hsh::LEqual>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglDepthCompareAttachmentExt<ERglEnum::Greater> {
|
||||||
|
using type = hsh::pipeline::depth_compare<hsh::Greater>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglDepthCompareAttachmentExt<ERglEnum::NEqual> {
|
||||||
|
using type = hsh::pipeline::depth_compare<hsh::NEqual>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglDepthCompareAttachmentExt<ERglEnum::GEqual> {
|
||||||
|
using type = hsh::pipeline::depth_compare<hsh::GEqual>;
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ERglDepthCompareAttachmentExt<ERglEnum::Always> {
|
||||||
|
using type = hsh::pipeline::depth_compare<hsh::Always>;
|
||||||
|
};
|
||||||
|
template <ERglEnum Compare>
|
||||||
|
using ERglDepthCompareAttachment = typename ERglDepthCompareAttachmentExt<Compare>::type;
|
||||||
|
|
||||||
|
template <ERglBlendMode Mode, ERglBlendFactor SrcFac, ERglBlendFactor DstFac, ERglLogicOp Op, bool AlphaWrite>
|
||||||
|
struct ERglBlendModeAttachmentExt {
|
||||||
|
using type = hsh::pipeline::color_attachment<>;
|
||||||
|
};
|
||||||
|
template <ERglLogicOp Op, bool AlphaWrite>
|
||||||
|
struct ERglBlendModeAttachmentExt<ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::InvSrcAlpha, Op,
|
||||||
|
AlphaWrite> {
|
||||||
|
using type = hsh::pipeline::color_attachment<
|
||||||
|
hsh::SrcAlpha, hsh::InvSrcAlpha, hsh::Add, hsh::SrcAlpha, hsh::InvSrcAlpha, hsh::Add,
|
||||||
|
hsh::ColorComponentFlags(hsh::CC_Red | hsh::CC_Green | hsh::CC_Blue |
|
||||||
|
(AlphaWrite ? hsh::CC_Alpha : hsh::ColorComponentFlags()))>;
|
||||||
|
};
|
||||||
|
template <ERglBlendFactor SrcFac, ERglBlendFactor DstFac, ERglLogicOp Op, bool AlphaWrite>
|
||||||
|
struct ERglBlendModeAttachmentExt<ERglBlendMode::None, SrcFac, DstFac, Op, AlphaWrite> {
|
||||||
|
using type = hsh::pipeline::color_attachment<hsh::One, hsh::Zero, hsh::Add, hsh::One, hsh::Zero, hsh::Add,
|
||||||
|
hsh::ColorComponentFlags(
|
||||||
|
hsh::CC_Red | hsh::CC_Green | hsh::CC_Blue |
|
||||||
|
(AlphaWrite ? hsh::CC_Alpha : hsh::ColorComponentFlags()))>;
|
||||||
|
};
|
||||||
|
template <ERglBlendMode Mode, ERglBlendFactor SrcFac, ERglBlendFactor DstFac, ERglLogicOp Op, bool AlphaWrite>
|
||||||
|
using ERglBlendModeAttachment = typename ERglBlendModeAttachmentExt<Mode, SrcFac, DstFac, Op, AlphaWrite>::type;
|
||||||
|
|
||||||
#ifdef BOO_GRAPHICS_DEBUG_GROUPS
|
#ifdef BOO_GRAPHICS_DEBUG_GROUPS
|
||||||
class GraphicsDebugGroup {
|
class GraphicsDebugGroup {
|
||||||
/* Stack only */
|
/* Stack only */
|
||||||
|
@ -59,15 +59,15 @@ public:
|
|||||||
virtual std::pair<zeus::CVector2f, zeus::CVector2f> SetViewportOrtho(bool centered, float znear, float zfar) = 0;
|
virtual std::pair<zeus::CVector2f, zeus::CVector2f> SetViewportOrtho(bool centered, float znear, float zfar) = 0;
|
||||||
virtual void SetClippingPlanes(const zeus::CFrustum& frustum) = 0;
|
virtual void SetClippingPlanes(const zeus::CFrustum& frustum) = 0;
|
||||||
virtual void SetViewport(int left, int bottom, int width, int height) = 0;
|
virtual void SetViewport(int left, int bottom, int width, int height) = 0;
|
||||||
// virtual void SetDepthReadWrite(bool, bool)=0;
|
virtual void SetDepthReadWrite(bool test, bool write) = 0;
|
||||||
// virtual void SetBlendMode_AdditiveAlpha()=0;
|
virtual void SetBlendMode_AdditiveAlpha() = 0;
|
||||||
// virtual void SetBlendMode_AlphaBlended()=0;
|
virtual void SetBlendMode_AlphaBlended() = 0;
|
||||||
// virtual void SetBlendMode_NoColorWrite()=0;
|
virtual void SetBlendMode_NoColorWrite() = 0;
|
||||||
// virtual void SetBlendMode_ColorMultiply()=0;
|
virtual void SetBlendMode_ColorMultiply() = 0;
|
||||||
// virtual void SetBlendMode_InvertDst()=0;
|
virtual void SetBlendMode_InvertDst() = 0;
|
||||||
// virtual void SetBlendMode_InvertSrc()=0;
|
virtual void SetBlendMode_InvertSrc() = 0;
|
||||||
// virtual void SetBlendMode_Replace()=0;
|
virtual void SetBlendMode_Replace() = 0;
|
||||||
// virtual void SetBlendMode_AdditiveDestColor()=0;
|
virtual void SetBlendMode_AdditiveDestColor() = 0;
|
||||||
virtual void SetDebugOption(EDebugOption, int) = 0;
|
virtual void SetDebugOption(EDebugOption, int) = 0;
|
||||||
virtual void BeginScene() = 0;
|
virtual void BeginScene() = 0;
|
||||||
virtual void EndScene() = 0;
|
virtual void EndScene() = 0;
|
||||||
|
@ -9,19 +9,20 @@
|
|||||||
namespace urde {
|
namespace urde {
|
||||||
using namespace hsh::pipeline;
|
using namespace hsh::pipeline;
|
||||||
|
|
||||||
template <bool zOnly>
|
template <ERglCullMode CullMode, ERglEnum Compare, bool DepthWrite, ERglBlendMode Mode, ERglBlendFactor SrcFac,
|
||||||
|
ERglBlendFactor DstFac, ERglLogicOp Op, bool AlphaWrite>
|
||||||
struct CAABoxShaderPipeline
|
struct CAABoxShaderPipeline
|
||||||
: pipeline<topology<hsh::TriangleStrip>, std::conditional_t<zOnly, NoColorAttachment<>, BlendAttachment<>>,
|
: pipeline<topology<hsh::TriangleStrip>, ERglBlendModeAttachment<Mode, SrcFac, DstFac, Op, AlphaWrite>,
|
||||||
depth_compare<hsh::LEqual>> {
|
ERglCullModeAttachment<CullMode>, ERglDepthCompareAttachment<Compare>, depth_write<DepthWrite>> {
|
||||||
CAABoxShaderPipeline(hsh::vertex_buffer<CAABoxShader::Vert> vbo, hsh::uniform_buffer<CAABoxShader::Uniform> uniBuf) {
|
CAABoxShaderPipeline(hsh::vertex_buffer<CAABoxShader::Vert> vbo, hsh::uniform_buffer<CAABoxShader::Uniform> uniBuf) {
|
||||||
this->position = uniBuf->m_xf * hsh::float4(vbo->m_pos, 1.f);
|
this->position = uniBuf->m_xf * hsh::float4(vbo->m_pos, 1.f);
|
||||||
this->color_out[0] = uniBuf->m_color;
|
this->color_out[0] = uniBuf->m_color;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template struct CAABoxShaderPipeline<true>;
|
template struct CAABoxShaderPipeline<ERglCullMode::None, ERglEnum::Always, true, ERglBlendMode::Blend,
|
||||||
template struct CAABoxShaderPipeline<false>;
|
ERglBlendFactor::SrcAlpha, ERglBlendFactor::InvSrcAlpha, ERglLogicOp::Clear, true>;
|
||||||
|
|
||||||
CAABoxShader::CAABoxShader(const zeus::CAABox& aabb, bool zOnly) {
|
CAABoxShader::CAABoxShader(const zeus::CAABox& aabb) {
|
||||||
const std::array<Vert, 34> verts{{
|
const std::array<Vert, 34> verts{{
|
||||||
{{aabb.max.x(), aabb.max.y(), aabb.min.z()}}, {{aabb.max.x(), aabb.min.y(), aabb.min.z()}},
|
{{aabb.max.x(), aabb.max.y(), aabb.min.z()}}, {{aabb.max.x(), aabb.min.y(), aabb.min.z()}},
|
||||||
{{aabb.max.x(), aabb.max.y(), aabb.max.z()}}, {{aabb.max.x(), aabb.min.y(), aabb.max.z()}},
|
{{aabb.max.x(), aabb.max.y(), aabb.max.z()}}, {{aabb.max.x(), aabb.min.y(), aabb.max.z()}},
|
||||||
@ -50,8 +51,8 @@ CAABoxShader::CAABoxShader(const zeus::CAABox& aabb, bool zOnly) {
|
|||||||
|
|
||||||
m_vbo = hsh::create_vertex_buffer(verts);
|
m_vbo = hsh::create_vertex_buffer(verts);
|
||||||
m_uniBuf = hsh::create_dynamic_uniform_buffer<Uniform>();
|
m_uniBuf = hsh::create_dynamic_uniform_buffer<Uniform>();
|
||||||
|
m_dataBind.hsh_bind(CAABoxShaderPipeline<gx_CullMode, gx_DepthTest, gx_DepthWrite, gx_BlendMode, gx_BlendSrcFac,
|
||||||
m_dataBind.hsh_bind(CAABoxShaderPipeline<zOnly>(m_vbo.get(), m_uniBuf.get()));
|
gx_BlendDstFac, gx_BlendOp, gx_AlphaWrite>(m_vbo.get(), m_uniBuf.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAABoxShader::draw(const zeus::CColor& color) {
|
void CAABoxShader::draw(const zeus::CColor& color) {
|
||||||
|
@ -25,7 +25,7 @@ private:
|
|||||||
Uniform m_uniform{};
|
Uniform m_uniform{};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAABoxShader(const zeus::CAABox& aabb, bool zOnly = false);
|
CAABoxShader(const zeus::CAABox& aabb);
|
||||||
void draw(const zeus::CColor& color);
|
void draw(const zeus::CColor& color);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ CPhazonBeam::CPhazonBeam(CAssetId characterId, EWeaponType type, TUniqueId playe
|
|||||||
zeus::CVector3f(0.14664599f, 0.64619601f, 0.14909725f) * scale.y())
|
zeus::CVector3f(0.14664599f, 0.64619601f, 0.14909725f) * scale.y())
|
||||||
, x250_aaBoxTranslate(zeus::CVector3f(-0.0625f, 0.f, -0.09375f) * scale.y(),
|
, x250_aaBoxTranslate(zeus::CVector3f(-0.0625f, 0.f, -0.09375f) * scale.y(),
|
||||||
zeus::CVector3f(0.0625f, -0.25f, 0.09375f) * scale.y())
|
zeus::CVector3f(0.0625f, -0.25f, 0.09375f) * scale.y())
|
||||||
, m_aaboxShaderScale(x238_aaBoxScale, true)
|
, m_aaboxShaderScale(x238_aaBoxScale)
|
||||||
, m_aaboxShaderTranslate(x250_aaBoxTranslate, true) {
|
, m_aaboxShaderTranslate(x250_aaBoxTranslate) {
|
||||||
x21c_phazonVeins = g_SimplePool->GetObj("PhazonVeins");
|
x21c_phazonVeins = g_SimplePool->GetObj("PhazonVeins");
|
||||||
x228_phazon2nd1 = g_SimplePool->GetObj("Phazon2nd_1");
|
x228_phazon2nd1 = g_SimplePool->GetObj("Phazon2nd_1");
|
||||||
}
|
}
|
||||||
@ -166,12 +166,18 @@ bool CPhazonBeam::IsLoaded() const { return CGunWeapon::IsLoaded() && x274_24_lo
|
|||||||
|
|
||||||
void CPhazonBeam::DrawClipScaleCube() {
|
void CPhazonBeam::DrawClipScaleCube() {
|
||||||
// Render AABB as completely transparent object, only modifying Z-buffer
|
// Render AABB as completely transparent object, only modifying Z-buffer
|
||||||
m_aaboxShaderScale.draw(zeus::skClear);
|
g_Renderer->SetBlendMode_AlphaBlended();
|
||||||
|
CGraphics::SetCullMode(ERglCullMode::None);
|
||||||
|
m_aaboxShaderScale.draw(zeus::CColor{1.f, 1.f, 1.f, 0.f});
|
||||||
|
CGraphics::SetCullMode(ERglCullMode::Front);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPhazonBeam::DrawClipTranslateCube() {
|
void CPhazonBeam::DrawClipTranslateCube() {
|
||||||
// Render AABB as completely transparent object, only modifying Z-buffer
|
// Render AABB as completely transparent object, only modifying Z-buffer
|
||||||
m_aaboxShaderTranslate.draw(zeus::skClear);
|
g_Renderer->SetBlendMode_AlphaBlended();
|
||||||
|
CGraphics::SetCullMode(ERglCullMode::None);
|
||||||
|
m_aaboxShaderTranslate.draw(zeus::CColor{1.f, 1.f, 1.f, 0.f});
|
||||||
|
CGraphics::SetCullMode(ERglCullMode::Front);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPhazonBeam::Draw(bool drawSuitArm, const CStateManager& mgr, const zeus::CTransform& xf, const CModelFlags& flags,
|
void CPhazonBeam::Draw(bool drawSuitArm, const CStateManager& mgr, const zeus::CTransform& xf, const CModelFlags& flags,
|
||||||
|
@ -132,7 +132,7 @@ CPlayerGun::CPlayerGun(TUniqueId playerId)
|
|||||||
, x6c8_hologramClipCube(zeus::CVector3f(-0.29329199f, 0.f, -0.2481945f),
|
, x6c8_hologramClipCube(zeus::CVector3f(-0.29329199f, 0.f, -0.2481945f),
|
||||||
zeus::CVector3f(0.29329199f, 1.292392f, 0.2481945f))
|
zeus::CVector3f(0.29329199f, 1.292392f, 0.2481945f))
|
||||||
, x6e0_rightHandModel(CAnimRes(g_tweakGunRes->xc_rightHand, 0, zeus::CVector3f(3.f), 0, true))
|
, x6e0_rightHandModel(CAnimRes(g_tweakGunRes->xc_rightHand, 0, zeus::CVector3f(3.f), 0, true))
|
||||||
, m_aaboxShader(x6c8_hologramClipCube, true) {
|
, m_aaboxShader(x6c8_hologramClipCube) {
|
||||||
x354_bombFuseTime = g_tweakPlayerGun->GetBombFuseTime();
|
x354_bombFuseTime = g_tweakPlayerGun->GetBombFuseTime();
|
||||||
x358_bombDropDelayTime = g_tweakPlayerGun->GetBombDropDelayTime();
|
x358_bombDropDelayTime = g_tweakPlayerGun->GetBombDropDelayTime();
|
||||||
x668_aimVerticalSpeed = g_tweakPlayerGun->GetAimVerticalSpeed();
|
x668_aimVerticalSpeed = g_tweakPlayerGun->GetAimVerticalSpeed();
|
||||||
@ -2134,7 +2134,10 @@ void CPlayerGun::DrawScreenTex(float z) {
|
|||||||
void CPlayerGun::DrawClipCube(const zeus::CAABox& aabb) {
|
void CPlayerGun::DrawClipCube(const zeus::CAABox& aabb) {
|
||||||
// Render AABB as completely transparent object, only modifying Z-buffer
|
// Render AABB as completely transparent object, only modifying Z-buffer
|
||||||
// AABB has already been set in constructor (since it's constant)
|
// AABB has already been set in constructor (since it's constant)
|
||||||
m_aaboxShader.draw(zeus::skClear);
|
g_Renderer->SetBlendMode_AlphaBlended();
|
||||||
|
CGraphics::SetCullMode(ERglCullMode::None);
|
||||||
|
m_aaboxShader.draw(zeus::CColor{1.f, 1.f, 1.f, 0.f});
|
||||||
|
CGraphics::SetCullMode(ERglCullMode::Front);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayerGun::Render(const CStateManager& mgr, const zeus::CVector3f& pos, const CModelFlags& flags) {
|
void CPlayerGun::Render(const CStateManager& mgr, const zeus::CVector3f& pos, const CModelFlags& flags) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user