2004-08-22 22:29:09 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
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
2021-11-03 20:30:40 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2004-08-22 22:29:09 +00:00
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
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
# ifndef __MODEL__
# define __MODEL__
2020-11-04 10:19:30 +00:00
# include "../client/modelgen.h"
# include "../client/spritegn.h"
2004-08-22 22:29:09 +00:00
struct hull_s ;
struct trace_s ;
2009-11-04 21:16:50 +00:00
struct wedict_s ;
struct model_s ;
struct world_s ;
2013-10-08 14:28:11 +00:00
struct dlight_s ;
2015-05-03 20:31:30 +00:00
typedef struct builddata_s builddata_t ;
2021-08-23 06:36:32 +00:00
typedef struct bspx_header_s bspx_header_t ;
2004-08-22 22:29:09 +00:00
2010-08-28 17:14:38 +00:00
typedef enum {
SHADER_SORT_NONE ,
2012-05-14 01:41:08 +00:00
SHADER_SORT_RIPPLE ,
2017-10-31 22:52:58 +00:00
SHADER_SORT_DEFERREDLIGHT ,
2010-08-28 17:14:38 +00:00
SHADER_SORT_PORTAL ,
SHADER_SORT_SKY ,
SHADER_SORT_OPAQUE ,
2016-02-15 06:01:17 +00:00
//fixme: occlusion tests
2010-08-28 17:14:38 +00:00
SHADER_SORT_DECAL ,
SHADER_SORT_SEETHROUGH ,
2017-03-27 22:57:54 +00:00
//then rtlights are drawn
SHADER_SORT_UNLITDECAL ,
2010-08-28 17:14:38 +00:00
SHADER_SORT_BANNER ,
SHADER_SORT_UNDERWATER ,
SHADER_SORT_BLEND ,
SHADER_SORT_ADDITIVE ,
SHADER_SORT_NEAREST ,
SHADER_SORT_COUNT
} shadersort_t ;
2007-05-25 22:16:29 +00:00
2019-03-12 05:04:27 +00:00
# ifdef FTE_TARGET_WEB
2014-03-30 08:55:06 +00:00
# define MAX_BONES 256
2020-06-12 23:29:58 +00:00
# elif defined(IQMTOOL)
# define MAX_BONES 8192
2019-03-12 05:04:27 +00:00
# else
# define MAX_BONES 256 //Note: there's lots of bone data allocated on the stack, so don't bump recklessly.
# endif
# if MAX_BONES>65536
# define GL_BONE_INDEX_TYPE GL_UNSIGNED_INT
typedef unsigned int boneidx_t ;
# elif MAX_BONES>256
# define GL_BONE_INDEX_TYPE GL_UNSIGNED_SHORT
typedef unsigned short boneidx_t ;
# else
# define GL_BONE_INDEX_TYPE GL_UNSIGNED_BYTE
typedef unsigned char boneidx_t ;
# endif
typedef boneidx_t bone_vec4_t [ 4 ] ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
struct doll_s ;
2016-07-21 19:27:59 +00:00
void rag_uninstanciateall ( void ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
void rag_flushdolls ( qboolean force ) ;
void rag_freedoll ( struct doll_s * doll ) ;
2014-03-30 08:55:06 +00:00
struct doll_s * rag_createdollfromstring ( struct model_s * mod , const char * fname , int numbones , const char * file ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
struct world_s ;
void rag_doallanimations ( struct world_s * world ) ;
void rag_removedeltaent ( lerpents_t * le ) ;
2017-01-13 00:39:50 +00:00
void rag_updatedeltaent ( struct world_s * w , entity_t * ent , lerpents_t * le ) ;
2016-07-12 00:40:13 +00:00
void rag_lerpdeltaent ( lerpents_t * le , unsigned int bonecount , short * newstate , float frac , short * oldstate ) ;
2017-01-13 00:39:50 +00:00
void skel_reset ( struct world_s * world ) ;
2011-07-30 14:14:56 +00:00
2004-08-22 22:29:09 +00:00
typedef struct mesh_s
{
2010-07-11 02:22:39 +00:00
int numvertexes ;
int numindexes ;
/*position within its vbo*/
2009-05-24 10:11:17 +00:00
unsigned int vbofirstvert ;
unsigned int vbofirstelement ;
2012-08-04 01:35:52 +00:00
/*
FIXME : move most of this stuff out into a vbo struct
*/
2012-04-24 07:59:11 +00:00
float xyz_blendw [ 2 ] ;
2010-07-11 02:22:39 +00:00
/*arrays used for rendering*/
2009-11-04 21:16:50 +00:00
vecV_t * xyz_array ;
2012-04-24 07:59:11 +00:00
vecV_t * xyz2_array ;
2010-07-11 02:22:39 +00:00
vec3_t * normals_array ; /*required for lighting*/
vec3_t * snormals_array ; /*required for rtlighting*/
vec3_t * tnormals_array ; /*required for rtlighting*/
vec2_t * st_array ; /*texture coords*/
2013-10-08 14:28:11 +00:00
vec2_t * lmst_array [ MAXRLIGHTMAPS ] ; /*second texturecoord set (merely dubbed lightmap, one for each potential lightstyle)*/
avec4_t * colors4f_array [ MAXRLIGHTMAPS ] ; /*floating point colours array*/
2010-07-11 02:22:39 +00:00
byte_vec4_t * colors4b_array ; /*byte colours array*/
2009-05-24 10:11:17 +00:00
2004-10-19 16:10:14 +00:00
index_t * indexes ;
2010-07-11 02:22:39 +00:00
//required for shadow volumes
2004-08-22 22:29:09 +00:00
int * trneighbors ;
vec3_t * trnormals ;
2010-07-11 02:22:39 +00:00
qboolean istrifan ; /*if its a fan/poly/single quad (permits optimisations)*/
2014-03-30 08:55:06 +00:00
const float * bones ;
2011-07-30 14:14:56 +00:00
int numbones ;
2019-03-12 05:04:27 +00:00
bone_vec4_t * bonenums ;
2011-07-30 14:14:56 +00:00
vec4_t * boneweights ;
2004-08-22 22:29:09 +00:00
} mesh_t ;
2010-11-02 23:17:25 +00:00
/*
batches are generated for each shader / ent as required .
once a batch is known to the backend for that frame , its shader , vbo , ent , lightmap , textures may not be changed until the frame has finished rendering . This is to potentially permit caching .
*/
2010-07-11 02:22:39 +00:00
typedef struct batch_s
{
mesh_t * * mesh ; /*list must be long enough for all surfaces that will form part of this batch times two, for mirrors/portals*/
struct batch_s * next ;
2013-12-29 22:48:28 +00:00
unsigned int meshes ;
unsigned int firstmesh ;
2004-08-22 22:29:09 +00:00
2010-07-11 02:22:39 +00:00
shader_t * shader ;
struct vbo_s * vbo ;
2010-11-02 23:17:25 +00:00
entity_t * ent ; /*used for shader properties*/
2012-10-08 04:36:10 +00:00
struct mfog_s * fog ;
2018-07-22 11:49:37 +00:00
image_t * envmap ;
2010-08-28 17:14:38 +00:00
2013-10-08 14:28:11 +00:00
short lightmap [ MAXRLIGHTMAPS ] ; /*used for shader lightmap textures*/
2019-09-10 15:40:04 +00:00
lightstyleindex_t lmlightstyle [ MAXRLIGHTMAPS ] ;
2013-10-08 14:28:11 +00:00
unsigned char vtlightstyle [ MAXRLIGHTMAPS ] ;
2013-08-27 13:18:09 +00:00
2010-11-02 23:17:25 +00:00
unsigned int maxmeshes ; /*not used by backend*/
unsigned int flags ; /*backend flags (force transparency etc)*/
2013-08-27 13:18:09 +00:00
struct texture_s * texture ; /*is this used by the backend?*/
struct texnums_s * skin ;
2010-08-28 17:14:38 +00:00
void ( * buildmeshes ) ( struct batch_s * b ) ;
2013-12-29 22:48:28 +00:00
# if R_MAX_RECURSE > 2
unsigned int recursefirst [ R_MAX_RECURSE - 2 ] ; //fixme: should thih, firstmesh, and meshes be made ushorts?
# endif
2010-11-02 23:17:25 +00:00
/*caller-use, not interpreted by backend*/
union
{
2015-10-11 11:34:58 +00:00
struct
{
2020-08-13 08:39:48 +00:00
unsigned int ebobatch ; //temporal scene cache stuff, basically just a simple index so we don't have to deal with shader sort values when generating new index lists.
2021-06-25 18:50:53 +00:00
unsigned int shadowbatch ; //a unique index to accelerate shadowmesh generation (dlights, yay!)
2020-08-13 08:39:48 +00:00
// } bmodel;
// struct
// {
vec4_t plane ; /*used only at load (for portal surfaces, so multiple planes are not part of the same batch)*/
} bmodel ; //bmodel surfaces.
struct
2010-11-02 23:17:25 +00:00
{
2020-08-13 08:39:48 +00:00
unsigned int lightidx ;
unsigned int lightmode ;
} dlight ; //deferred light batches
struct
{
unsigned short surfrefs [ sizeof ( mesh_t ) / sizeof ( unsigned short ) ] ; //for hlmdl batching...
} alias ;
struct
{
unsigned int surface ;
} poly ;
/* struct
{
unsigned int first ;
unsigned int count ;
} surf ; */
2020-04-19 01:23:32 +00:00
struct
{
2021-06-25 18:50:53 +00:00
unsigned int ebobatch ; //temporal scene cache stuff, basically just a simple index so we don't have to deal with shader sort values when generating new index lists.
2020-04-19 01:23:32 +00:00
mesh_t meshbuf ;
mesh_t * meshptr ;
} ;
2020-08-13 08:39:48 +00:00
} user ;
2010-07-11 02:22:39 +00:00
} batch_t ;
2004-08-22 22:29:09 +00:00
/*
d * _t structures are on - disk representations
m * _t structures are in - memory
*/
// entity effects
2011-10-27 16:16:29 +00:00
# define EF_BRIGHTFIELD (1<<0)
# define EF_MUZZLEFLASH (1<<1)
# define EF_BRIGHTLIGHT (1<<2)
# define EF_DIMLIGHT (1<<3)
# define QWEF_FLAG1 (1<<4) //only applies to qw player entities
2016-07-12 00:40:13 +00:00
# define NQEF_NODRAW (1<<4) //so packet entities are free to get this instead
2021-08-24 06:06:05 +00:00
# define REEF_QUADLIGHT (1<<4)
2011-10-27 16:16:29 +00:00
# define QWEF_FLAG2 (1<<5) //only applies to qw player entities
2016-07-12 00:40:13 +00:00
# define NQEF_ADDITIVE (1<<5) //so packet entities are free to get this instead
2021-08-24 06:06:05 +00:00
# define REEF_PENTLIGHT (1<<5)
2016-07-12 00:40:13 +00:00
# define EF_BLUE (1<<6)
2021-08-24 06:06:05 +00:00
# define REEF_CANDLELIGHT (1<<6)
2016-07-12 00:40:13 +00:00
# define EF_RED (1<<7)
2011-10-27 16:16:29 +00:00
# define H2EF_NODRAW (1<<7) //this is going to get complicated... emulated server side.
2018-10-23 07:09:06 +00:00
# define DPEF_NOGUNBOB (1<<8) //viewmodel attachment does not bob. only applies to viewmodelforclient/RF_WEAPONMODEL
2016-07-12 00:40:13 +00:00
# define EF_FULLBRIGHT (1<<9) //abslight=1
# define DPEF_FLAME (1<<10) //'onfire'
# define DPEF_STARDUST (1<<11) //'showering sparks'
# define EF_NOSHADOW (1<<12) //doesn't cast a shadow
# define EF_NODEPTHTEST (1<<13) //shows through walls.
2015-03-03 07:54:10 +00:00
# define DPEF_SELECTABLE_ (1<<14) //highlights when prydoncursored
# define DPEF_DOUBLESIDED_ (1<<15) //disables culling
# define DPEF_NOSELFSHADOW_ (1<<16) //doesn't cast shadows on any noselfshadow entities.
2015-08-02 19:08:36 +00:00
# define DPEF_DYNAMICMODELLIGHT_ (1<<17) //forces dynamic lights... I have no idea what this is actually needed for.
2016-07-12 00:40:13 +00:00
# define EF_GREEN (1<<18)
# define EF_UNUSED19 (1<<19)
2015-08-02 19:08:36 +00:00
# define EF_RESTARTANIM_BIT (1<<20) //restarts the anim when toggled between states
# define EF_TELEPORT_BIT (1<<21) //disable lerping when toggled between states
2011-10-27 16:16:29 +00:00
# define DPEF_LOWPRECISION (1<<22) //part of the protocol/server, not the client itself.
2013-03-12 22:44:00 +00:00
# define EF_NOMODELFLAGS (1<<23)
2011-10-27 16:16:29 +00:00
# define EF_MF_ROCKET (1<<24)
# define EF_MF_GRENADE (1<<25)
# define EF_MF_GIB (1<<26)
# define EF_MF_ROTATE (1<<27)
# define EF_MF_TRACER (1<<28)
# define EF_MF_ZOMGIB (1u<<29)
# define EF_MF_TRACER2 (1u<<30)
# define EF_MF_TRACER3 (1u<<31)
2004-08-22 22:29:09 +00:00
2015-03-03 07:54:10 +00:00
# define EF_HASPARTICLETRAIL (0xff800000 | EF_BRIGHTFIELD|DPEF_FLAME|DPEF_STARDUST)
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
BRUSH MODELS
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2012-09-30 05:52:03 +00:00
struct mnode_s ;
2017-06-21 01:24:25 +00:00
typedef struct
{
qbyte * buffer ; //reallocated if needed.
size_t buffersize ;
} pvsbuffer_t ;
typedef enum
{
PVM_FAST ,
PVM_MERGE , //merge the pvs bits into the provided buffer
PVM_REPLACE , //return value is guarenteed to be the provided buffer.
} pvsmerge_t ;
2010-08-28 17:14:38 +00:00
typedef struct {
2012-01-17 07:57:46 +00:00
//model is being purged from memory.
2010-08-28 17:14:38 +00:00
void ( * PurgeModel ) ( struct model_s * mod ) ;
2019-07-02 04:12:20 +00:00
unsigned int ( * PointContents ) ( struct model_s * model , const vec3_t axis [ 3 ] , const vec3_t p ) ;
2021-04-14 05:21:04 +00:00
// unsigned int (*BoxContents) (struct model_s *model, int hulloverride, const framestate_t *framestate, const vec3_t axis[3], const vec3_t p, const vec3_t mins, const vec3_t maxs);
2010-08-28 17:14:38 +00:00
//deals with whatever is native for the bsp (gamecode is expected to distinguish this).
2019-07-02 04:12:20 +00:00
qboolean ( * NativeTrace ) ( struct model_s * model , int hulloverride , const framestate_t * framestate , const vec3_t axis [ 3 ] , const vec3_t p1 , const vec3_t p2 , const vec3_t mins , const vec3_t maxs , qboolean capsule , unsigned int against , struct trace_s * trace ) ;
unsigned int ( * NativeContents ) ( struct model_s * model , int hulloverride , const framestate_t * framestate , const vec3_t axis [ 3 ] , const vec3_t p , const vec3_t mins , const vec3_t maxs ) ;
2010-08-28 17:14:38 +00:00
2019-07-02 04:12:20 +00:00
unsigned int ( * FatPVS ) ( struct model_s * model , const vec3_t org , pvsbuffer_t * pvsbuffer , qboolean merge ) ;
qboolean ( * EdictInFatPVS ) ( struct model_s * model , const struct pvscache_s * edict , const qbyte * pvs , const int * areas ) ; //areas[0] is the count of accepted areas, if valid.
void ( * FindTouchedLeafs ) ( struct model_s * model , struct pvscache_s * ent , const vec3_t cullmins , const vec3_t cullmaxs ) ; //edict system as opposed to q2 game dll system.
2010-08-28 17:14:38 +00:00
2019-07-02 04:12:20 +00:00
void ( * LightPointValues ) ( struct model_s * model , const vec3_t point , vec3_t res_diffuse , vec3_t res_ambient , vec3_t res_dir ) ;
2010-08-28 17:14:38 +00:00
void ( * StainNode ) ( struct mnode_s * node , float * parms ) ;
2020-03-25 21:29:30 +00:00
void ( * MarkLights ) ( struct dlight_s * light , dlightbitmask_t bit , struct mnode_s * node ) ;
2010-08-28 17:14:38 +00:00
2019-07-02 04:12:20 +00:00
int ( * ClusterForPoint ) ( struct model_s * model , const vec3_t point , int * areaout ) ; //pvs index (leaf-1 for q1bsp). may be negative (ie: no pvs).
2017-06-21 01:24:25 +00:00
qbyte * ( * ClusterPVS ) ( struct model_s * model , int cluster , pvsbuffer_t * pvsbuffer , pvsmerge_t merge ) ;
2021-11-03 20:30:40 +00:00
qbyte * ( * ClusterPHS ) ( struct model_s * model , int cluster , pvsbuffer_t * pvsbuffer ) ;
2019-07-02 04:12:20 +00:00
qbyte * ( * ClustersInSphere ) ( struct model_s * model , const vec3_t point , float radius , pvsbuffer_t * pvsbuffer , const qbyte * fte_restrict unionwith ) ;
2021-11-03 20:30:40 +00:00
size_t ( * WriteAreaBits ) ( struct model_s * model , qbyte * buffer , size_t maxbytes , int area , qboolean merge ) ; //writes a set of bits valid for a specific viewpoint's area.
qboolean ( * AreasConnected ) ( struct model_s * model , unsigned int area1 , unsigned int area2 ) ; //fails if there's no open doors
void ( * SetAreaPortalState ) ( struct model_s * model , unsigned int portal , unsigned int area1 , unsigned int area2 , qboolean open ) ; //a door moved...
size_t ( * SaveAreaPortalBlob ) ( struct model_s * model , void * * ptr ) ; //for vid_reload to not break portals. dupe the ptrbefore freeing the model.
size_t ( * LoadAreaPortalBlob ) ( struct model_s * model , void * ptr , size_t size ) ; //for vid_reload to not break portals (has refcount info etc).
void ( * PrepareFrame ) ( struct model_s * model , refdef_t * refdef , int area , int clusters [ 2 ] , pvsbuffer_t * vis , qbyte * * entvis_out , qbyte * * surfvis_out ) ;
void ( * GenerateShadowMesh ) ( struct model_s * model , dlight_t * dl , const qbyte * lvis , qbyte * truevis , void ( * callback ) ( struct msurface_s * ) ) ;
void ( * InfoForPoint ) ( struct model_s * model , vec3_t pos , int * area , int * cluster , unsigned int * contentbits ) ;
2010-08-28 17:14:38 +00:00
} modelfuncs_t ;
2004-08-22 22:29:09 +00:00
//
// in memory representation
//
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct
{
vec3_t position ;
} mvertex_t ;
# define SIDE_FRONT 0
# define SIDE_BACK 1
# define SIDE_ON 2
2010-07-11 02:22:39 +00:00
typedef struct vbo_s
2009-07-05 18:45:53 +00:00
{
2011-12-23 03:12:29 +00:00
unsigned int numvisible ;
2010-07-11 02:22:39 +00:00
struct msurface_s * * vislist ;
2011-12-23 03:12:29 +00:00
unsigned int indexcount ;
unsigned int vertcount ;
unsigned int meshcount ;
2009-11-04 21:16:50 +00:00
struct msurface_s * * meshlist ;
2011-12-23 03:12:29 +00:00
vboarray_t indicies ;
2011-02-25 04:22:14 +00:00
void * vertdata ; /*internal use*/
2009-07-05 18:45:53 +00:00
2012-04-24 07:59:11 +00:00
int vao ;
unsigned int vaodynamic ; /*mask of the attributes that are dynamic*/
2013-05-03 04:28:08 +00:00
unsigned int vaoenabled ; /*mask of the attributes *currently* enabled. renderer may change this */
2011-12-23 03:12:29 +00:00
vboarray_t coord ;
2012-04-24 07:59:11 +00:00
vboarray_t coord2 ;
2011-12-23 03:12:29 +00:00
vboarray_t texcoord ;
2013-10-08 14:28:11 +00:00
vboarray_t lmcoord [ MAXRLIGHTMAPS ] ;
2009-07-05 18:45:53 +00:00
2011-12-23 03:12:29 +00:00
vboarray_t normals ;
vboarray_t svector ;
vboarray_t tvector ;
2009-07-25 11:05:06 +00:00
2015-08-28 03:13:45 +00:00
qboolean colours_bytes ;
2013-10-08 14:28:11 +00:00
vboarray_t colours [ MAXRLIGHTMAPS ] ;
2011-07-30 14:14:56 +00:00
2011-12-23 03:12:29 +00:00
vboarray_t bonenums ;
2011-07-30 14:14:56 +00:00
2011-12-23 03:12:29 +00:00
vboarray_t boneweights ;
2011-07-30 14:14:56 +00:00
2016-07-12 00:40:13 +00:00
void * vbomem ;
void * ebomem ;
2011-12-23 03:12:29 +00:00
unsigned int vbobones ;
2014-03-30 08:55:06 +00:00
const float * bones ;
2011-12-23 03:12:29 +00:00
unsigned int numbones ;
2012-05-09 15:30:53 +00:00
struct vbo_s * next ;
2009-07-05 18:45:53 +00:00
} vbo_t ;
2009-11-04 21:16:50 +00:00
void GL_SelectVBO ( int vbo ) ;
void GL_SelectEBO ( int vbo ) ;
2012-11-27 03:23:19 +00:00
void GL_DeselectVAO ( void ) ;
2009-07-05 18:45:53 +00:00
2004-08-22 22:29:09 +00:00
typedef struct texture_s
{
2021-11-03 20:30:40 +00:00
char name [ 128 ] ;
2020-03-07 09:00:40 +00:00
unsigned vwidth , vheight ; //used for lightmap coord generation
2004-08-22 22:29:09 +00:00
2004-10-19 16:10:14 +00:00
struct shader_s * shader ;
2016-10-22 07:06:51 +00:00
char * partname ; //parsed from the worldspawn entity
2009-05-24 10:11:17 +00:00
2019-12-10 14:50:47 +00:00
unsigned int anim_total ; // total tenths in sequence ( 0 = no)
unsigned int anim_min , anim_max ; // time for this frame min <=time< max
2004-08-22 22:29:09 +00:00
struct texture_s * anim_next ; // in the animation sequence
struct texture_s * alternate_anims ; // bmodels in frmae 1 use these
2015-03-03 00:14:43 +00:00
2020-03-07 09:00:40 +00:00
uploadfmt_t srcfmt ;
unsigned int srcwidth , srcheight ; //actual size (updated miptex format)
qbyte * srcdata ; //the different mipmap levels.
qbyte * palette ; //host_basepal or halflife per-texture palette (or null)
2004-08-22 22:29:09 +00:00
} texture_t ;
2009-07-05 18:45:53 +00:00
/*
2009-06-21 17:45:33 +00:00
typedef struct
{
float coord [ 3 ] ;
float texcoord [ 2 ] ;
float lmcoord [ 2 ] ;
2009-05-24 10:11:17 +00:00
2009-07-05 18:45:53 +00:00
float normals [ 3 ] ;
float svector [ 3 ] ;
float tvector [ 3 ] ;
} vbovertex_t ;
*/
2006-06-04 16:02:03 +00:00
# define SURF_DRAWSKYBOX 0x00001
# define SURF_PLANEBACK 0x00002
# define SURF_DRAWSKY 0x00004
# define SURF_DRAWSPRITE 0x00008
2016-12-13 11:50:15 +00:00
# define SURF_DRAWTURB 0x00010 //water warp effect
# define SURF_DRAWTILED 0x00020 //no need for a sw surface cache... (read: no lightmap)
2006-06-04 16:02:03 +00:00
# define SURF_DRAWBACKGROUND 0x00040
# define SURF_UNDERWATER 0x00080
# define SURF_DONTWARP 0x00100
2011-03-24 14:35:24 +00:00
//#define SURF_BULLETEN 0x00200
2006-06-04 16:02:03 +00:00
# define SURF_NOFLAT 0x08000
2004-08-22 22:29:09 +00:00
# define SURF_DRAWALPHA 0x10000
2016-12-13 11:50:15 +00:00
# define SURF_NODRAW 0x20000 //set on non-vertical halflife water submodel surfaces
2004-08-22 22:29:09 +00:00
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct
{
2011-12-05 15:23:40 +00:00
unsigned int v [ 2 ] ;
2004-08-22 22:29:09 +00:00
} medge_t ;
typedef struct mtexinfo_s
{
float vecs [ 2 ] [ 4 ] ;
2015-03-03 00:14:43 +00:00
float vecscale [ 2 ] ;
2004-08-22 22:29:09 +00:00
texture_t * texture ;
int flags ;
//it's a q2 thing.
int numframes ;
struct mtexinfo_s * next ;
} mtexinfo_t ;
2004-09-13 03:20:04 +00:00
# define SPECULAR
# ifdef SPECULAR
# define VERTEXSIZE 10
# else
2004-08-22 22:29:09 +00:00
# define VERTEXSIZE 7
2004-09-13 03:20:04 +00:00
# endif
2004-08-22 22:29:09 +00:00
2004-10-19 16:10:14 +00:00
typedef struct mfog_s
{
2014-10-05 20:04:11 +00:00
char shadername [ MAX_QPATH ] ;
2004-10-19 16:10:14 +00:00
struct shader_s * shader ;
mplane_t * visibleplane ;
int numplanes ;
mplane_t * * planes ;
} mfog_t ;
2018-07-24 13:59:42 +00:00
typedef struct
{
vec3_t origin ;
int cubesize ; //pixels
} denvmap_t ;
2018-07-22 11:49:37 +00:00
typedef struct
{
vec3_t origin ;
int cubesize ; //pixels
2018-07-24 13:59:42 +00:00
texid_t image ;
2018-07-22 11:49:37 +00:00
} menvmap_t ;
2015-03-03 00:14:43 +00:00
# define LMSHIFT_DEFAULT 4
2004-08-22 22:29:09 +00:00
typedef struct msurface_s
{
mplane_t * plane ;
int flags ;
int firstedge ; // look up in model->surfedges[], negative numbers
2015-03-03 00:14:43 +00:00
unsigned short numedges ; // are backwards edges
2004-08-22 22:29:09 +00:00
2015-03-03 00:14:43 +00:00
unsigned short lmshift ; //texels>>lmshift = lightmap samples.
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int texturemins [ 2 ] ;
2004-08-22 22:29:09 +00:00
short extents [ 2 ] ;
2013-10-08 14:28:11 +00:00
unsigned short light_s [ MAXRLIGHTMAPS ] , light_t [ MAXRLIGHTMAPS ] ; // gl lightmap coordinates
2004-08-22 22:29:09 +00:00
2018-07-22 11:49:37 +00:00
image_t * envmap ;
2004-10-19 16:10:14 +00:00
mfog_t * fog ;
2004-08-22 22:29:09 +00:00
mesh_t * mesh ;
2009-11-04 21:16:50 +00:00
2010-07-11 02:22:39 +00:00
batch_t * sbatch ;
2004-08-22 22:29:09 +00:00
mtexinfo_t * texinfo ;
2009-11-04 21:16:50 +00:00
int visframe ; // should be drawn when node is crossed
2020-03-25 21:29:30 +00:00
# ifdef RTLIGHTS
2009-11-04 21:16:50 +00:00
int shadowframe ;
2020-03-25 21:29:30 +00:00
# endif
// int clipcount;
2021-11-03 20:30:40 +00:00
2014-05-10 13:42:13 +00:00
// legacy lighting info
2020-03-25 21:29:30 +00:00
dlightbitmask_t dlightbits ;
2004-08-22 22:29:09 +00:00
int dlightframe ;
2020-03-25 21:29:30 +00:00
qboolean cached_dlight ; // true if dynamic light in cache
2004-08-22 22:29:09 +00:00
2014-05-10 13:42:13 +00:00
//static lighting
2013-10-08 14:28:11 +00:00
int lightmaptexturenums [ MAXRLIGHTMAPS ] ; //rbsp+fbsp formats have multiple lightmaps
2020-03-25 21:29:30 +00:00
lightstyleindex_t styles [ MAXCPULIGHTMAPS ] ;
2013-10-08 14:28:11 +00:00
qbyte vlstyles [ MAXRLIGHTMAPS ] ;
2020-03-25 21:29:30 +00:00
int cached_light [ MAXCPULIGHTMAPS ] ; // values currently used in lightmap
int cached_colour [ MAXCPULIGHTMAPS ] ; // values currently used in lightmap
2004-08-22 22:29:09 +00:00
# ifndef NOSTAINS
qboolean stained ;
# endif
qbyte * samples ; // [numstyles*surfsize]
} msurface_t ;
2021-04-14 05:21:04 +00:00
/*typedef struct mbrush_s
2012-02-27 12:23:15 +00:00
{
struct mbrush_s * next ;
unsigned int contents ;
int numplanes ;
struct mbrushplane_s
{
vec3_t normal ;
float dist ;
} planes [ 1 ] ;
2021-04-14 05:21:04 +00:00
} mbrush_t ; */
2012-02-27 12:23:15 +00:00
2004-08-22 22:29:09 +00:00
typedef struct mnode_s
{
// common with leaf
int contents ; // 0, to differentiate from leafs
int visframe ; // node needs to be traversed if current
int shadowframe ;
2021-11-03 20:30:40 +00:00
2004-08-22 22:29:09 +00:00
float minmaxs [ 6 ] ; // for bounding box culling
struct mnode_s * parent ;
2021-04-14 05:21:04 +00:00
// struct mbrush_s *brushes;
2004-08-22 22:29:09 +00:00
// node specific
mplane_t * plane ;
struct mnode_s * children [ 2 ] ;
2017-02-19 00:15:42 +00:00
# if defined(Q2BSPS) || defined(Q3BSPS) || defined(MAP_PROC)
2004-08-22 22:29:09 +00:00
int childnum [ 2 ] ;
# endif
2011-12-05 15:23:40 +00:00
unsigned int firstsurface ;
unsigned int numsurfaces ;
2004-08-22 22:29:09 +00:00
} mnode_t ;
typedef struct mleaf_s
{
// common with node
int contents ; // wil be a negative contents number
int visframe ; // node needs to be traversed if current
int shadowframe ;
float minmaxs [ 6 ] ; // for bounding box culling
struct mnode_s * parent ;
// leaf specific
qbyte * compressed_vis ;
msurface_t * * firstmarksurface ;
int nummarksurfaces ;
qbyte ambient_sound_level [ NUM_AMBIENTS ] ;
2007-05-25 22:16:29 +00:00
# if defined(Q2BSPS) || defined(Q3BSPS)
int cluster ;
2004-08-22 22:29:09 +00:00
int area ;
2014-02-07 15:39:37 +00:00
unsigned int firstleafbrush ;
unsigned int numleafbrushes ;
2017-02-19 00:15:42 +00:00
# endif
# ifdef Q3BSPS
2014-05-10 13:42:13 +00:00
unsigned int firstleafcmesh ;
unsigned int numleafcmeshes ;
2014-02-07 15:39:37 +00:00
unsigned int firstleafpatch ;
unsigned int numleafpatches ;
2004-08-22 22:29:09 +00:00
# endif
} mleaf_t ;
typedef struct
{
2021-04-14 05:21:04 +00:00
float mins [ 3 ] , maxs [ 3 ] ;
float origin [ 3 ] ;
unsigned int headnode [ MAX_MAP_HULLSM ] ;
unsigned int visleafs ; // not including the solid leaf 0
unsigned int firstface , numfaces ;
qboolean hullavailable [ MAX_MAP_HULLSM ] ;
struct q2cbrush_s * brushes ;
unsigned int numbrushes ;
2004-08-22 22:29:09 +00:00
} mmodel_t ;
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct hull_s
{
2011-06-29 18:39:11 +00:00
mclipnode_t * clipnodes ;
2004-08-22 22:29:09 +00:00
mplane_t * planes ;
int firstclipnode ;
int lastclipnode ;
vec3_t clip_mins ;
vec3_t clip_maxs ;
int available ;
} hull_t ;
2010-07-12 22:46:37 +00:00
void Q1BSP_CheckHullNodes ( hull_t * hull ) ;
2005-08-26 22:56:51 +00:00
void Q1BSP_SetModelFuncs ( struct model_s * mod ) ;
2018-07-24 13:59:42 +00:00
void Q1BSP_LoadBrushes ( struct model_s * model , bspx_header_t * bspx , void * mod_base ) ;
2005-08-26 22:56:51 +00:00
void Q1BSP_Init ( void ) ;
2021-11-03 20:30:40 +00:00
void Q1BSP_GenerateShadowMesh ( struct model_s * model , struct dlight_s * dl , const qbyte * lightvis , qbyte * litvis , void ( * callback ) ( msurface_t * surf ) ) ;
2018-07-24 13:59:42 +00:00
void BSPX_LoadEnvmaps ( struct model_s * mod , bspx_header_t * bspx , void * mod_base ) ;
void * BSPX_FindLump ( bspx_header_t * bspxheader , void * mod_base , char * lumpname , int * lumpsize ) ;
2021-05-28 07:07:48 +00:00
bspx_header_t * BSPX_Setup ( struct model_s * mod , char * filebase , size_t filelen , lump_t * lumps , size_t numlumps ) ;
2005-08-26 22:56:51 +00:00
2015-03-03 00:14:43 +00:00
typedef struct fragmentdecal_s fragmentdecal_t ;
void Fragment_ClipPoly ( fragmentdecal_t * dec , int numverts , float * inverts , shader_t * surfshader ) ;
2016-07-12 00:40:13 +00:00
size_t Fragment_ClipPlaneToBrush ( vecV_t * points , size_t maxpoints , void * planes , size_t planestride , size_t numplanes , vec4_t face ) ;
void Mod_ClipDecal ( struct model_s * mod , vec3_t center , vec3_t normal , vec3_t tangent1 , vec3_t tangent2 , float size , unsigned int surfflagmask , unsigned int surflagmatch , void ( * callback ) ( void * ctx , vec3_t * fte_restrict points , size_t numpoints , shader_t * shader ) , void * ctx ) ;
2009-11-04 21:16:50 +00:00
2020-03-25 21:29:30 +00:00
void Q1BSP_MarkLights ( dlight_t * light , dlightbitmask_t bit , mnode_t * node ) ;
2019-07-02 04:12:20 +00:00
void GLQ1BSP_LightPointValues ( struct model_s * model , const vec3_t point , vec3_t res_diffuse , vec3_t res_ambient , vec3_t res_dir ) ;
qboolean Q1BSP_RecursiveHullCheck ( hull_t * hull , int num , const vec3_t p1 , const vec3_t p2 , unsigned int hitcontents , struct trace_s * trace ) ;
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
SPRITE MODELS
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
// FIXME: shorten these?
typedef struct mspriteframe_s
{
2009-04-01 22:03:56 +00:00
float up , down , left , right ;
2017-07-13 10:44:54 +00:00
qboolean xmirror ;
2022-01-17 09:13:05 +00:00
qboolean lit ;
2009-11-04 21:16:50 +00:00
shader_t * shader ;
2014-10-05 20:04:11 +00:00
image_t * image ;
2004-08-22 22:29:09 +00:00
} mspriteframe_t ;
2007-07-23 11:51:57 +00:00
mspriteframe_t * R_GetSpriteFrame ( entity_t * currententity ) ;
2004-08-22 22:29:09 +00:00
typedef struct
{
int numframes ;
float * intervals ;
mspriteframe_t * frames [ 1 ] ;
} mspritegroup_t ;
typedef struct
{
spriteframetype_t type ;
mspriteframe_t * frameptr ;
} mspriteframedesc_t ;
typedef struct
{
int type ;
int maxwidth ;
int maxheight ;
int numframes ;
float beamlength ; // remove?
mspriteframedesc_t frames [ 1 ] ;
} msprite_t ;
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
ALIAS MODELS
Alias models are position independent , so the cache manager can move them .
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2009-11-04 21:16:50 +00:00
#if 0
2004-08-22 22:29:09 +00:00
typedef struct {
int s ;
int t ;
} mstvert_t ;
typedef struct
{
int firstpose ;
int numposes ;
float interval ;
dtrivertx_t bboxmin ;
dtrivertx_t bboxmax ;
2021-11-03 20:30:40 +00:00
2004-08-22 22:29:09 +00:00
vec3_t scale ;
vec3_t scale_origin ;
int frame ;
char name [ 16 ] ;
} maliasframedesc_t ;
typedef struct
{
dtrivertx_t bboxmin ;
dtrivertx_t bboxmax ;
int frame ;
} maliasgroupframedesc_t ;
typedef struct
{
int numframes ;
int intervals ;
maliasgroupframedesc_t frames [ 1 ] ;
} maliasgroup_t ;
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct mtriangle_s {
int xyz_index [ 3 ] ;
int st_index [ 3 ] ;
2021-11-03 20:30:40 +00:00
2005-01-26 17:16:08 +00:00
int pad [ 2 ] ;
2004-08-22 22:29:09 +00:00
} mtriangle_t ;
# define MAX_SKINS 32
typedef struct {
int ident ;
int version ;
vec3_t scale ;
vec3_t scale_origin ;
float boundingradius ;
vec3_t eyeposition ;
int numskins ;
int skinwidth ;
int skinheight ;
int numverts ;
int numtris ;
int numframes ;
synctype_t synctype ;
int flags ;
float size ;
int numposes ;
int poseverts ;
int posedata ; // numposes*poseverts trivert_t
int baseposedata ; //original verts for triangles to reference
int triangles ; //we need tri data for shadow volumes
int commands ; // gl command list with embedded s/t
int gl_texturenum [ MAX_SKINS ] [ 4 ] ;
int texels [ MAX_SKINS ] ;
maliasframedesc_t frames [ 1 ] ; // variable sized
} aliashdr_t ;
# define MAXALIASVERTS 2048
# define ALIAS_Z_CLIP_PLANE 5
# define MAXALIASFRAMES 256
# define MAXALIASTRIS 2048
extern aliashdr_t * pheader ;
extern mstvert_t stverts [ MAXALIASVERTS * 2 ] ;
extern mtriangle_t triangles [ MAXALIASTRIS ] ;
extern dtrivertx_t * poseverts [ MAXALIASFRAMES ] ;
2009-11-04 21:16:50 +00:00
# endif
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
. MD2 triangle model file format
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
// LordHavoc: grabbed this from the Q2 utility source,
// renamed a things to avoid conflicts
2021-11-03 20:31:32 +00:00
# define MD2IDALIASHEADER "IDP2",4
2004-08-22 22:29:09 +00:00
# define MD2ALIAS_VERSION 8
2009-11-04 21:16:50 +00:00
# define MD2MAX_SKINNAME 64 //part of the format
2004-08-22 22:29:09 +00:00
2009-11-04 21:16:50 +00:00
/*
2004-08-22 22:29:09 +00:00
# define MD2MAX_TRIANGLES 4096
2009-11-04 21:16:50 +00:00
# define MD2MAX_FRAMES 512
2004-08-22 22:29:09 +00:00
# define MD2MAX_VERTS 2048
# define MD2MAX_SKINS 32
// sanity checking size
# define MD2MAX_SIZE (1024*4200)
2009-11-04 21:16:50 +00:00
*/
2004-08-22 22:29:09 +00:00
typedef struct
{
short s ;
short t ;
} md2stvert_t ;
2021-11-03 20:30:40 +00:00
typedef struct
2004-08-22 22:29:09 +00:00
{
short index_xyz [ 3 ] ;
short index_st [ 3 ] ;
} md2triangle_t ;
typedef struct
{
qbyte v [ 3 ] ; // scaled qbyte to fit in frame mins/maxs
qbyte lightnormalindex ;
} md2trivertx_t ;
2009-11-04 21:16:50 +00:00
/*
2004-08-22 22:29:09 +00:00
# define MD2TRIVERTX_V0 0
# define MD2TRIVERTX_V1 1
# define MD2TRIVERTX_V2 2
# define MD2TRIVERTX_LNI 3
# define MD2TRIVERTX_SIZE 4
2009-11-04 21:16:50 +00:00
*/
2004-08-22 22:29:09 +00:00
typedef struct
{
float scale [ 3 ] ; // multiply qbyte verts by this
float translate [ 3 ] ; // then add this
char name [ 16 ] ; // frame name from grabbing
md2trivertx_t verts [ 1 ] ; // variable sized
} md2frame_t ;
// the glcmd format:
// a positive integer starts a tristrip command, followed by that many
// vertex structures.
// a negative integer starts a trifan command, followed by -x vertexes
// a zero indicates the end of the command list.
// a vertex consists of a floating point s, a floating point t,
// and an integer vertex index.
typedef struct
{
int ident ;
int version ;
int skinwidth ;
int skinheight ;
int framesize ; // qbyte size of each frame
int num_skins ;
int num_xyz ;
int num_st ; // greater than num_xyz for seams
int num_tris ;
int num_glcmds ; // dwords in strip/fan command list
int num_frames ;
int ofs_skins ; // each skin is a MAX_SKINNAME string
int ofs_st ; // qbyte offset from start for stverts
int ofs_tris ; // offset for dtriangles
int ofs_frames ; // offset for first frame
2021-11-03 20:30:40 +00:00
int ofs_glcmds ;
2004-08-22 22:29:09 +00:00
int ofs_end ; // end of file
} md2_t ;
2009-11-04 21:16:50 +00:00
//#define ALIASTYPE_MDL 1
//#define ALIASTYPE_MD2 2
2004-08-22 22:29:09 +00:00
//===================================================================
typedef struct
{
qbyte ambient [ 3 ] ;
qbyte diffuse [ 3 ] ;
qbyte direction [ 2 ] ;
} dq3gridlight_t ;
2005-04-21 00:02:01 +00:00
typedef struct
{
unsigned char ambient [ 4 ] [ 3 ] ;
unsigned char diffuse [ 4 ] [ 3 ] ;
unsigned char styles [ 4 ] ;
unsigned char direction [ 2 ] ;
} rbspgridlight_t ;
//q3 based
2004-08-22 22:29:09 +00:00
typedef struct {
2005-05-26 12:55:34 +00:00
int gridBounds [ 4 ] ; //3 = 0*1
2004-08-22 22:29:09 +00:00
vec3_t gridMins ;
vec3_t gridSize ;
int numlightgridelems ;
2005-04-21 00:02:01 +00:00
//rbsp specific
rbspgridlight_t * rbspelements ;
unsigned short * rbspindexes ;
//non-rbsp specific
dq3gridlight_t * lightgrid ;
//the reason rbsp is seperate from the non-rbsp is because it allows better memory compression.
//I chose not to expand at loadtime because q3 would suffer from greater cache misses.
2004-08-22 22:29:09 +00:00
} q3lightgridinfo_t ;
//
// Whole model
//
2005-08-26 22:56:51 +00:00
typedef enum { mod_brush , mod_sprite , mod_alias , mod_dummy , mod_halflife , mod_heightmap } modtype_t ;
2011-02-25 04:22:14 +00:00
typedef enum { fg_quake , fg_quake2 , fg_quake3 , fg_halflife , fg_new , fg_doom , fg_doom3 } fromgame_t ; //useful when we have very similar model types. (eg quake/halflife bsps)
2021-08-21 18:16:13 +00:00
typedef enum { sb_none , sb_quake64 , sb_long1 , sb_long2 } subbsp_t ; // used to denote bsp specifics for load processing only (no runtime changes)
2004-08-22 22:29:09 +00:00
2014-10-05 20:04:11 +00:00
# define MF_ROCKET (1u<<0) // leave a trail
# define MF_GRENADE (1u<<1) // leave a trail
# define MF_GIB (1u<<2) // leave a trail
# define MF_ROTATE (1u<<3) // rotate (bonus items)
# define MF_TRACER (1u<<4) // green split trail
# define MF_ZOMGIB (1u<<5) // small blood trail
# define MF_TRACER2 (1u<<6) // orange split trail + rotate
# define MF_TRACER3 (1u<<7) // purple trail
2004-08-22 22:29:09 +00:00
2009-11-04 21:16:50 +00:00
//hexen2 support.
2014-10-05 20:04:11 +00:00
# define MFH2_FIREBALL (1u<<8) // Yellow transparent trail in all directions
# define MFH2_ICE (1u<<9) // Blue-white transparent trail, with gravity
# define MFH2_MIP_MAP (1u<<10) // This model has mip-maps
# define MFH2_SPIT (1u<<11) // Black transparent trail with negative light
# define MFH2_TRANSPARENT (1u<<12) // Transparent sprite
# define MFH2_SPELL (1u<<13) // Vertical spray of particles
2022-01-08 10:01:29 +00:00
# define MFH2_HOLEY (1u<<14) // Solid model with color 0 cut out
2014-10-05 20:04:11 +00:00
# define MFH2_SPECIAL_TRANS (1u<<15) // Translucency through the particle table
# define MFH2_FACE_VIEW (1u<<16) // Poly Model always faces you
# define MFH2_VORP_MISSILE (1u<<17) // leave a trail at top and bottom of model
# define MFH2_SET_STAFF (1u<<18) // slowly move up and left/right
# define MFH2_MAGICMISSILE (1u<<19) // a trickle of blue/white particles with gravity
# define MFH2_BONESHARD (1u<<20) // a trickle of brown particles with gravity
# define MFH2_SCARAB (1u<<21) // white transparent particles with little gravity
# define MFH2_ACIDBALL (1u<<22) // Green drippy acid shit
# define MFH2_BLOODSHOT (1u<<23) // Blood rain shot trail
2017-01-13 00:39:50 +00:00
# define MFH2_SPIDERBLOOD (1u<<31) // spider blood (remapped from MF_ROCKET, to avoid dlight issues)
2004-08-22 22:29:09 +00:00
typedef union {
struct {
int numlinedefs ;
int numsidedefs ;
int numsectors ;
} doom ;
} specificmodeltype_t ;
2011-02-25 04:22:14 +00:00
typedef struct
{
int walkno ;
int area [ 2 ] ;
vec3_t plane ;
float dist ;
vec3_t min ;
vec3_t max ;
int numpoints ;
vec4_t * points ;
} portal_t ;
2014-10-05 20:04:11 +00:00
enum
{
MLS_NOTLOADED ,
MLS_LOADING ,
MLS_LOADED ,
MLS_FAILED
} ;
2004-08-22 22:29:09 +00:00
typedef struct model_s
{
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
char name [ MAX_QPATH ] ; //actual name on disk
char publicname [ MAX_QPATH ] ; //name that the gamecode etc sees
2021-04-14 05:21:04 +00:00
int datasequence ; //if it gets old enough, we can purge it.
int loadstate ; //MLS_
2017-05-23 07:03:07 +00:00
qboolean tainted ; // differs from the server's version. this model will be invisible as a result, to avoid spiked models.
2010-02-06 01:25:04 +00:00
qboolean pushdepth ; // bsp submodels have this flag set so you don't get z fighting on co-planar surfaces.
2017-05-23 07:03:07 +00:00
time_t mtime ; // modification time. so we can flush models if they're changed on disk. or at least worldmodels.
2004-08-22 22:29:09 +00:00
2021-04-14 05:21:04 +00:00
struct model_s * submodelof ; // shares memory allocations with this model.
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
2004-08-22 22:29:09 +00:00
modtype_t type ;
fromgame_t fromgame ;
2016-10-22 07:06:51 +00:00
2004-08-22 22:29:09 +00:00
int numframes ;
synctype_t synctype ;
2021-11-03 20:30:40 +00:00
2004-08-22 22:29:09 +00:00
int flags ;
2005-08-06 22:39:28 +00:00
int engineflags ;
2004-08-22 22:29:09 +00:00
int particleeffect ;
int particletrail ;
2005-11-26 23:11:19 +00:00
int traildefaultindex ;
2004-08-22 22:29:09 +00:00
//
// volume occupied by the model graphics
2021-11-03 20:30:40 +00:00
//
2004-08-22 22:29:09 +00:00
vec3_t mins , maxs ;
float radius ;
2008-01-19 05:59:00 +00:00
float clampscale ;
2019-07-29 05:28:20 +00:00
float maxlod ;
2004-08-22 22:29:09 +00:00
//
2021-11-03 20:30:40 +00:00
// solid volume for clipping
2004-08-22 22:29:09 +00:00
//
qboolean clipbox ;
vec3_t clipmins , clipmaxs ;
2021-04-14 05:21:04 +00:00
void * cnodes ; //BIH tree
2004-08-22 22:29:09 +00:00
//
// brush model
//
int firstmodelsurface , nummodelsurfaces ;
int numsubmodels ;
mmodel_t * submodels ;
int numplanes ;
mplane_t * planes ;
2017-06-21 01:24:25 +00:00
size_t pvsbytes ; //total bytes for the per-leaf pvs/phs data. rounded up to sizeof(int).
int numclusters ; //number of bits in the pvs data.
2004-08-22 22:29:09 +00:00
int numleafs ; // number of visible leafs, not counting 0
mleaf_t * leafs ;
int numvertexes ;
mvertex_t * vertexes ;
2015-03-03 00:14:43 +00:00
vec3_t * normals ;
2004-08-22 22:29:09 +00:00
int numedges ;
medge_t * edges ;
int numnodes ;
mnode_t * nodes ;
2014-05-10 13:42:13 +00:00
mnode_t * rootnode ;
2004-08-22 22:29:09 +00:00
int numtexinfo ;
mtexinfo_t * texinfo ;
int numsurfaces ;
msurface_t * surfaces ;
int numsurfedges ;
int * surfedges ;
int numclipnodes ;
2011-06-29 18:39:11 +00:00
mclipnode_t * clipnodes ;
2004-08-22 22:29:09 +00:00
int nummarksurfaces ;
msurface_t * * marksurfaces ;
hull_t hulls [ MAX_MAP_HULLSM ] ;
int numtextures ;
texture_t * * textures ;
2015-06-14 12:26:01 +00:00
qbyte * pvs , * phs ; // fully expanded and decompressed
2004-08-22 22:29:09 +00:00
qbyte * visdata ;
void * vis ;
qbyte * lightdata ;
qbyte * deluxdata ;
2015-05-03 19:57:46 +00:00
unsigned lightdatasize ;
2004-08-22 22:29:09 +00:00
q3lightgridinfo_t * lightgrid ;
2014-10-05 20:04:11 +00:00
mfog_t * fogs ;
int numfogs ;
2018-07-22 11:49:37 +00:00
menvmap_t * envmaps ;
unsigned numenvmaps ;
2021-04-14 05:21:04 +00:00
struct skytris_s * skytris ; //for surface emittance
float skytime ; //for surface emittance
struct skytriblock_s * skytrimem ;
2017-04-18 11:12:17 +00:00
struct { unsigned int id ; char * keyvals ; } * entityinfo ;
2016-11-25 08:14:54 +00:00
size_t numentityinfo ;
const char * entities_raw ;
2014-10-05 20:04:11 +00:00
int entitiescrc ;
2004-08-22 22:29:09 +00:00
2021-04-14 05:21:04 +00:00
struct doll_s * dollinfo ; //ragdoll info
int camerabone ; //the 1-based bone index that the camera should be attached to (for gltf rather than anything else)
shader_t * simpleskin [ 4 ] ; //simpleitems cache
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
2012-05-09 15:30:53 +00:00
struct {
texture_t * tex ;
vbo_t * vbo ;
} * shadowbatches ;
int numshadowbatches ;
vbo_t * vbos ;
2005-08-26 22:56:51 +00:00
void * terrain ;
2010-08-28 17:14:38 +00:00
batch_t * batches [ SHADER_SORT_COUNT ] ;
2015-10-11 11:34:58 +00:00
unsigned int numbatches ;
2012-07-05 19:42:36 +00:00
struct
{
2013-05-03 04:28:08 +00:00
int first ; //once built...
int count ; //num lightmaps
2020-02-26 00:37:52 +00:00
int mergew ; //merge this many source lightmaps together. woo.
int mergeh ; //merge this many source lightmaps together. woo.
2013-05-03 04:28:08 +00:00
int width ; //x size of lightmaps
int height ; //y size of lightmaps
int surfstyles ; //numbers of style per surface.
2019-09-10 15:40:04 +00:00
int maxstyle ; //highest (valid) style used (cl_max_lightstyles must be 1+ higher).
2018-03-04 14:41:16 +00:00
enum {
//vanilla used byte values, with 255 being a value of about 2.
//float/hdr formats use 1 to mean 1, however.
//internally, we still use integers for lighting, with .7 bits of extra precision.
LM_L8 ,
LM_RGB8 ,
LM_E5BGR9
} fmt ;
2013-05-03 04:28:08 +00:00
qboolean deluxemapping ; //lightmaps are interleaved with deluxemap data (lightmap indicies should only be even values)
2017-08-29 02:29:06 +00:00
qboolean deluxemapping_modelspace ; //deluxemaps are in modelspace - we need different glsl.
2012-07-05 19:42:36 +00:00
} lightmaps ;
2004-08-22 22:29:09 +00:00
unsigned checksum ;
unsigned checksum2 ;
2011-02-25 04:22:14 +00:00
portal_t * portal ;
unsigned int numportals ;
2004-08-22 22:29:09 +00:00
2009-11-04 21:16:50 +00:00
modelfuncs_t funcs ;
2004-08-22 22:29:09 +00:00
//
// additional model data
//
2013-07-14 12:22:51 +00:00
void * meshinfo ; //data allocated within the memgroup allocations, will be nulled out when the model is flushed
2021-05-28 07:07:48 +00:00
searchpathfuncs_t * archive ; //some bsp formats have an embedded zip...
2013-07-14 12:22:51 +00:00
zonegroup_t memgroup ;
2004-08-22 22:29:09 +00:00
} model_t ;
2016-10-22 07:06:51 +00:00
# define MDLF_EMITREPLACE 0x0001 // particle effect engulphs model (don't draw)
# define MDLF_EMITFORWARDS 0x0002
# define MDLF_NODEFAULTTRAIL 0x0004
2018-03-04 14:41:16 +00:00
//#define MDLF_RGBLIGHTING 0x0008
2016-10-22 07:06:51 +00:00
# define MDLF_PLAYER 0x0010 // players have specific lighting values
# define MDLF_FLAME 0x0020 // can be excluded with r_drawflame, fullbright render hack
# define MDLF_DOCRC 0x0040 // model needs CRC built
# define MDLF_NEEDOVERBRIGHT 0x0080 // only overbright these models with gl_overbright_all set
# define MDLF_BOLT 0x0100 // doesn't produce shadows
# define MDLF_NOTREPLACEMENTS 0x0200 // can be considered a cheat, disable texture replacements
# define MDLF_EZQUAKEFBCHEAT 0x0400 // this is a blatent cheat, one that can disadvantage us fairly significantly if we don't support it.
2021-08-24 06:06:05 +00:00
# define MDLF_NOSHADOWS 0x0800 // do not cast shadows from this entity, ever.
2016-10-22 07:06:51 +00:00
# define MDLF_RECALCULATERAIN 0x1000 // particles changed, recalculate any sky polys
2005-08-06 22:39:28 +00:00
2004-08-22 22:29:09 +00:00
//============================================================================
# endif // __MODEL__
2021-08-23 06:36:32 +00:00
typedef struct
{
unsigned int * offsets ;
unsigned short * extents ;
unsigned char * styles8 ;
unsigned short * styles16 ;
unsigned int stylesperface ;
unsigned char * shifts ;
unsigned char defaultshift ;
} lightmapoverrides_t ;
void Mod_LoadLighting ( struct model_s * loadmodel , bspx_header_t * bspx , qbyte * mod_base , lump_t * l , qboolean interleaveddeluxe , lightmapoverrides_t * overrides , subbsp_t subbsp ) ;
2019-07-02 04:12:20 +00:00
float RadiusFromBounds ( const vec3_t mins , const vec3_t maxs ) ;
2004-08-22 22:29:09 +00:00
2012-07-15 02:40:30 +00:00
//
// gl_heightmap.c
//
# ifdef TERRAIN
2012-11-27 03:23:19 +00:00
void Terr_Init ( void ) ;
2019-09-04 07:59:40 +00:00
struct plugterrainfuncs_s ;
struct plugterrainfuncs_s * Terr_GetTerrainFuncs ( size_t structsize ) ;
2012-07-15 02:40:30 +00:00
void Terr_DrawTerrainModel ( batch_t * * batch , entity_t * e ) ;
2013-10-29 17:38:22 +00:00
void Terr_FreeModel ( model_t * mod ) ;
2014-10-05 20:04:11 +00:00
void Terr_FinishTerrain ( model_t * model ) ;
2013-10-29 17:38:22 +00:00
void Terr_PurgeTerrainModel ( model_t * hm , qboolean lightmapsonly , qboolean lightmapreusable ) ;
void * Mod_LoadTerrainInfo ( model_t * mod , char * loadname , qboolean force ) ; //call this after loading a bsp
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
qboolean Terrain_LocateSection ( const char * name , flocation_t * loc ) ; //used on servers to generate sections for download.
2019-07-02 04:12:20 +00:00
qboolean Heightmap_Trace ( model_t * model , int forcehullnum , const framestate_t * framestate , const vec3_t axis [ 3 ] , const vec3_t start , const vec3_t end , const vec3_t mins , const vec3_t maxs , qboolean capsule , unsigned int contentmask , struct trace_s * trace ) ;
unsigned int Heightmap_PointContents ( model_t * model , const vec3_t axis [ 3 ] , const vec3_t org ) ;
2012-08-04 01:35:52 +00:00
struct fragmentdecal_s ;
void Terrain_ClipDecal ( struct fragmentdecal_s * dec , float * center , float radius , model_t * model ) ;
2012-11-29 13:37:48 +00:00
qboolean Terr_DownloadedSection ( char * fname ) ;
2015-04-14 23:12:17 +00:00
void CL_Parse_BrushEdit ( void ) ;
qboolean SV_Parse_BrushEdit ( void ) ;
2016-07-15 12:26:24 +00:00
qboolean SV_Prespawn_Brushes ( sizebuf_t * msg , unsigned int * modelindex , unsigned int * lastid ) ;
2012-07-15 02:40:30 +00:00
# endif
2004-08-22 22:29:09 +00:00
2011-05-20 04:10:46 +00:00
qboolean Heightmap_Edit ( model_t * mod , int action , float * pos , float radius , float quant ) ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
# if defined(Q2BSPS) || defined(Q3BSPS)
2021-11-03 20:30:40 +00:00
void CM_Init ( void ) ;
struct model_s * CM_TempBoxModel ( const vec3_t mins , const vec3_t maxs ) ;
# endif
#if 0
2006-03-06 01:41:09 +00:00
2004-08-22 22:29:09 +00:00
# ifdef __cplusplus
2011-10-27 16:16:29 +00:00
//#pragma warningmsg (" c++ stinks")
2004-08-22 22:29:09 +00:00
# else
2005-08-26 22:56:51 +00:00
qboolean CM_SetAreaPortalState ( struct model_s * mod , int portalnum , qboolean open ) ;
2019-07-02 04:12:20 +00:00
qboolean CM_HeadnodeVisible ( struct model_s * mod , int nodenum , const qbyte * visbits ) ;
2014-06-02 16:50:40 +00:00
qboolean VARGS CM_AreasConnected ( struct model_s * mod , unsigned int area1 , unsigned int area2 ) ;
2017-02-19 00:15:42 +00:00
int CM_ClusterBytes ( struct model_s * mod ) ;
2005-08-26 22:56:51 +00:00
int CM_LeafContents ( struct model_s * mod , int leafnum ) ;
int CM_LeafCluster ( struct model_s * mod , int leafnum ) ;
int CM_LeafArea ( struct model_s * mod , int leafnum ) ;
2015-09-01 04:45:15 +00:00
int CM_WriteAreaBits ( struct model_s * mod , qbyte * buffer , int area , qboolean merge ) ;
2019-07-02 04:12:20 +00:00
int CM_PointLeafnum ( struct model_s * mod , const vec3_t p ) ;
2017-06-21 01:24:25 +00:00
qbyte * CM_ClusterPVS ( struct model_s * mod , int cluster , pvsbuffer_t * buffer , pvsmerge_t merge ) ;
qbyte * CM_ClusterPHS ( struct model_s * mod , int cluster , pvsbuffer_t * buffer ) ;
2019-07-02 04:12:20 +00:00
int CM_BoxLeafnums ( struct model_s * mod , const vec3_t mins , const vec3_t maxs , int * list , int listsize , int * topnode ) ;
int CM_PointContents ( struct model_s * mod , const vec3_t p ) ;
int CM_TransformedPointContents ( struct model_s * mod , const vec3_t p , int headnode , const vec3_t origin , const vec3_t angles ) ;
int CM_HeadnodeForBox ( struct model_s * mod , const vec3_t mins , const vec3_t maxs ) ;
2015-04-27 06:19:33 +00:00
//struct trace_s CM_TransformedBoxTrace (struct model_s *mod, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, int brushmask, vec3_t origin, vec3_t angles);
2004-08-22 22:29:09 +00:00
2017-08-14 16:38:44 +00:00
//for gamecode to control portals/areas
2015-02-02 08:01:53 +00:00
void CMQ2_SetAreaPortalState ( model_t * mod , unsigned int portalnum , qboolean open ) ;
void CMQ3_SetAreaPortalState ( model_t * mod , unsigned int area1 , unsigned int area2 , qboolean open ) ;
2017-08-14 16:38:44 +00:00
//for saved games to write the raw state.
2018-06-06 09:09:14 +00:00
size_t CM_WritePortalState ( model_t * mod , void * * data ) ;
2017-08-14 16:38:44 +00:00
qofs_t CM_ReadPortalState ( model_t * mod , qbyte * ptr , qofs_t ptrsize ) ;
2004-08-22 22:29:09 +00:00
# endif
2005-01-28 04:27:17 +00:00
# endif //Q2BSPS
2018-10-11 10:31:23 +00:00
void CategorizePlane ( mplane_t * plane ) ;
void CalcSurfaceExtents ( model_t * mod , msurface_t * s ) ;