2014-11-22 12:32:56 +00:00
|
|
|
#ifndef polymost_h_
|
|
|
|
# define polymost_h_
|
2006-08-30 23:32:39 +00:00
|
|
|
|
|
|
|
|
2018-11-18 18:09:48 +00:00
|
|
|
#include "baselayer.h" // glinfo
|
2009-08-09 05:32:17 +00:00
|
|
|
#include "hightile.h"
|
2019-09-19 20:02:45 +00:00
|
|
|
#include "mdsprite.h"
|
2009-08-09 05:32:17 +00:00
|
|
|
|
2019-09-13 20:18:37 +00:00
|
|
|
void Polymost_CacheHitList(uint8_t* hash);
|
|
|
|
|
2014-09-30 04:17:37 +00:00
|
|
|
typedef struct { uint8_t r, g, b, a; } coltype;
|
2015-03-24 00:40:48 +00:00
|
|
|
typedef struct { float r, g, b, a; } coltypef;
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2019-09-18 22:19:02 +00:00
|
|
|
extern bool playing_rr;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t rendmode;
|
2008-12-02 10:44:39 +00:00
|
|
|
extern float gtang;
|
|
|
|
extern float glox1, gloy1;
|
2019-03-19 17:08:05 +00:00
|
|
|
extern double gxyaspect;
|
|
|
|
extern float grhalfxdown10x;
|
2014-09-30 04:06:05 +00:00
|
|
|
extern float gcosang, gsinang, gcosang2, gsinang2;
|
|
|
|
extern float gchang, gshang, gctang, gstang, gvisibility;
|
2019-08-07 22:44:33 +00:00
|
|
|
extern float gvrcorrection;
|
2008-12-02 10:44:39 +00:00
|
|
|
|
|
|
|
struct glfiltermodes {
|
2018-10-07 05:20:52 +00:00
|
|
|
const char *name;
|
2006-08-30 23:32:39 +00:00
|
|
|
};
|
2012-10-01 17:52:25 +00:00
|
|
|
#define NUMGLFILTERMODES 6
|
|
|
|
extern struct glfiltermodes glfiltermodes[NUMGLFILTERMODES];
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2016-10-24 21:30:34 +00:00
|
|
|
extern void Polymost_prepare_loadboard(void);
|
|
|
|
|
2019-05-25 14:59:09 +00:00
|
|
|
void polymost_outputGLDebugMessage(uint8_t severity, const char* format, ...);
|
2019-09-13 20:18:37 +00:00
|
|
|
|
2012-01-12 20:47:41 +00:00
|
|
|
//void phex(char v, char *s);
|
2019-10-06 17:32:35 +00:00
|
|
|
void uploadbasepalette(int32_t basepalnum, bool transient = false);
|
2019-10-06 17:47:31 +00:00
|
|
|
void uploadpalswaps(int count, int32_t *palookupnum);
|
2009-01-09 09:29:17 +00:00
|
|
|
void polymost_drawsprite(int32_t snum);
|
|
|
|
void polymost_drawmaskwall(int32_t damaskwallcnt);
|
|
|
|
void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
2019-09-22 21:15:46 +00:00
|
|
|
int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, int32_t uniqid);
|
2009-01-09 09:29:17 +00:00
|
|
|
void polymost_fillpolygon(int32_t npoints);
|
2008-12-02 10:44:39 +00:00
|
|
|
void polymost_initosdfuncs(void);
|
|
|
|
void polymost_drawrooms(void);
|
2019-06-25 18:35:16 +00:00
|
|
|
void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fix16_t daang, fix16_t dahoriz, int16_t mirrorWall);
|
|
|
|
void polymost_completeMirror();
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2019-04-19 21:45:22 +00:00
|
|
|
int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall);
|
|
|
|
int32_t polymost_spriteHasTranslucency(uspritetype const * const tspr);
|
|
|
|
|
2019-08-07 22:44:33 +00:00
|
|
|
float* multiplyMatrix4f(float m0[4*4], const float m1[4*4]);
|
|
|
|
|
2008-12-02 10:44:39 +00:00
|
|
|
void polymost_glinit(void);
|
|
|
|
void polymost_glreset(void);
|
|
|
|
|
2013-05-15 02:20:08 +00:00
|
|
|
enum {
|
|
|
|
INVALIDATE_ALL,
|
2018-03-21 20:41:26 +00:00
|
|
|
INVALIDATE_ART,
|
|
|
|
INVALIDATE_ALL_NON_INDEXED,
|
|
|
|
INVALIDATE_ART_NON_INDEXED
|
2013-05-15 02:20:08 +00:00
|
|
|
};
|
|
|
|
|
2010-05-18 05:14:17 +00:00
|
|
|
int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize);
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2009-02-02 01:49:14 +00:00
|
|
|
extern float curpolygonoffset;
|
|
|
|
|
2008-12-02 10:44:39 +00:00
|
|
|
extern float shadescale;
|
2011-03-17 23:37:38 +00:00
|
|
|
extern int32_t shadescale_unbounded;
|
2015-03-24 00:40:33 +00:00
|
|
|
extern uint8_t alphahackarray[MAXTILES];
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2019-10-10 19:05:10 +00:00
|
|
|
extern int32_t r_scenebrightness;
|
2019-09-19 20:02:45 +00:00
|
|
|
extern int32_t polymostcenterhoriz;
|
2011-07-24 15:15:57 +00:00
|
|
|
|
2013-05-15 02:19:14 +00:00
|
|
|
extern int16_t globalpicnum;
|
|
|
|
|
2014-04-05 11:28:10 +00:00
|
|
|
#define POLYMOST_CHOOSE_FOG_PAL(fogpal, pal) \
|
|
|
|
((fogpal) ? (fogpal) : (pal))
|
2019-04-18 17:25:24 +00:00
|
|
|
static FORCE_INLINE int32_t get_floor_fogpal(usectorptr_t const sec)
|
2014-04-05 11:28:08 +00:00
|
|
|
{
|
2014-04-05 11:28:10 +00:00
|
|
|
return POLYMOST_CHOOSE_FOG_PAL(sec->fogpal, sec->floorpal);
|
2014-04-05 11:28:08 +00:00
|
|
|
}
|
2019-04-18 17:25:24 +00:00
|
|
|
static FORCE_INLINE int32_t get_ceiling_fogpal(usectorptr_t const sec)
|
2014-04-05 11:28:08 +00:00
|
|
|
{
|
2014-04-05 11:28:10 +00:00
|
|
|
return POLYMOST_CHOOSE_FOG_PAL(sec->fogpal, sec->ceilingpal);
|
2014-04-05 11:28:08 +00:00
|
|
|
}
|
2017-12-12 05:14:06 +00:00
|
|
|
static FORCE_INLINE int32_t fogshade(int32_t const shade, int32_t const pal)
|
2014-05-01 22:02:21 +00:00
|
|
|
{
|
2019-10-17 18:29:58 +00:00
|
|
|
return (globalflags & GLOBAL_NO_GL_FOGSHADE) ? 0 : shade;
|
2014-05-01 22:02:21 +00:00
|
|
|
}
|
2014-04-05 11:28:08 +00:00
|
|
|
|
2017-02-25 08:15:53 +00:00
|
|
|
static FORCE_INLINE int check_nonpow2(int32_t const x)
|
2014-05-28 22:40:19 +00:00
|
|
|
{
|
2014-06-01 11:55:19 +00:00
|
|
|
return (x > 1 && (x&(x-1)));
|
|
|
|
}
|
|
|
|
|
2015-03-24 00:40:33 +00:00
|
|
|
static inline float polymost_invsqrt_approximation(float x)
|
2014-09-30 04:17:37 +00:00
|
|
|
{
|
|
|
|
#ifdef B_LITTLE_ENDIAN
|
2015-03-24 00:40:33 +00:00
|
|
|
float const haf = x * .5f;
|
2019-04-20 21:57:05 +00:00
|
|
|
union { float f; uint32_t i; } n = { x };
|
|
|
|
n.i = 0x5f375a86 - (n.i >> 1);
|
|
|
|
return n.f * (1.5f - haf * (n.f * n.f));
|
2014-09-30 04:17:37 +00:00
|
|
|
#else
|
|
|
|
// this is the comment
|
2015-03-24 00:40:33 +00:00
|
|
|
return 1.f / Bsqrtf(x);
|
2014-09-30 04:17:37 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-05-28 22:40:16 +00:00
|
|
|
// Flags of the <dameth> argument of various functions
|
|
|
|
enum {
|
2015-12-04 11:52:54 +00:00
|
|
|
DAMETH_NOMASK = 0,
|
|
|
|
DAMETH_MASK = 1,
|
|
|
|
DAMETH_TRANS1 = 2,
|
|
|
|
DAMETH_TRANS2 = 3,
|
|
|
|
|
|
|
|
DAMETH_MASKPROPS = 3,
|
|
|
|
|
2014-05-28 22:40:16 +00:00
|
|
|
DAMETH_CLAMPED = 4,
|
2019-10-18 12:04:32 +00:00
|
|
|
DAMETH_MODEL = 8,
|
2014-05-28 22:40:16 +00:00
|
|
|
|
2014-06-01 11:55:19 +00:00
|
|
|
DAMETH_WALL = 32, // signals a texture for a wall (for r_npotwallmode)
|
|
|
|
|
2015-12-04 11:52:54 +00:00
|
|
|
// used internally by polymost_domost
|
|
|
|
DAMETH_BACKFACECULL = -1,
|
2014-05-28 22:40:16 +00:00
|
|
|
};
|
|
|
|
|
2015-12-04 11:52:58 +00:00
|
|
|
#define DAMETH_NARROW_MASKPROPS(dameth) (((dameth)&(~DAMETH_TRANS1))|(((dameth)&DAMETH_TRANS1)>>1))
|
|
|
|
EDUKE32_STATIC_ASSERT(DAMETH_NARROW_MASKPROPS(DAMETH_MASKPROPS) == DAMETH_MASK);
|
2016-02-29 06:34:20 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t globalnoeffect;
|
|
|
|
extern int32_t drawingskybox;
|
2013-05-15 02:17:17 +00:00
|
|
|
extern int32_t hicprecaching;
|
2014-10-25 03:32:26 +00:00
|
|
|
extern float fcosglobalang, fsinglobalang;
|
2014-11-28 08:14:00 +00:00
|
|
|
extern float fxdim, fydim, fydimen, fviewingrange;
|
2009-04-24 02:53:50 +00:00
|
|
|
|
2013-05-15 02:17:17 +00:00
|
|
|
extern char ptempbuf[MAXWALLSB<<1];
|
|
|
|
|
2015-07-08 03:34:27 +00:00
|
|
|
extern hitdata_t polymost_hitdata;
|
|
|
|
|
2008-12-02 10:44:39 +00:00
|
|
|
#endif
|