2010-07-10 08:20:50 +00:00
|
|
|
/* ZZ Open GL graphics plugin
|
|
|
|
* Copyright (c)2009-2010 zeydlitz@gmail.com, arcum42@gmail.com
|
|
|
|
* Based on Zerofrog's ZeroGS KOSMOS (c)2005-2008
|
2010-03-19 00:31:15 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2010-07-04 22:49:00 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2010-03-19 00:31:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ZEROGS__H
|
|
|
|
#define __ZEROGS__H
|
|
|
|
|
2010-04-03 12:48:27 +00:00
|
|
|
#ifdef _MSC_VER
|
2010-03-19 00:31:15 +00:00
|
|
|
#pragma warning(disable:4200) // nonstandard extension used : zero-sized array in struct/union
|
2010-04-03 12:48:27 +00:00
|
|
|
#endif
|
2010-03-19 00:31:15 +00:00
|
|
|
|
|
|
|
// ----------------------------- Includes
|
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2010-09-20 13:03:40 +00:00
|
|
|
#include <math.h>
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-07-03 06:16:28 +00:00
|
|
|
#include "ZZGl.h"
|
2010-03-19 00:31:15 +00:00
|
|
|
#include "GS.h"
|
2010-06-11 11:48:07 +00:00
|
|
|
#include "CRC.h"
|
2010-10-17 07:57:25 +00:00
|
|
|
#include "targets.h"
|
2010-03-19 00:31:15 +00:00
|
|
|
|
|
|
|
// ------------------------ Variables -------------------------
|
2010-09-15 16:54:19 +00:00
|
|
|
|
2010-03-19 00:31:15 +00:00
|
|
|
//////////////////////////
|
|
|
|
// State parameters
|
2010-07-03 07:57:56 +00:00
|
|
|
|
2010-07-16 03:48:13 +00:00
|
|
|
#ifdef ZEROGS_DEVBUILD
|
2010-03-19 00:31:15 +00:00
|
|
|
extern char* EFFECT_NAME;
|
|
|
|
extern char* EFFECT_DIR;
|
|
|
|
extern u32 g_nGenVars, g_nTexVars, g_nAlphaVars, g_nResolve;
|
|
|
|
extern bool g_bSaveTrans, g_bUpdateEffect, g_bSaveTex, g_bSaveResolved;
|
2010-04-25 00:31:27 +00:00
|
|
|
#endif
|
2010-03-19 00:31:15 +00:00
|
|
|
|
|
|
|
extern int g_nPixelShaderVer;
|
2010-07-03 07:57:56 +00:00
|
|
|
|
2010-03-19 00:31:15 +00:00
|
|
|
extern bool s_bWriteDepth;
|
|
|
|
|
|
|
|
extern int nBackbufferWidth, nBackbufferHeight;
|
2010-07-03 07:57:56 +00:00
|
|
|
|
2010-05-01 22:54:23 +00:00
|
|
|
extern float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
|
|
|
|
extern vector<GLuint> g_vboBuffers; // VBOs for all drawing commands
|
|
|
|
extern GLuint vboRect;
|
|
|
|
extern int g_nCurVBOIndex;
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 22:54:23 +00:00
|
|
|
void ChangeWindowSize(int nNewWidth, int nNewHeight);
|
|
|
|
void SetChangeDeviceSize(int nNewWidth, int nNewHeight);
|
|
|
|
void ChangeDeviceSize(int nNewWidth, int nNewHeight);
|
|
|
|
void SetAA(int mode);
|
|
|
|
void SetCRC(int crc);
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 22:54:23 +00:00
|
|
|
void ReloadEffects();
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 22:54:23 +00:00
|
|
|
// Methods //
|
|
|
|
bool IsGLExt(const char* szTargetExtension); ///< returns true if the the opengl extension is supported
|
|
|
|
inline bool Create_Window(int _width, int _height);
|
2010-10-16 11:54:46 +00:00
|
|
|
bool ZZCreate(int width, int height);
|
|
|
|
void ZZDestroy(bool bD3D);
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-10-16 11:54:46 +00:00
|
|
|
void ZZReset(); // call to destroy video resources
|
|
|
|
void ZZGSStateReset();
|
|
|
|
void ZZGSReset();
|
|
|
|
void ZZGSSoftReset(u32 mask);
|
2010-07-02 12:10:40 +00:00
|
|
|
|
2010-05-01 22:54:23 +00:00
|
|
|
void HandleGLError();
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 22:54:23 +00:00
|
|
|
// called on a primitive switch
|
|
|
|
void Prim();
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 22:54:23 +00:00
|
|
|
void SetTexFlush();
|
|
|
|
// flush current vertices, call before setting new registers (the main render method)
|
|
|
|
void Flush(int context);
|
2010-06-19 05:41:06 +00:00
|
|
|
void FlushBoth();
|
2010-05-01 22:54:23 +00:00
|
|
|
void ExtWrite();
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 22:54:23 +00:00
|
|
|
void SetWriteDepth();
|
|
|
|
bool IsWriteDepth();
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 22:54:23 +00:00
|
|
|
void SetDestAlphaTest();
|
|
|
|
bool IsWriteDestAlphaTest();
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 22:54:23 +00:00
|
|
|
void SetFogColor(u32 fog);
|
2010-07-09 09:26:35 +00:00
|
|
|
void SetFogColor(GIFRegFOGCOL* fog);
|
2010-05-01 22:54:23 +00:00
|
|
|
void SaveTex(tex0Info* ptex, int usevid);
|
|
|
|
char* NamedSaveTex(tex0Info* ptex, int usevid);
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 22:54:23 +00:00
|
|
|
// switches the render target to the real target, flushes the current render targets and renders the real image
|
|
|
|
void RenderCRTC(int interlace);
|
|
|
|
void ResetRenderTarget(int index);
|
2010-03-19 00:31:15 +00:00
|
|
|
|
|
|
|
#endif
|