2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2015-08-21 00:06:39 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include <functional>
|
2015-08-21 00:06:39 +00:00
|
|
|
#include <vector>
|
2019-09-28 02:53:03 +00:00
|
|
|
|
|
|
|
#include "Runtime/CToken.hpp"
|
|
|
|
#include "Runtime/Graphics/CGraphics.hpp"
|
2022-03-08 23:35:40 +00:00
|
|
|
#include "Runtime/Graphics/CModel.hpp"
|
2022-02-25 07:45:25 +00:00
|
|
|
#include "Runtime/RetroTypes.hpp"
|
2019-09-28 02:53:03 +00:00
|
|
|
|
|
|
|
#include <zeus/CAABox.hpp>
|
|
|
|
#include <zeus/CColor.hpp>
|
|
|
|
#include <zeus/CFrustum.hpp>
|
|
|
|
#include <zeus/CPlane.hpp>
|
|
|
|
#include <zeus/CRectangle.hpp>
|
2015-08-21 00:06:39 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2015-08-21 00:06:39 +00:00
|
|
|
class CAreaOctTree;
|
2019-09-28 02:53:03 +00:00
|
|
|
class CLight;
|
|
|
|
class CMetroidModelInstance;
|
2016-07-27 23:06:57 +00:00
|
|
|
class CPVSVisSet;
|
2019-09-28 02:53:03 +00:00
|
|
|
class CParticleGen;
|
|
|
|
class CSkinnedModel;
|
2016-08-17 20:05:23 +00:00
|
|
|
struct CAreaRenderOctTree;
|
2017-05-08 19:10:09 +00:00
|
|
|
struct CModelFlags;
|
2019-09-28 02:53:03 +00:00
|
|
|
struct SShader;
|
2015-08-21 00:06:39 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class IRenderer {
|
2015-08-21 00:06:39 +00:00
|
|
|
public:
|
2020-04-09 17:28:20 +00:00
|
|
|
using TDrawableCallback = void (*)(void*, void*, int);
|
2018-12-08 05:30:43 +00:00
|
|
|
using TReflectionCallback = std::function<void(void*, const zeus::CVector3f&)>;
|
2016-07-21 05:21:45 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
enum class EDrawableSorting { SortedCallback, UnsortedCallback };
|
2022-02-25 07:45:25 +00:00
|
|
|
enum class EDebugOption { Invalid = -1, PVSMode, PVSState, FogDisabled };
|
2022-03-06 04:50:54 +00:00
|
|
|
enum class EPrimitiveType {
|
|
|
|
Triangles = GX::TRIANGLES,
|
|
|
|
TriangleFan = GX::TRIANGLEFAN,
|
|
|
|
TriangleStrip = GX::TRIANGLESTRIP,
|
|
|
|
Lines = GX::LINES,
|
|
|
|
LineStrip = GX::LINESTRIP,
|
|
|
|
};
|
2015-08-21 00:06:39 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
virtual ~IRenderer() = default;
|
2020-03-30 04:34:35 +00:00
|
|
|
virtual void AddStaticGeometry(const std::vector<CMetroidModelInstance>* geometry, const CAreaRenderOctTree* octTree,
|
2022-03-07 03:07:00 +00:00
|
|
|
s32 areaIdx) = 0;
|
2020-03-30 04:34:35 +00:00
|
|
|
virtual void EnablePVS(const CPVSVisSet& set, u32 areaIdx) = 0;
|
2018-12-08 05:30:43 +00:00
|
|
|
virtual void DisablePVS() = 0;
|
2020-03-30 04:34:35 +00:00
|
|
|
virtual void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>* geometry) = 0;
|
2022-03-07 03:07:00 +00:00
|
|
|
virtual void DrawUnsortedGeometry(s32 areaIdx, s32 mask, s32 targetMask, bool shadowRender = false) = 0;
|
|
|
|
virtual void DrawSortedGeometry(s32 areaIdx, s32 mask, s32 targetMask) = 0;
|
|
|
|
virtual void DrawStaticGeometry(s32 areaIdx, s32 mask, s32 targetMask) = 0;
|
|
|
|
virtual void DrawAreaGeometry(s32 areaIdx, s32 mask, s32 targetMask) = 0;
|
2018-12-08 05:30:43 +00:00
|
|
|
virtual void PostRenderFogs() = 0;
|
2019-11-24 15:01:07 +00:00
|
|
|
virtual void SetModelMatrix(const zeus::CTransform& xf) = 0;
|
2020-04-09 17:28:20 +00:00
|
|
|
virtual void AddParticleGen(CParticleGen& gen) = 0;
|
|
|
|
virtual void AddParticleGen(CParticleGen& gen, const zeus::CVector3f& pos, const zeus::CAABox& bounds) = 0;
|
2022-03-07 03:07:00 +00:00
|
|
|
virtual void AddPlaneObject(void* obj, const zeus::CAABox& aabb, const zeus::CPlane& plane, s32 type) = 0;
|
|
|
|
virtual void AddDrawable(void* obj, const zeus::CVector3f& pos, const zeus::CAABox& aabb, s32 mode,
|
2020-03-30 04:34:35 +00:00
|
|
|
EDrawableSorting sorting) = 0;
|
2020-04-09 17:28:20 +00:00
|
|
|
virtual void SetDrawableCallback(TDrawableCallback cb, void* ctx) = 0;
|
2020-03-30 04:34:35 +00:00
|
|
|
virtual void SetWorldViewpoint(const zeus::CTransform& xf) = 0;
|
|
|
|
virtual void SetPerspective(float fovy, float width, float height, float znear, float zfar) = 0;
|
|
|
|
virtual void SetPerspective(float fovy, float aspect, 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;
|
2022-03-07 03:07:00 +00:00
|
|
|
virtual void SetViewport(s32 left, s32 bottom, s32 width, s32 height) = 0;
|
2022-02-25 07:45:25 +00:00
|
|
|
virtual void SetDepthReadWrite(bool, bool) = 0;
|
|
|
|
virtual void SetBlendMode_AdditiveAlpha() = 0;
|
|
|
|
virtual void SetBlendMode_AlphaBlended() = 0;
|
|
|
|
virtual void SetBlendMode_NoColorWrite() = 0;
|
|
|
|
virtual void SetBlendMode_ColorMultiply() = 0;
|
|
|
|
virtual void SetBlendMode_InvertDst() = 0;
|
|
|
|
virtual void SetBlendMode_InvertSrc() = 0;
|
|
|
|
virtual void SetBlendMode_Replace() = 0;
|
|
|
|
virtual void SetBlendMode_AdditiveDestColor() = 0;
|
2022-03-07 03:07:00 +00:00
|
|
|
virtual void SetDebugOption(EDebugOption, s32) = 0;
|
2018-12-08 05:30:43 +00:00
|
|
|
virtual void BeginScene() = 0;
|
|
|
|
virtual void EndScene() = 0;
|
2022-03-07 03:07:00 +00:00
|
|
|
virtual void BeginPrimitive(EPrimitiveType, s32) = 0;
|
|
|
|
virtual void BeginLines(s32) = 0;
|
|
|
|
virtual void BeginLineStrip(s32) = 0;
|
|
|
|
virtual void BeginTriangles(s32) = 0;
|
|
|
|
virtual void BeginTriangleStrip(s32) = 0;
|
|
|
|
virtual void BeginTriangleFan(s32) = 0;
|
2022-02-25 07:45:25 +00:00
|
|
|
virtual void PrimVertex(const zeus::CVector3f&) = 0;
|
|
|
|
virtual void PrimNormal(const zeus::CVector3f&) = 0;
|
|
|
|
virtual void PrimColor(float, float, float, float) = 0;
|
|
|
|
virtual void PrimColor(const zeus::CColor&) = 0;
|
|
|
|
virtual void EndPrimitive() = 0;
|
2020-03-30 04:34:35 +00:00
|
|
|
virtual void SetAmbientColor(const zeus::CColor& color) = 0;
|
|
|
|
virtual void DrawString(const char* string, int, int) = 0;
|
2018-12-08 05:30:43 +00:00
|
|
|
virtual u32 GetFPS() = 0;
|
2020-03-30 04:34:35 +00:00
|
|
|
virtual void CacheReflection(TReflectionCallback cb, void* ctx, bool clearAfter) = 0;
|
|
|
|
virtual void DrawSpaceWarp(const zeus::CVector3f& pt, float strength) = 0;
|
2022-03-12 15:47:20 +00:00
|
|
|
virtual void DrawThermalModel(CModel& model, const zeus::CColor& multCol, const zeus::CColor& addCol,
|
2022-03-10 06:33:17 +00:00
|
|
|
TConstVectorRef positions, TConstVectorRef normals, const CModelFlags& flags) = 0;
|
2022-03-12 15:47:20 +00:00
|
|
|
virtual void DrawModelDisintegrate(CModel& model, CTexture& tex, const zeus::CColor& color, TConstVectorRef positions,
|
|
|
|
TConstVectorRef normals, float t) = 0;
|
|
|
|
virtual void DrawModelFlat(CModel& model, const CModelFlags& flags, bool unsortedOnly, TConstVectorRef positions,
|
|
|
|
TConstVectorRef normals) = 0;
|
2022-03-07 03:07:00 +00:00
|
|
|
virtual void SetWireframeFlags(s32 flags) = 0;
|
2020-03-30 04:34:35 +00:00
|
|
|
virtual void SetWorldFog(ERglFogMode mode, float startz, float endz, const zeus::CColor& color) = 0;
|
|
|
|
virtual void RenderFogVolume(const zeus::CColor& color, const zeus::CAABox& aabb, const TLockedToken<CModel>* model,
|
|
|
|
const CSkinnedModel* sModel) = 0;
|
|
|
|
virtual void SetThermal(bool thermal, float level, const zeus::CColor& color) = 0;
|
2018-12-08 05:30:43 +00:00
|
|
|
virtual void SetThermalColdScale(float scale) = 0;
|
|
|
|
virtual void DoThermalBlendCold() = 0;
|
|
|
|
virtual void DoThermalBlendHot() = 0;
|
|
|
|
virtual u32 GetStaticWorldDataSize() = 0;
|
|
|
|
virtual void SetGXRegister1Color(const zeus::CColor& color) = 0;
|
|
|
|
virtual void SetWorldLightFadeLevel(float level) = 0;
|
2022-03-06 07:46:42 +00:00
|
|
|
// Something
|
2019-11-19 23:06:25 +00:00
|
|
|
virtual void PrepareDynamicLights(const std::vector<CLight>& lights) = 0;
|
2015-08-21 00:06:39 +00:00
|
|
|
};
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|