2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
#ifndef __VIDEO_HPP
|
|
|
|
#define __VIDEO_HPP
|
|
|
|
|
|
|
|
#include <gccore.h>
|
2012-05-06 14:03:43 +02:00
|
|
|
#include <vector>
|
2012-01-21 21:57:41 +01:00
|
|
|
#include "vector.hpp"
|
|
|
|
#include "texture.hpp"
|
|
|
|
|
2012-05-06 14:03:43 +02:00
|
|
|
using namespace std;
|
2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
class CTexCoord
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
public:
|
|
|
|
CTexCoord(void) { x = 0.f; y = 0.f; }
|
|
|
|
CTexCoord(float px, float py) { x = px; y = py; }
|
|
|
|
};
|
|
|
|
|
|
|
|
class CColor : public GXColor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CColor(void) { r = 0; g = 0; b = 0; a = 0xFF; }
|
|
|
|
CColor(u8 pr, u8 pg, u8 pb) { r = pr; g = pg; b = pb; a = 0xFF; }
|
|
|
|
CColor(u8 pr, u8 pg, u8 pb, u8 pa) { r = pr; g = pg; b = pb; a = pa; }
|
|
|
|
CColor(u32 rgba8)
|
|
|
|
{
|
|
|
|
a = (rgba8 & 0xFF000000) >> 24;
|
|
|
|
r = (rgba8 & 0x00FF0000) >> 16;
|
|
|
|
g = (rgba8 & 0x0000FF00) >> 8;
|
|
|
|
b = rgba8 & 0x000000FF;
|
|
|
|
}
|
2012-03-30 13:50:57 +02:00
|
|
|
//int intVal() { return a << 24 | r << 16 | g << 8 | b; }
|
|
|
|
int intVal() { return r << 16 | g << 8 | b; }
|
2012-01-21 21:57:41 +01:00
|
|
|
bool operator==(const CColor &c) const { return c.r == r && c.g == g && c.b == b && c.a == a; }
|
|
|
|
bool operator!=(const CColor &c) const { return c.r != r || c.g != g || c.b != b || c.a != a; }
|
|
|
|
void blend(const CColor &src);
|
|
|
|
static CColor interpolate(const CColor &c1, const CColor &c2, u8 n);
|
|
|
|
};
|
|
|
|
|
|
|
|
class CVideo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CVideo(void);
|
|
|
|
void init(void);
|
|
|
|
void prepare(void);
|
|
|
|
void setAA(u8 aa, bool alpha = false, int width = 0, int height = 0);
|
|
|
|
void prepareAAPass(int aaStep);
|
|
|
|
void render(void);
|
|
|
|
void renderAAPass(int aaStep);
|
|
|
|
void drawAAScene(bool fs = true);
|
2012-12-28 15:19:40 +01:00
|
|
|
void renderToTexture(TexData &tex, bool clear);
|
2012-01-21 21:57:41 +01:00
|
|
|
void cleanup(void);
|
|
|
|
void setup2DProjection(bool setViewPort = true, bool noScale = false);
|
2013-10-03 13:50:34 +02:00
|
|
|
void screensaver(u32 no_input, u32 max_no_input);
|
2012-01-21 21:57:41 +01:00
|
|
|
u32 width(void) const { return m_rmode->fbWidth; }
|
|
|
|
u32 height(void) const { return m_rmode->efbHeight; }
|
2012-07-03 18:26:49 +02:00
|
|
|
GXRModeObj *vid_mode(void) const { return m_rmode; }
|
2012-01-21 21:57:41 +01:00
|
|
|
u32 width2D(void) { return m_width2D; }
|
|
|
|
u32 height2D(void) { return m_height2D; }
|
2018-06-13 17:36:58 +02:00
|
|
|
bool wide(void) const { return m_wide; }// call m_vid.wide to check if wii is widescreen
|
2012-05-11 17:14:57 +02:00
|
|
|
bool vid_50hz(void) const { return m_50hz; }
|
2012-07-06 17:56:46 +02:00
|
|
|
u8 getAA(void) const { return m_aa; }
|
2013-12-07 13:33:27 +01:00
|
|
|
bool showingWaitMessage() { return m_WaitThreadRunning; }
|
2012-01-21 21:57:41 +01:00
|
|
|
void set2DViewport(u32 w, u32 h, int x, int y);
|
|
|
|
void prepareStencil(void);
|
|
|
|
void renderStencil(void);
|
|
|
|
int stencilVal(int x, int y);
|
2018-06-13 17:36:58 +02:00
|
|
|
void setCustomWaitImgs(const char *path, bool loop);
|
2012-01-30 15:29:40 +01:00
|
|
|
void hideWaitMessage();
|
2018-06-27 14:47:03 +02:00
|
|
|
void startImage(void);
|
2012-01-21 21:57:41 +01:00
|
|
|
void waitMessage(float delay);
|
2012-12-28 15:19:40 +01:00
|
|
|
void waitMessage(const vector<TexData> &tex, float delay);
|
|
|
|
void waitMessage(const TexData &tex);
|
2018-06-13 17:36:58 +02:00
|
|
|
s32 TakeScreenshot(const char *path);
|
2012-01-21 21:57:41 +01:00
|
|
|
void shiftViewPort(float x, float y);
|
|
|
|
private:
|
|
|
|
GXRModeObj *m_rmode;
|
|
|
|
void *m_frameBuf[2];
|
|
|
|
int m_curFB;
|
|
|
|
void *m_fifo;
|
2012-05-16 16:48:01 +02:00
|
|
|
void *m_stencil;
|
2012-01-21 21:57:41 +01:00
|
|
|
float m_yScale;
|
|
|
|
u32 m_xfbHeight;
|
|
|
|
bool m_wide;
|
2012-05-11 17:14:57 +02:00
|
|
|
bool m_50hz;
|
2012-01-21 21:57:41 +01:00
|
|
|
u32 m_width2D;
|
|
|
|
u32 m_height2D;
|
|
|
|
int m_x2D;
|
|
|
|
int m_y2D;
|
|
|
|
u8 m_aa;
|
|
|
|
bool m_aaAlpha;
|
|
|
|
int m_aaWidth;
|
|
|
|
int m_aaHeight;
|
2012-11-03 20:16:03 +01:00
|
|
|
u8 *m_aaBuffer[8];
|
2012-01-21 21:57:41 +01:00
|
|
|
u32 m_aaBufferSize[8];
|
2013-09-15 23:22:19 +02:00
|
|
|
u8 m_screensaver_alpha;
|
2012-01-21 21:57:41 +01:00
|
|
|
float m_vpX;
|
|
|
|
float m_vpY;
|
|
|
|
float m_vpW;
|
|
|
|
float m_vpH;
|
|
|
|
float m_waitMessageDelay;
|
2012-09-09 20:35:15 +02:00
|
|
|
volatile bool m_showWaitMessage;
|
2013-12-07 13:33:27 +01:00
|
|
|
volatile bool m_WaitThreadRunning;
|
2012-01-21 21:57:41 +01:00
|
|
|
volatile bool m_showingWaitMessages;
|
2012-12-28 15:19:40 +01:00
|
|
|
vector<TexData> m_waitMessages;
|
2012-01-21 21:57:41 +01:00
|
|
|
//
|
|
|
|
static const int _stencilWidth;
|
|
|
|
static const int _stencilHeight;
|
|
|
|
static const float _jitter2[2][2];
|
|
|
|
static const float _jitter3[3][2];
|
|
|
|
static const float _jitter4[4][2];
|
|
|
|
static const float _jitter5[5][2];
|
|
|
|
static const float _jitter6[6][2];
|
|
|
|
static const float _jitter8[8][2];
|
2014-03-17 18:38:32 +01:00
|
|
|
//thread stack
|
|
|
|
static u8 waitMessageStack[2048];
|
|
|
|
static const u32 waitMessageStackSize;
|
2012-01-21 21:57:41 +01:00
|
|
|
private:
|
|
|
|
void _drawAASceneWithAlpha(float w, float h);
|
|
|
|
void _setViewPort(float x, float y, float w, float h);
|
2012-05-20 18:55:50 +02:00
|
|
|
void _clearScreen();
|
2018-05-29 11:59:57 +02:00
|
|
|
static void * _showWaitMessages(void *obj);
|
2012-01-21 21:57:41 +01:00
|
|
|
private:
|
|
|
|
CVideo(const CVideo &);
|
|
|
|
};
|
|
|
|
|
2012-12-28 15:19:40 +01:00
|
|
|
void DrawTexture(TexData * &tex);
|
2014-03-18 03:39:42 +01:00
|
|
|
void DrawTexturePos(const TexData *tex);
|
2012-11-11 19:28:03 +01:00
|
|
|
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
|
|
|
|
|
2012-10-13 18:57:03 +02:00
|
|
|
extern CVideo m_vid;
|
2012-01-21 21:57:41 +01:00
|
|
|
#endif //!defined(__VIDEO_HPP)
|