2007-01-29 01:18:16 +00:00
// here lies the GREAT JUSTICE RENDERER
// TODO :
2008-03-30 11:43:24 +00:00
// - CORE STUFF
2008-05-24 09:37:09 +00:00
// o use BufferData only once for VBOs
2008-03-30 11:43:24 +00:00
// o there's also the texture alignment problem Hunter reported (san andreas fault)
2008-03-30 16:08:18 +00:00
// o also sliding doors are still fucked up sometimes (like under the bar in E1L2)
2008-03-30 11:43:24 +00:00
// o port glowmaps and detail maps from hacked polymost (:(
// o shading needs a lot of work
// o remove all the IM matrix crap and write real functions now that it works
// - SPRITES
// o port sprite panning and fullbrights from hacked polymost (:(
// - SKIES
// o figure a better way to handle ART skies - maybe add symetric caps that would fade to black like a big gem or something wow this is a long column lol ;0)
// o implement polymost skyboxes
// - MDSPRITES
2008-05-24 09:37:09 +00:00
// o need to truly convert MD2s to MD3s with proper scale offset to just dump the data into VRAM
2008-03-30 11:43:24 +00:00
// o need full translation and rotation support from CON to attach to game world or tags
// o need to put frames into VBOs and blend between them
//
// the renderer should hopefully be pretty solid after all that
// the rest will be a bliss :)
2007-01-29 01:18:16 +00:00
# ifndef _polymer_h_
# define _polymer_h_
# include "compat.h"
# include "build.h"
# include "glbuild.h"
# include "osd.h"
# include "polymost.h"
2008-05-05 09:05:07 +00:00
# include "mdsprite.h"
2006-09-27 17:55:49 +00:00
# include "pragmas.h"
2007-07-01 06:32:03 +00:00
# include <math.h>
2007-01-29 01:18:16 +00:00
// CVARS
2008-03-26 09:24:25 +00:00
extern int pr_occlusionculling ;
2007-01-29 01:18:16 +00:00
extern int pr_fov ;
2008-04-04 08:07:11 +00:00
extern int pr_billboardingmode ;
2007-01-29 01:18:16 +00:00
extern int pr_verbosity ;
extern int pr_wireframe ;
2008-05-24 09:37:09 +00:00
extern int pr_vbos ;
2007-01-29 01:18:16 +00:00
2008-03-30 09:16:39 +00:00
extern int glerror ;
2008-05-18 07:35:35 +00:00
2007-01-29 01:18:16 +00:00
// DATA
2008-05-18 07:35:35 +00:00
typedef struct s_prplane {
2006-09-27 17:55:49 +00:00
// geometry
2008-05-18 07:35:35 +00:00
GLfloat * buffer ;
GLuint vbo ;
2006-09-29 21:36:12 +00:00
// attributes
2008-05-18 07:35:35 +00:00
GLdouble plane [ 4 ] ;
GLfloat color [ 4 ] ;
GLuint glpic ;
GLuint fbglpic ;
2006-09-27 17:55:49 +00:00
// elements
2008-05-18 07:35:35 +00:00
GLushort * indices ;
GLuint ivbo ;
} _prplane ;
typedef struct s_prsector {
// polymer data
GLdouble * verts ;
_prplane floor ;
_prplane ceil ;
2006-09-27 02:23:27 +00:00
short curindice ;
2006-09-27 17:55:49 +00:00
int indicescount ;
2008-03-30 14:22:03 +00:00
// stuff
float wallsproffset ;
float floorsproffset ;
2008-04-02 06:58:26 +00:00
// build sector data
int ceilingz , floorz ;
short ceilingstat , floorstat ;
short ceilingpicnum , ceilingheinum ;
signed char ceilingshade ;
char ceilingpal , ceilingxpanning , ceilingypanning ;
short floorpicnum , floorheinum ;
signed char floorshade ;
char floorpal , floorxpanning , floorypanning ;
2006-09-27 17:55:49 +00:00
2008-04-02 08:49:21 +00:00
char controlstate ; // 1: up to date, 2: just allocated
unsigned int invalidid ;
2006-09-27 02:23:27 +00:00
} _prsector ;
2006-09-29 21:36:12 +00:00
typedef struct s_prwall {
2008-05-18 07:35:35 +00:00
_prplane wall ;
_prplane over ;
_prplane mask ;
// stuff
2008-04-03 06:58:36 +00:00
GLfloat * bigportal ;
2008-04-12 08:16:01 +00:00
GLfloat * cap ;
2008-05-24 09:37:09 +00:00
GLuint stuffvbo ;
2008-04-09 07:27:17 +00:00
// build wall data
2008-04-02 08:49:21 +00:00
short cstat , nwallcstat ;
short picnum , overpicnum , nwallpicnum ;
signed char shade ;
char pal , xrepeat , yrepeat , xpanning , ypanning ;
char nwallxpanning , nwallypanning ;
2006-09-29 21:36:12 +00:00
char underover ;
2008-04-02 08:49:21 +00:00
unsigned int invalidid ;
2008-03-30 19:13:24 +00:00
char controlstate ;
2006-09-29 21:36:12 +00:00
} _prwall ;
2008-04-06 23:35:48 +00:00
typedef struct s_pranimatespritesinfo {
animatespritesptr animatesprites ;
int x , y , a , smoothratio ;
} _pranimatespritesinfo ;
2006-10-14 23:33:10 +00:00
2007-01-29 01:18:16 +00:00
extern _prsector * prsectors [ MAXSECTORS ] ;
extern _prwall * prwalls [ MAXWALLS ] ;
// CONTROL
2006-10-15 18:51:41 +00:00
extern int updatesectors ;
2007-01-29 01:18:16 +00:00
2006-09-29 21:36:12 +00:00
// EXTERNAL FUNCTIONS
int polymer_init ( void ) ;
void polymer_glinit ( void ) ;
void polymer_loadboard ( void ) ;
2008-03-25 09:21:18 +00:00
void polymer_drawrooms ( int daposx , int daposy , int daposz , short daang , int dahoriz , short dacursectnum ) ;
2008-03-30 09:16:39 +00:00
void polymer_drawmasks ( void ) ;
2007-12-12 17:42:14 +00:00
void polymer_rotatesprite ( int sx , int sy , int z , short a , short picnum , signed char dashade , char dapalnum , char dastat , int cx1 , int cy1 , int cx2 , int cy2 ) ;
void polymer_drawmaskwall ( int damaskwallcnt ) ;
void polymer_drawsprite ( int snum ) ;
2008-04-02 09:29:58 +00:00
# ifdef POLYMER_C
2008-04-06 23:35:48 +00:00
extern int globalposx , globalposy , globalposz , globalhoriz ;
2008-04-10 08:24:06 +00:00
extern short globalang , globalcursectnum ;
extern int globalpal , cosglobalang , singlobalang ;
extern int cosviewingrangeglobalang , sinviewingrangeglobalang ;
2008-04-06 23:35:48 +00:00
2008-04-06 03:00:39 +00:00
// CORE
static void polymer_displayrooms ( short sectnum ) ;
2008-05-18 07:35:35 +00:00
static void polymer_drawplane ( short sectnum , short wallnum , _prplane * plane , int indicecount ) ;
2008-04-09 07:27:17 +00:00
static void polymer_inb4mirror ( GLfloat * buffer , GLdouble * plane ) ;
2008-04-06 23:35:48 +00:00
static void polymer_animatesprites ( void ) ;
2006-10-15 18:51:41 +00:00
// SECTORS
2008-04-02 09:29:58 +00:00
static int polymer_initsector ( short sectnum ) ;
static int polymer_updatesector ( short sectnum ) ;
2006-09-29 21:36:12 +00:00
void PR_CALLBACK polymer_tesserror ( GLenum error ) ;
void PR_CALLBACK polymer_tessedgeflag ( GLenum error ) ;
void PR_CALLBACK polymer_tessvertex ( void * vertex , void * sector ) ;
2008-04-02 09:29:58 +00:00
static int polymer_buildfloor ( short sectnum ) ;
static void polymer_drawsector ( short sectnum ) ;
2006-10-15 18:51:41 +00:00
// WALLS
2008-04-02 09:29:58 +00:00
static int polymer_initwall ( short wallnum ) ;
static void polymer_updatewall ( short wallnum ) ;
2008-04-09 07:27:17 +00:00
static void polymer_drawwall ( short sectnum , short wallnum ) ;
2006-10-14 23:33:10 +00:00
// HSR
2008-04-10 08:39:05 +00:00
static void polymer_buffertoplane ( GLfloat * buffer , GLushort * indices , int indicecount , GLdouble * plane ) ;
2008-04-06 23:35:48 +00:00
static void polymer_crossproduct ( GLfloat * in_a , GLfloat * in_b , GLdouble * out ) ;
2008-04-02 09:29:58 +00:00
static void polymer_pokesector ( short sectnum ) ;
2008-04-06 03:00:39 +00:00
static void polymer_extractfrustum ( GLdouble * modelview , GLdouble * projection , float * frustum ) ;
static int polymer_portalinfrustum ( short wallnum , float * frustum ) ;
2008-04-06 23:35:48 +00:00
static void polymer_scansprites ( short sectnum , spritetype * tsprite , int * spritesortcnt ) ;
2006-10-18 03:59:28 +00:00
// SKIES
2008-04-02 09:29:58 +00:00
static void polymer_initskybox ( void ) ;
static void polymer_getsky ( void ) ;
static void polymer_drawskyquad ( int p1 , int p2 , GLfloat height ) ;
static void polymer_drawartsky ( short tilenum ) ;
2008-05-05 09:05:07 +00:00
# endif // !POLYMER_C
2007-01-29 01:18:16 +00:00
# endif // !_polymer_h_