2020-01-23 23:12:15 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
2014-03-15 16:59:03 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
2020-01-23 23:12:15 +00:00
|
|
|
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
2020-01-23 23:12:15 +00:00
|
|
|
// This program is free software distributed under the
|
|
|
|
// terms of the GNU General Public License, version 2.
|
|
|
|
// See the 'LICENSE' file for more details.
|
2014-03-15 16:59:03 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
2020-01-23 23:12:15 +00:00
|
|
|
/// \file hw_defs.h
|
2014-03-15 16:59:03 +00:00
|
|
|
/// \brief 3D hardware renderer definitions
|
|
|
|
|
|
|
|
#ifndef _HWR_DEFS_
|
|
|
|
#define _HWR_DEFS_
|
|
|
|
#include "../doomtype.h"
|
2019-12-25 19:22:01 +00:00
|
|
|
#include "../r_defs.h"
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-03-06 03:48:15 +00:00
|
|
|
#define ZCLIP_PLANE 4.0f // Used for the actual game drawing
|
|
|
|
#define NZCLIP_PLANE 0.9f // Seems to be only used for the HUD and screen textures
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
// SIMPLE TYPES
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
typedef long FINT;
|
|
|
|
typedef unsigned long FUINT;
|
|
|
|
typedef unsigned char FUBYTE;
|
|
|
|
typedef unsigned long FBITFIELD;
|
|
|
|
#ifndef __MINGW32__
|
|
|
|
typedef float FLOAT;
|
|
|
|
#endif
|
|
|
|
typedef unsigned char FBOOLEAN;
|
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
// COLORS
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
// byte value for paletted graphics, which represent the transparent color
|
2015-11-07 19:56:21 +00:00
|
|
|
#define HWR_PATCHES_CHROMAKEY_COLORINDEX 255
|
2019-11-09 17:09:20 +00:00
|
|
|
//#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// the chroma key color shows on border sprites, set it to black
|
|
|
|
#define HWR_PATCHES_CHROMAKEY_COLORVALUE (0x00000000) //RGBA format as in grSstWinOpen()
|
|
|
|
|
|
|
|
// RGBA Color components with float type ranging [ 0 ... 1 ]
|
|
|
|
struct FRGBAFloat
|
|
|
|
{
|
|
|
|
FLOAT red;
|
|
|
|
FLOAT green;
|
|
|
|
FLOAT blue;
|
|
|
|
FLOAT alpha;
|
|
|
|
};
|
|
|
|
typedef struct FRGBAFloat FRGBAFloat;
|
|
|
|
|
|
|
|
struct FColorARGB
|
|
|
|
{
|
|
|
|
FUBYTE alpha;
|
|
|
|
FUBYTE red;
|
|
|
|
FUBYTE green;
|
|
|
|
FUBYTE blue;
|
|
|
|
};
|
|
|
|
typedef struct FColorARGB ARGB_t;
|
|
|
|
typedef struct FColorARGB FColorARGB;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
// VECTORS
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
// Simple 2D coordinate
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
FLOAT x,y;
|
|
|
|
} F2DCoord, v2d_t;
|
|
|
|
|
2019-12-25 19:22:01 +00:00
|
|
|
// ======================
|
|
|
|
// wallVert3D
|
|
|
|
// ----------------------
|
|
|
|
// :crab: IS GONE! :crab:
|
|
|
|
// ======================
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2019-12-25 19:22:01 +00:00
|
|
|
// -----------
|
|
|
|
// structures
|
|
|
|
// -----------
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
//Hurdler: Transform (coords + angles)
|
|
|
|
//BP: transform order : scale(rotation_x(rotation_y(translation(v))))
|
2018-12-19 05:17:51 +00:00
|
|
|
|
|
|
|
// Kart features
|
|
|
|
//#define USE_FTRANSFORM_ANGLEZ
|
|
|
|
//#define USE_FTRANSFORM_MIRROR
|
|
|
|
|
2018-12-19 15:33:13 +00:00
|
|
|
// Vanilla features
|
|
|
|
#define USE_MODEL_NEXTFRAME
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
FLOAT x,y,z; // position
|
2018-12-19 05:17:51 +00:00
|
|
|
#ifdef USE_FTRANSFORM_ANGLEZ
|
2018-12-19 03:50:00 +00:00
|
|
|
FLOAT anglex,angley,anglez; // aimingangle / viewangle
|
2018-12-19 05:17:51 +00:00
|
|
|
#else
|
2014-03-15 16:59:03 +00:00
|
|
|
FLOAT anglex,angley; // aimingangle / viewangle
|
2018-12-19 05:17:51 +00:00
|
|
|
#endif
|
2014-03-15 16:59:03 +00:00
|
|
|
FLOAT scalex,scaley,scalez;
|
|
|
|
FLOAT fovxangle, fovyangle;
|
2018-12-19 03:50:00 +00:00
|
|
|
UINT8 splitscreen;
|
2014-04-07 16:08:04 +00:00
|
|
|
boolean flip; // screenflip
|
2019-08-18 17:16:48 +00:00
|
|
|
boolean roll;
|
2019-11-13 15:36:44 +00:00
|
|
|
SINT8 rollflip;
|
2019-11-13 00:38:02 +00:00
|
|
|
FLOAT rollangle; // done to not override USE_FTRANSFORM_ANGLEZ
|
2019-11-13 15:47:30 +00:00
|
|
|
UINT8 rotaxis;
|
2019-11-13 00:38:02 +00:00
|
|
|
FLOAT centerx, centery;
|
2018-12-19 05:17:51 +00:00
|
|
|
#ifdef USE_FTRANSFORM_MIRROR
|
2018-12-19 03:50:00 +00:00
|
|
|
boolean mirror; // SRB2Kart: Encore Mode
|
2018-12-19 05:17:51 +00:00
|
|
|
#endif
|
2019-12-25 19:22:01 +00:00
|
|
|
boolean shearing; // 14042019
|
2020-01-23 22:44:46 +00:00
|
|
|
float viewaiming; // 17052019
|
2014-03-15 16:59:03 +00:00
|
|
|
} FTransform;
|
|
|
|
|
|
|
|
// Transformed vector, as passed to HWR API
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
FLOAT x,y,z;
|
2019-12-25 19:22:01 +00:00
|
|
|
FLOAT s; // s texture ordinate (s over w)
|
|
|
|
FLOAT t; // t texture ordinate (t over w)
|
2014-03-15 16:59:03 +00:00
|
|
|
} FOutVector;
|
|
|
|
|
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
// RENDER MODES
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
// Flags describing how to render a polygon
|
|
|
|
// You pass a combination of these flags to DrawPolygon()
|
|
|
|
enum EPolyFlags
|
|
|
|
{
|
|
|
|
// the first 5 are mutually exclusive
|
|
|
|
|
|
|
|
PF_Masked = 0x00000001, // Poly is alpha scaled and 0 alpha pels are discarded (holes in texture)
|
|
|
|
PF_Translucent = 0x00000002, // Poly is transparent, alpha = level of transparency
|
2018-03-15 23:58:37 +00:00
|
|
|
PF_Additive = 0x00000004, // Poly is added to the frame buffer
|
2014-03-15 16:59:03 +00:00
|
|
|
PF_Environment = 0x00000008, // Poly should be drawn environment mapped.
|
|
|
|
// Hurdler: used for text drawing
|
|
|
|
PF_Substractive = 0x00000010, // for splat
|
|
|
|
PF_NoAlphaTest = 0x00000020, // hiden param
|
2018-03-15 23:58:37 +00:00
|
|
|
PF_Fog = 0x00000040, // Fog blocks
|
|
|
|
PF_Blending = (PF_Environment|PF_Additive|PF_Translucent|PF_Masked|PF_Substractive|PF_Fog)&~PF_NoAlphaTest,
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// other flag bits
|
|
|
|
|
|
|
|
PF_Occlude = 0x00000100, // Update the depth buffer
|
|
|
|
PF_NoDepthTest = 0x00000200, // Disable the depth test mode
|
|
|
|
PF_Invisible = 0x00000400, // Disable write to color buffer
|
|
|
|
PF_Decal = 0x00000800, // Enable polygon offset
|
|
|
|
PF_Modulated = 0x00001000, // Modulation (multiply output with constant ARGB)
|
2019-12-25 19:22:01 +00:00
|
|
|
// When set, pass the color constant into the FSurfaceInfo -> PolyColor
|
2014-03-15 16:59:03 +00:00
|
|
|
PF_NoTexture = 0x00002000, // Use the small white texture
|
|
|
|
PF_Corona = 0x00004000, // Tell the rendrer we are drawing a corona
|
2019-12-25 19:22:01 +00:00
|
|
|
PF_Ripple = 0x00008000, // Water shader effect
|
2014-03-15 16:59:03 +00:00
|
|
|
PF_RemoveYWrap = 0x00010000, // Force clamp texture on Y
|
|
|
|
PF_ForceWrapX = 0x00020000, // Force repeat texture on X
|
|
|
|
PF_ForceWrapY = 0x00040000, // Force repeat texture on Y
|
|
|
|
PF_Clip = 0x40000000, // clip to frustum and nearz plane (glide only, automatic in opengl)
|
|
|
|
PF_NoZClip = 0x20000000, // in conjonction with PF_Clip
|
|
|
|
PF_Debug = 0x80000000 // print debug message in driver :)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum ESurfFlags
|
|
|
|
{
|
|
|
|
SF_DYNLIGHT = 0x00000001,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ETextureFlags
|
|
|
|
{
|
|
|
|
TF_WRAPX = 0x00000001, // wrap around X
|
|
|
|
TF_WRAPY = 0x00000002, // wrap around Y
|
|
|
|
TF_WRAPXY = TF_WRAPY|TF_WRAPX, // very common so use alias is more easy
|
|
|
|
TF_CHROMAKEYED = 0x00000010,
|
|
|
|
TF_TRANSPARENT = 0x00000040, // texture with some alpha == 0
|
|
|
|
};
|
|
|
|
|
2019-12-25 19:22:01 +00:00
|
|
|
typedef struct GLMipmap_s FTextureInfo;
|
|
|
|
|
|
|
|
// jimita 14032019
|
|
|
|
struct FLightInfo
|
2014-03-15 16:59:03 +00:00
|
|
|
{
|
2019-12-25 19:22:01 +00:00
|
|
|
FUINT light_level;
|
|
|
|
FUINT fade_start;
|
|
|
|
FUINT fade_end;
|
2014-03-15 16:59:03 +00:00
|
|
|
};
|
2019-12-25 19:22:01 +00:00
|
|
|
typedef struct FLightInfo FLightInfo;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Description of a renderable surface
|
|
|
|
struct FSurfaceInfo
|
|
|
|
{
|
2019-12-25 19:22:01 +00:00
|
|
|
FUINT PolyFlags;
|
|
|
|
RGBA_t PolyColor;
|
|
|
|
RGBA_t TintColor;
|
|
|
|
RGBA_t FadeColor;
|
|
|
|
FLightInfo LightInfo; // jimita 14032019
|
2014-03-15 16:59:03 +00:00
|
|
|
};
|
|
|
|
typedef struct FSurfaceInfo FSurfaceInfo;
|
|
|
|
|
2019-12-25 19:22:01 +00:00
|
|
|
#define GL_DEFAULTMIX 0x00000000
|
|
|
|
#define GL_DEFAULTFOG 0xFF000000
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
//Hurdler: added for backward compatibility
|
|
|
|
enum hwdsetspecialstate
|
|
|
|
{
|
2019-12-12 19:48:37 +00:00
|
|
|
HWD_SET_MODEL_LIGHTING = 1,
|
2019-12-25 19:22:01 +00:00
|
|
|
HWD_SET_SHADERS,
|
2014-03-15 16:59:03 +00:00
|
|
|
HWD_SET_TEXTUREFILTERMODE,
|
|
|
|
HWD_SET_TEXTUREANISOTROPICMODE,
|
|
|
|
HWD_NUMSTATE
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum hwdsetspecialstate hwdspecialstate_t;
|
|
|
|
|
2020-01-24 00:25:54 +00:00
|
|
|
// Lactozilla: Shader info
|
|
|
|
// Generally set at the start of the frame.
|
|
|
|
enum hwdshaderinfo
|
|
|
|
{
|
|
|
|
HWD_SHADERINFO_LEVELTIME = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum hwdshaderinfo hwdshaderinfo_t;
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
enum hwdfiltermode
|
|
|
|
{
|
|
|
|
HWD_SET_TEXTUREFILTER_POINTSAMPLED,
|
|
|
|
HWD_SET_TEXTUREFILTER_BILINEAR,
|
|
|
|
HWD_SET_TEXTUREFILTER_TRILINEAR,
|
|
|
|
HWD_SET_TEXTUREFILTER_MIXED1,
|
|
|
|
HWD_SET_TEXTUREFILTER_MIXED2,
|
|
|
|
HWD_SET_TEXTUREFILTER_MIXED3,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //_HWR_DEFS_
|