2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CGRAPHICS
|
|
|
|
#define _CGRAPHICS
|
2022-04-10 00:17:06 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
2022-08-13 01:26:00 +00:00
|
|
|
#include "Kyoto/Graphics/CColor.hpp"
|
2022-08-16 02:14:28 +00:00
|
|
|
#include "Kyoto/Math/CTransform4f.hpp"
|
2022-09-18 06:05:46 +00:00
|
|
|
#include "Kyoto/Math/CVector3f.hpp"
|
2022-07-18 22:42:58 +00:00
|
|
|
|
2022-08-09 23:03:51 +00:00
|
|
|
#include "Kyoto/Graphics/CTevCombiners.hpp"
|
2022-07-02 05:30:04 +00:00
|
|
|
|
|
|
|
enum ERglTevStage {
|
|
|
|
kTS_Stage0,
|
|
|
|
kTS_Stage1,
|
|
|
|
kTS_Stage2,
|
|
|
|
kTS_Stage3,
|
|
|
|
kTS_Stage4,
|
|
|
|
kTS_Stage5,
|
|
|
|
kTS_Stage6,
|
|
|
|
kTS_Stage7,
|
|
|
|
kTS_Stage8,
|
|
|
|
kTS_Stage9,
|
|
|
|
kTS_Stage10,
|
|
|
|
kTS_Stage11,
|
|
|
|
kTS_Stage12,
|
|
|
|
kTS_Stage13,
|
|
|
|
kTS_Stage14,
|
|
|
|
kTS_Stage15,
|
|
|
|
kTS_MaxStage,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ERglPrimitive {
|
2022-10-17 02:33:08 +00:00
|
|
|
kP_Quads = GX_QUADS,
|
|
|
|
kP_Triangles = GX_TRIANGLES,
|
|
|
|
kP_TriangleStrip = GX_TRIANGLESTRIP,
|
|
|
|
kP_TriangleFan = GX_TRIANGLEFAN,
|
|
|
|
kP_Lines = GX_LINES,
|
|
|
|
kP_LineStrip = GX_LINESTRIP,
|
|
|
|
kP_Points = GX_POINTS,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ERglBlendMode {
|
|
|
|
kBM_None = GX_BM_NONE,
|
|
|
|
kBM_Blend = GX_BM_BLEND,
|
|
|
|
kBM_Logic = GX_BM_LOGIC,
|
|
|
|
kBM_Subtract = GX_BM_SUBTRACT,
|
|
|
|
kBM_Max = GX_MAX_BLENDMODE,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ERglBlendFactor {
|
|
|
|
kBF_Zero = GX_BL_ZERO,
|
|
|
|
kBF_One = GX_BL_ONE,
|
|
|
|
kBF_SrcColor = GX_BL_SRCCLR,
|
|
|
|
kBF_InvSrcColor = GX_BL_INVSRCCLR,
|
|
|
|
kBF_SrcAlpha = GX_BL_SRCALPHA,
|
|
|
|
kBF_InvSrcAlpha = GX_BL_INVSRCALPHA,
|
|
|
|
kBF_DstAlpha = GX_BL_DSTALPHA,
|
|
|
|
kBF_InvDstAlpha = GX_BL_INVDSTALPHA,
|
|
|
|
kBF_DstColor = GX_BL_DSTCLR,
|
|
|
|
kBF_InvDstColor = GX_BL_INVDSTCLR,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ERglLogicOp {
|
|
|
|
kLO_Clear = GX_LO_CLEAR,
|
|
|
|
kLO_And = GX_LO_AND,
|
|
|
|
kLO_RevAnd = GX_LO_REVAND,
|
|
|
|
kLO_Copy = GX_LO_COPY,
|
|
|
|
kLO_InvAnd = GX_LO_INVAND,
|
|
|
|
kLO_NoOp = GX_LO_NOOP,
|
|
|
|
kLO_Xor = GX_LO_XOR,
|
|
|
|
kLO_Or = GX_LO_OR,
|
|
|
|
kLO_Nor = GX_LO_NOR,
|
|
|
|
kLO_Equiv = GX_LO_EQUIV,
|
|
|
|
kLO_Inv = GX_LO_INV,
|
|
|
|
kLO_RevOr = GX_LO_REVOR,
|
|
|
|
kLO_InvCopy = GX_LO_INVCOPY,
|
|
|
|
kLO_InvOr = GX_LO_INVOR,
|
|
|
|
kLO_NAnd = GX_LO_NAND,
|
|
|
|
kLO_Set = GX_LO_SET,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ERglAlphaFunc {
|
|
|
|
kAF_Never = GX_NEVER,
|
|
|
|
kAF_Less = GX_LESS,
|
|
|
|
kAF_Equal = GX_EQUAL,
|
|
|
|
kAF_LEqual = GX_LEQUAL,
|
|
|
|
kAF_Greater = GX_GREATER,
|
|
|
|
kAF_NEqual = GX_NEQUAL,
|
|
|
|
kAF_GEqual = GX_GEQUAL,
|
|
|
|
kAF_Always = GX_ALWAYS,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ERglAlphaOp {
|
|
|
|
kAO_And = GX_AOP_AND,
|
|
|
|
kAO_Or = GX_AOP_OR,
|
|
|
|
kAO_Xor = GX_AOP_XOR,
|
|
|
|
kAO_XNor = GX_AOP_XNOR,
|
|
|
|
kAO_Max = GX_MAX_ALPHAOP,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ERglEnum {
|
|
|
|
kE_Never = GX_NEVER,
|
|
|
|
kE_Less = GX_LESS,
|
|
|
|
kE_Equal = GX_EQUAL,
|
|
|
|
kE_LEqual = GX_LEQUAL,
|
|
|
|
kE_Greater = GX_GREATER,
|
|
|
|
kE_NEqual = GX_NEQUAL,
|
|
|
|
kE_GEqual = GX_GEQUAL,
|
|
|
|
kE_Always = GX_ALWAYS,
|
2022-07-02 05:30:04 +00:00
|
|
|
};
|
|
|
|
|
2022-10-01 06:19:09 +00:00
|
|
|
class CTimeProvider;
|
|
|
|
|
2022-04-10 00:17:06 +00:00
|
|
|
class CGraphics {
|
|
|
|
public:
|
|
|
|
static void SetIsBeginSceneClearFb(bool);
|
|
|
|
static void BeginScene();
|
|
|
|
static void EndScene();
|
2022-07-02 05:30:04 +00:00
|
|
|
static void SetTevOp(ERglTevStage stage, const CTevCombiners::CTevPass& pass);
|
|
|
|
static void StreamBegin(ERglPrimitive primitive);
|
|
|
|
static void StreamColor(const CColor& color);
|
2022-10-09 05:37:23 +00:00
|
|
|
static void StreamTexcoord(float u, float v);
|
2022-07-02 05:30:04 +00:00
|
|
|
static void StreamVertex(const CVector3f& vtx);
|
|
|
|
static void StreamEnd();
|
2022-08-16 02:14:28 +00:00
|
|
|
|
|
|
|
static const CTransform4f& GetViewMatrix() { return mViewMatrix; }
|
2022-09-05 04:00:04 +00:00
|
|
|
static const CTransform4f& GetModelMatrix() { return mModelMatrix; }
|
|
|
|
|
|
|
|
static float GetSecondsMod900();
|
2022-09-14 05:53:26 +00:00
|
|
|
static void SetExternalTimeProvider(CTimeProvider* provider);
|
2022-10-04 19:58:17 +00:00
|
|
|
static void DisableAllLights();
|
2022-08-16 02:14:28 +00:00
|
|
|
|
2022-10-17 02:33:08 +00:00
|
|
|
static void SetModelMatrix(const CTransform4f& xf);
|
|
|
|
static void SetAlphaCompare(ERglAlphaFunc comp0, u8 ref0, ERglAlphaOp op, ERglAlphaFunc comp1,
|
|
|
|
u8 ref1);
|
|
|
|
static void SetDepthWriteMode(bool test, ERglEnum comp, bool write);
|
|
|
|
static void SetBlendMode(ERglBlendMode, ERglBlendFactor, ERglBlendFactor, ERglLogicOp);
|
|
|
|
|
|
|
|
static CTevCombiners::CTevPass& kEnvPassThru;
|
|
|
|
static CTevCombiners::CTevPass kEnvModulateConstColor;
|
|
|
|
static CTevCombiners::CTevPass kEnvConstColor;
|
|
|
|
static CTevCombiners::CTevPass kEnvModulate;
|
|
|
|
static CTevCombiners::CTevPass kEnvDecal;
|
|
|
|
static CTevCombiners::CTevPass kEnvBlend;
|
|
|
|
static CTevCombiners::CTevPass kEnvReplace;
|
|
|
|
static CTevCombiners::CTevPass kEnvModulateAlpha;
|
|
|
|
static CTevCombiners::CTevPass kEnvModulateColor;
|
|
|
|
static CTevCombiners::CTevPass kEnvModulateColorByalpha;
|
|
|
|
|
2022-08-16 02:14:28 +00:00
|
|
|
private:
|
|
|
|
static CTransform4f mViewMatrix;
|
2022-09-05 04:00:04 +00:00
|
|
|
static CTransform4f mModelMatrix;
|
2022-04-10 00:17:06 +00:00
|
|
|
};
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CGRAPHICS
|