mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-18 09:51:40 +00:00
[model] Clean up the globals around model loading
Covers only the generic load code (alias etc to follow), but this should take care of a lot of issues in the future.
This commit is contained in:
parent
afe8e9633e
commit
bb6c6963d2
44 changed files with 408 additions and 399 deletions
|
@ -102,13 +102,14 @@ typedef struct aliasctx_s {
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
struct entity_s;
|
struct entity_s;
|
||||||
void *Vulkan_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
void *Vulkan_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum,
|
||||||
qboolean group, maliasskindesc_t *skindesc,
|
int gnum, qboolean group,
|
||||||
|
maliasskindesc_t *skindesc,
|
||||||
struct vulkan_ctx_s *ctx);
|
struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr,
|
void Vulkan_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr,
|
||||||
struct vulkan_ctx_s *ctx);
|
struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Mod_LoadExternalSkins (model_t *mod, struct vulkan_ctx_s *ctx);
|
void Vulkan_Mod_LoadExternalSkins (model_t *mod, struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr,
|
void Vulkan_Mod_MakeAliasModelDisplayLists (model_t *mod, aliashdr_t *hdr,
|
||||||
void *_m, int _s, int extra,
|
void *_m, int _s, int extra,
|
||||||
struct vulkan_ctx_s *ctx);
|
struct vulkan_ctx_s *ctx);
|
||||||
|
|
||||||
|
|
|
@ -346,6 +346,8 @@ typedef enum {mod_brush, mod_sprite, mod_alias, mod_iqm} modtype_t;
|
||||||
#define EF_GLOWTRAIL 4096 // glowcolor particle trail
|
#define EF_GLOWTRAIL 4096 // glowcolor particle trail
|
||||||
|
|
||||||
typedef struct model_s {
|
typedef struct model_s {
|
||||||
|
//FIXME use pointers. needs care in bsp submodel loading
|
||||||
|
char path[MAX_QPATH];
|
||||||
char name[MAX_QPATH];
|
char name[MAX_QPATH];
|
||||||
const struct vpath_s *vpath;// virtual path where this model was found
|
const struct vpath_s *vpath;// virtual path where this model was found
|
||||||
qboolean needload; // bmodels and sprites don't cache normally
|
qboolean needload; // bmodels and sprites don't cache normally
|
||||||
|
@ -431,40 +433,20 @@ typedef struct model_s {
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
extern float RadiusFromBounds (const vec3_t mins, const vec3_t maxs) __attribute__((pure));
|
void Mod_Init (void);
|
||||||
void Mod_Init (void);
|
void Mod_Init_Cvars (void);
|
||||||
void Mod_Init_Cvars (void);
|
void Mod_ClearAll (void);
|
||||||
void Mod_ClearAll (void);
|
|
||||||
model_t *Mod_ForName (const char *name, qboolean crash);
|
model_t *Mod_ForName (const char *name, qboolean crash);
|
||||||
void *Mod_Extradata (model_t *mod); // handles caching
|
void Mod_TouchModel (const char *name);
|
||||||
void Mod_TouchModel (const char *name);
|
// brush specific
|
||||||
|
|
||||||
mleaf_t *Mod_PointInLeaf (const vec3_t p, model_t *model) __attribute__((pure));
|
mleaf_t *Mod_PointInLeaf (const vec3_t p, model_t *model) __attribute__((pure));
|
||||||
byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
|
byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
|
||||||
model_t *Mod_FindName (const char *name);
|
void Mod_Print (void);
|
||||||
int Mod_CalcFullbright (const byte *in, byte *out, int pixels);
|
|
||||||
void Mod_ClearFullbright (const byte *in, byte *out, int pixels);
|
|
||||||
int Mod_Fullbright (byte * skin, int width, int height, const char *name);
|
|
||||||
|
|
||||||
void *Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame,
|
|
||||||
int extra);
|
|
||||||
void *Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame,
|
|
||||||
int extra);
|
|
||||||
|
|
||||||
void Mod_FindClipDepth (hull_t *hull);
|
|
||||||
void Mod_LoadBrushModel (model_t *mod, void *buffer);
|
|
||||||
void Mod_FloodFillSkin (byte *skin, int skinwidth, int skinheight);
|
|
||||||
|
|
||||||
void Mod_Print (void);
|
|
||||||
|
|
||||||
extern struct cvar_s *gl_mesh_cache;
|
extern struct cvar_s *gl_mesh_cache;
|
||||||
extern struct cvar_s *gl_subdivide_size;
|
extern struct cvar_s *gl_subdivide_size;
|
||||||
extern struct cvar_s *gl_alias_render_tri;
|
extern struct cvar_s *gl_alias_render_tri;
|
||||||
extern struct cvar_s *gl_textures_external;
|
extern struct cvar_s *gl_textures_external;
|
||||||
extern model_t *loadmodel;
|
|
||||||
extern char *loadname;
|
|
||||||
extern byte *mod_base;
|
|
||||||
extern byte mod_novis[MAX_MAP_LEAFS / 8];
|
|
||||||
extern int mod_lightmap_bytes;
|
extern int mod_lightmap_bytes;
|
||||||
|
|
||||||
#endif//__QF_model_h
|
#endif//__QF_model_h
|
||||||
|
|
|
@ -81,22 +81,24 @@ typedef struct vid_particle_funcs_s {
|
||||||
|
|
||||||
typedef struct vid_model_funcs_s {
|
typedef struct vid_model_funcs_s {
|
||||||
size_t texture_render_size;// size of renderer specific texture data
|
size_t texture_render_size;// size of renderer specific texture data
|
||||||
void (*Mod_LoadLighting) (bsp_t *bsp);
|
void (*Mod_LoadLighting) (model_t *mod, bsp_t *bsp);
|
||||||
void (*Mod_SubdivideSurface) (msurface_t *fa);
|
void (*Mod_SubdivideSurface) (model_t *mod, msurface_t *fa);
|
||||||
void (*Mod_ProcessTexture) (texture_t *tx);
|
void (*Mod_ProcessTexture) (model_t *mod, texture_t *tx);
|
||||||
void (*Mod_LoadIQM) (model_t *mod, void *buffer);
|
void (*Mod_LoadIQM) (model_t *mod, void *buffer);
|
||||||
void (*Mod_LoadAliasModel) (model_t *mod, void *buffer,
|
void (*Mod_LoadAliasModel) (model_t *mod, void *buffer,
|
||||||
cache_allocator_t allocator);
|
cache_allocator_t allocator);
|
||||||
void (*Mod_LoadSpriteModel) (model_t *mod, void *buffer);
|
void (*Mod_LoadSpriteModel) (model_t *mod, void *buffer);
|
||||||
void (*Mod_MakeAliasModelDisplayLists) (model_t *m, aliashdr_t *hdr,
|
void (*Mod_MakeAliasModelDisplayLists) (model_t *m, aliashdr_t *hdr,
|
||||||
void *_m, int _s, int extra);
|
void *_m, int _s, int extra);
|
||||||
void *(*Mod_LoadSkin) (byte *skin, int skinsize, int snum, int gnum,
|
void *(*Mod_LoadSkin) (model_t *mod, byte *skin, int skinsize, int snum,
|
||||||
|
int gnum,
|
||||||
qboolean group, maliasskindesc_t *skindesc);
|
qboolean group, maliasskindesc_t *skindesc);
|
||||||
void (*Mod_FinalizeAliasModel) (model_t *m, aliashdr_t *hdr);
|
void (*Mod_FinalizeAliasModel) (model_t *m, aliashdr_t *hdr);
|
||||||
void (*Mod_LoadExternalSkins) (model_t *mod);
|
void (*Mod_LoadExternalSkins) (model_t *mod);
|
||||||
void (*Mod_IQMFinish) (model_t *mod);
|
void (*Mod_IQMFinish) (model_t *mod);
|
||||||
int alias_cache;
|
int alias_cache;
|
||||||
void (*Mod_SpriteLoadTexture) (mspriteframe_t *pspriteframe, int framenum);
|
void (*Mod_SpriteLoadTexture) (model_t *mod, mspriteframe_t *pspriteframe,
|
||||||
|
int framenum);
|
||||||
|
|
||||||
struct skin_s *(*Skin_SetColormap) (struct skin_s *skin, int cmap);
|
struct skin_s *(*Skin_SetColormap) (struct skin_s *skin, int cmap);
|
||||||
struct skin_s *(*Skin_SetSkin) (struct skin_s *skin, int cmap,
|
struct skin_s *(*Skin_SetSkin) (struct skin_s *skin, int cmap,
|
||||||
|
|
|
@ -6,50 +6,68 @@
|
||||||
#include "QF/skin.h"
|
#include "QF/skin.h"
|
||||||
#include "QF/plugin/vid_render.h"
|
#include "QF/plugin/vid_render.h"
|
||||||
|
|
||||||
|
int Mod_CalcFullbright (const byte *in, byte *out, int pixels);
|
||||||
|
void Mod_ClearFullbright (const byte *in, byte *out, int pixels);
|
||||||
|
void Mod_FloodFillSkin (byte *skin, int skinwidth, int skinheight);
|
||||||
|
//FIXME gl specific. rewrite to use above
|
||||||
|
int Mod_Fullbright (byte * skin, int width, int height, const char *name);
|
||||||
|
|
||||||
|
void Mod_LoadBrushModel (model_t *mod, void *buffer);
|
||||||
|
void Mod_FindClipDepth (hull_t *hull);
|
||||||
|
|
||||||
|
model_t *Mod_FindName (const char *name);
|
||||||
|
float RadiusFromBounds (const vec3_t mins, const vec3_t maxs) __attribute__((pure));
|
||||||
|
|
||||||
struct vulkan_ctx_s;
|
struct vulkan_ctx_s;
|
||||||
|
|
||||||
extern vid_model_funcs_t *m_funcs;
|
extern vid_model_funcs_t *m_funcs;
|
||||||
|
|
||||||
void gl_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
void gl_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||||
int _s, int extra);
|
int _s, int extra);
|
||||||
void *gl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
void *gl_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum,
|
||||||
qboolean group, maliasskindesc_t *skindesc);
|
int gnum, qboolean group, maliasskindesc_t *skindesc);
|
||||||
void gl_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
void gl_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
||||||
void gl_Mod_LoadExternalSkins (model_t *mod);
|
void gl_Mod_LoadExternalSkins (model_t *mod);
|
||||||
void gl_Mod_IQMFinish (model_t *mod);
|
void gl_Mod_IQMFinish (model_t *mod);
|
||||||
|
|
||||||
void glsl_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr,
|
void glsl_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr,
|
||||||
void *_m, int _s, int extra);
|
void *_m, int _s, int extra);
|
||||||
void *glsl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
void *glsl_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum,
|
||||||
qboolean group, maliasskindesc_t *skindesc);
|
int gnum, qboolean group, maliasskindesc_t *skindesc);
|
||||||
void glsl_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
void glsl_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
||||||
void glsl_Mod_LoadExternalSkins (model_t *mod);
|
void glsl_Mod_LoadExternalSkins (model_t *mod);
|
||||||
void glsl_Mod_IQMFinish (model_t *mod);
|
void glsl_Mod_IQMFinish (model_t *mod);
|
||||||
|
|
||||||
void sw_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
void sw_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||||
int _s, int extra);
|
int _s, int extra);
|
||||||
void *sw_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
void *sw_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum,
|
||||||
qboolean group, maliasskindesc_t *skindesc);
|
int gnum, qboolean group, maliasskindesc_t *skindesc);
|
||||||
void sw_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
void sw_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
||||||
void sw_Mod_LoadExternalSkins (model_t *mod);
|
void sw_Mod_LoadExternalSkins (model_t *mod);
|
||||||
void sw_Mod_IQMFinish (model_t *mod);
|
void sw_Mod_IQMFinish (model_t *mod);
|
||||||
|
|
||||||
void gl_Mod_LoadLighting (bsp_t *bsp);
|
void gl_Mod_LoadLighting (model_t *mod, bsp_t *bsp);
|
||||||
void gl_Mod_SubdivideSurface (msurface_t *fa);
|
void gl_Mod_SubdivideSurface (model_t *mod, msurface_t *fa);
|
||||||
void gl_Mod_ProcessTexture(texture_t *tx);
|
void gl_Mod_ProcessTexture (model_t *mod, texture_t *tx);
|
||||||
|
|
||||||
void glsl_Mod_LoadLighting (bsp_t *bsp);
|
void glsl_Mod_LoadLighting (model_t *mod, bsp_t *bsp);
|
||||||
void glsl_Mod_ProcessTexture(texture_t *tx);
|
void glsl_Mod_ProcessTexture (model_t *mod, texture_t *tx);
|
||||||
|
|
||||||
void sw_Mod_LoadLighting (bsp_t *bsp);
|
void sw_Mod_LoadLighting (model_t *mod, bsp_t *bsp);
|
||||||
|
|
||||||
void Vulkan_Mod_LoadLighting (bsp_t *bsp, struct vulkan_ctx_s *ctx);
|
void Vulkan_Mod_LoadLighting (model_t *mod, bsp_t *bsp,
|
||||||
void Vulkan_Mod_SubdivideSurface (msurface_t *fa, struct vulkan_ctx_s *ctx);
|
struct vulkan_ctx_s *ctx);
|
||||||
void Vulkan_Mod_ProcessTexture(texture_t *tx, struct vulkan_ctx_s *ctx);
|
void Vulkan_Mod_SubdivideSurface (model_t *mod, msurface_t *fa,
|
||||||
|
struct vulkan_ctx_s *ctx);
|
||||||
|
void Vulkan_Mod_ProcessTexture (model_t *mod, texture_t *tx,
|
||||||
|
struct vulkan_ctx_s *ctx);
|
||||||
|
|
||||||
void gl_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
|
void gl_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||||
void glsl_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
|
int framenum);
|
||||||
void sw_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
|
void glsl_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||||
|
int framenum);
|
||||||
|
void sw_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||||
|
int framenum);
|
||||||
|
|
||||||
void Mod_LoadIQM (model_t *mod, void *buffer);
|
void Mod_LoadIQM (model_t *mod, void *buffer);
|
||||||
void Mod_FreeIQM (iqm_t *iqm);
|
void Mod_FreeIQM (iqm_t *iqm);
|
||||||
|
|
|
@ -361,8 +361,8 @@ gl_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||||
|
|
||||||
// look for a cached version
|
// look for a cached version
|
||||||
dstring_copystr (cache, "glquake/");
|
dstring_copystr (cache, "glquake/");
|
||||||
dstring_appendstr (cache, m->name);
|
dstring_appendstr (cache, m->path);
|
||||||
QFS_StripExtension (m->name + strlen ("progs/"),
|
QFS_StripExtension (m->path + strlen ("progs/"),
|
||||||
cache->str + strlen ("glquake/"));
|
cache->str + strlen ("glquake/"));
|
||||||
dstring_appendstr (cache, ".qfms");
|
dstring_appendstr (cache, ".qfms");
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ gl_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||||
}
|
}
|
||||||
if (remesh) {
|
if (remesh) {
|
||||||
// build it from scratch
|
// build it from scratch
|
||||||
Sys_MaskPrintf (SYS_DEV, "meshing %s...\n", m->name);
|
Sys_MaskPrintf (SYS_DEV, "meshing %s...\n", m->path);
|
||||||
|
|
||||||
BuildTris (); // trifans or lists
|
BuildTris (); // trifans or lists
|
||||||
|
|
||||||
|
|
|
@ -53,15 +53,15 @@
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
void *
|
void *
|
||||||
gl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum, qboolean group,
|
gl_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum, int gnum,
|
||||||
maliasskindesc_t *skindesc)
|
qboolean group, maliasskindesc_t *skindesc)
|
||||||
{
|
{
|
||||||
byte *pskin;
|
byte *pskin;
|
||||||
char modname[MAX_QPATH + 4];
|
char modname[MAX_QPATH + 4];
|
||||||
int fb_texnum = 0, texnum = 0;
|
int fb_texnum = 0, texnum = 0;
|
||||||
dstring_t *name = dstring_new ();
|
dstring_t *name = dstring_new ();
|
||||||
|
|
||||||
pskin = Hunk_AllocName (skinsize, loadname);
|
pskin = Hunk_AllocName (skinsize, mod->name);
|
||||||
skindesc->skin = (byte *) pskin - (byte *) pheader;
|
skindesc->skin = (byte *) pskin - (byte *) pheader;
|
||||||
|
|
||||||
memcpy (pskin, skin, skinsize);
|
memcpy (pskin, skin, skinsize);
|
||||||
|
@ -69,13 +69,13 @@ gl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum, qboolean group,
|
||||||
Mod_FloodFillSkin (pskin, pheader->mdl.skinwidth, pheader->mdl.skinheight);
|
Mod_FloodFillSkin (pskin, pheader->mdl.skinwidth, pheader->mdl.skinheight);
|
||||||
// save 8 bit texels for the player model to remap
|
// save 8 bit texels for the player model to remap
|
||||||
// FIXME remove model restriction
|
// FIXME remove model restriction
|
||||||
if (strequal (loadmodel->name, "progs/player.mdl"))
|
if (strequal (mod->path, "progs/player.mdl"))
|
||||||
gl_Skin_SetPlayerSkin (pheader->mdl.skinwidth, pheader->mdl.skinheight,
|
gl_Skin_SetPlayerSkin (pheader->mdl.skinwidth, pheader->mdl.skinheight,
|
||||||
pskin);
|
pskin);
|
||||||
|
|
||||||
QFS_StripExtension (loadmodel->name, modname);
|
QFS_StripExtension (mod->path, modname);
|
||||||
|
|
||||||
if (!loadmodel->fullbright) {
|
if (!mod->fullbright) {
|
||||||
if (group) {
|
if (group) {
|
||||||
dsprintf (name, "fb_%s_%i_%i", modname, snum, gnum);
|
dsprintf (name, "fb_%s_%i_%i", modname, snum, gnum);
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,7 +95,7 @@ gl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum, qboolean group,
|
||||||
Sys_MaskPrintf (SYS_GLT, "%s %d\n", name->str, texnum);
|
Sys_MaskPrintf (SYS_GLT, "%s %d\n", name->str, texnum);
|
||||||
skindesc->texnum = texnum;
|
skindesc->texnum = texnum;
|
||||||
skindesc->fb_texnum = fb_texnum;
|
skindesc->fb_texnum = fb_texnum;
|
||||||
loadmodel->hasfullbrights = fb_texnum;
|
mod->hasfullbrights = fb_texnum;
|
||||||
dstring_delete (name);
|
dstring_delete (name);
|
||||||
// alpha param was true for non group skins
|
// alpha param was true for non group skins
|
||||||
return skin + skinsize;
|
return skin + skinsize;
|
||||||
|
@ -104,7 +104,7 @@ gl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum, qboolean group,
|
||||||
void
|
void
|
||||||
gl_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr)
|
gl_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr)
|
||||||
{
|
{
|
||||||
if (strequal (m->name, "progs/eyes.mdl")) {
|
if (strequal (m->path, "progs/eyes.mdl")) {
|
||||||
hdr->mdl.scale_origin[2] -= (22 + 8);
|
hdr->mdl.scale_origin[2] -= (22 + 8);
|
||||||
VectorScale (hdr->mdl.scale, 2, hdr->mdl.scale);
|
VectorScale (hdr->mdl.scale, 2, hdr->mdl.scale);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ gl_Mod_LoadExternalSkins (model_t *mod)
|
||||||
maliasskingroup_t *pskingroup;
|
maliasskingroup_t *pskingroup;
|
||||||
dstring_t *filename = dstring_new ();
|
dstring_t *filename = dstring_new ();
|
||||||
|
|
||||||
QFS_StripExtension (mod->name, modname);
|
QFS_StripExtension (mod->path, modname);
|
||||||
|
|
||||||
for (i = 0; i < pheader->mdl.numskins; i++) {
|
for (i = 0; i < pheader->mdl.numskins; i++) {
|
||||||
pskindesc = ((maliasskindesc_t *)
|
pskindesc = ((maliasskindesc_t *)
|
||||||
|
|
|
@ -91,7 +91,7 @@ glsl_alias_clear (model_t *m, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
glsl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
glsl_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum, int gnum,
|
||||||
qboolean group, maliasskindesc_t *skindesc)
|
qboolean group, maliasskindesc_t *skindesc)
|
||||||
{
|
{
|
||||||
byte *tskin;
|
byte *tskin;
|
||||||
|
@ -104,9 +104,9 @@ glsl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||||
memcpy (tskin, skin, skinsize);
|
memcpy (tskin, skin, skinsize);
|
||||||
Mod_FloodFillSkin (tskin, w, h);
|
Mod_FloodFillSkin (tskin, w, h);
|
||||||
if (group)
|
if (group)
|
||||||
name = va (0, "%s_%i_%i", loadmodel->name, snum, gnum);
|
name = va (0, "%s_%i_%i", mod->path, snum, gnum);
|
||||||
else
|
else
|
||||||
name = va (0, "%s_%i", loadmodel->name, snum);
|
name = va (0, "%s_%i", mod->path, snum);
|
||||||
skindesc->texnum = GLSL_LoadQuakeTexture (name, w, h, tskin);
|
skindesc->texnum = GLSL_LoadQuakeTexture (name, w, h, tskin);
|
||||||
free (tskin);
|
free (tskin);
|
||||||
return skin + skinsize;
|
return skin + skinsize;
|
||||||
|
|
|
@ -62,7 +62,8 @@ int aliasbboxmins[3], aliasbboxmaxs[3];
|
||||||
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
Mod_LoadAllSkins (model_t *mod, int numskins, daliasskintype_t *pskintype,
|
||||||
|
int *pskinindex)
|
||||||
{
|
{
|
||||||
byte *skin;
|
byte *skin;
|
||||||
float *poutskinintervals;
|
float *poutskinintervals;
|
||||||
|
@ -77,7 +78,7 @@ Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
||||||
|
|
||||||
skinsize = pheader->mdl.skinwidth * pheader->mdl.skinheight;
|
skinsize = pheader->mdl.skinwidth * pheader->mdl.skinheight;
|
||||||
pskindesc = Hunk_AllocName (numskins * sizeof (maliasskindesc_t),
|
pskindesc = Hunk_AllocName (numskins * sizeof (maliasskindesc_t),
|
||||||
loadname);
|
mod->name);
|
||||||
|
|
||||||
*pskinindex = (byte *) pskindesc - (byte *) pheader;
|
*pskinindex = (byte *) pskindesc - (byte *) pheader;
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
||||||
pskindesc[snum].type = pskintype->type;
|
pskindesc[snum].type = pskintype->type;
|
||||||
if (pskintype->type == ALIAS_SKIN_SINGLE) {
|
if (pskintype->type == ALIAS_SKIN_SINGLE) {
|
||||||
skin = (byte *) (pskintype + 1);
|
skin = (byte *) (pskintype + 1);
|
||||||
skin = m_funcs->Mod_LoadSkin (skin, skinsize, snum, 0, false,
|
skin = m_funcs->Mod_LoadSkin (mod, skin, skinsize, snum, 0, false,
|
||||||
&pskindesc[snum]);
|
&pskindesc[snum]);
|
||||||
} else {
|
} else {
|
||||||
pskintype++;
|
pskintype++;
|
||||||
|
@ -93,14 +94,14 @@ Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
||||||
groupskins = LittleLong (pinskingroup->numskins);
|
groupskins = LittleLong (pinskingroup->numskins);
|
||||||
|
|
||||||
t = field_offset (maliasskingroup_t, skindescs[groupskins]);
|
t = field_offset (maliasskingroup_t, skindescs[groupskins]);
|
||||||
paliasskingroup = Hunk_AllocName (t, loadname);
|
paliasskingroup = Hunk_AllocName (t, mod->name);
|
||||||
paliasskingroup->numskins = groupskins;
|
paliasskingroup->numskins = groupskins;
|
||||||
|
|
||||||
pskindesc[snum].skin = (byte *) paliasskingroup - (byte *) pheader;
|
pskindesc[snum].skin = (byte *) paliasskingroup - (byte *) pheader;
|
||||||
|
|
||||||
pinskinintervals = (daliasskininterval_t *) (pinskingroup + 1);
|
pinskinintervals = (daliasskininterval_t *) (pinskingroup + 1);
|
||||||
poutskinintervals = Hunk_AllocName (groupskins * sizeof (float),
|
poutskinintervals = Hunk_AllocName (groupskins * sizeof (float),
|
||||||
loadname);
|
mod->name);
|
||||||
paliasskingroup->intervals =
|
paliasskingroup->intervals =
|
||||||
(byte *) poutskinintervals - (byte *) pheader;
|
(byte *) poutskinintervals - (byte *) pheader;
|
||||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||||
|
@ -117,8 +118,9 @@ Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
||||||
|
|
||||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||||
paliasskingroup->skindescs[gnum].type = ALIAS_SKIN_SINGLE;
|
paliasskingroup->skindescs[gnum].type = ALIAS_SKIN_SINGLE;
|
||||||
skin = mod_funcs->Mod_LoadSkin (skin, skinsize, snum, gnum,
|
skin = mod_funcs->Mod_LoadSkin (mod, skin, skinsize, snum,
|
||||||
true, &paliasskingroup->skindescs[gnum]);
|
gnum, true,
|
||||||
|
&paliasskingroup->skindescs[gnum]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pskintype = (daliasskintype_t *) skin;
|
pskintype = (daliasskintype_t *) skin;
|
||||||
|
@ -127,9 +129,9 @@ Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
||||||
return pskintype;
|
return pskintype;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
static void *
|
||||||
Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame,
|
Mod_LoadAliasFrame (model_t *mod, void *pin, int *posenum,
|
||||||
int extra)
|
maliasframedesc_t *frame, int extra)
|
||||||
{
|
{
|
||||||
daliasframe_t *pdaliasframe;
|
daliasframe_t *pdaliasframe;
|
||||||
trivertx_t *pinframe;
|
trivertx_t *pinframe;
|
||||||
|
@ -159,9 +161,9 @@ Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame,
|
||||||
return pinframe;
|
return pinframe;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
static void *
|
||||||
Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame,
|
Mod_LoadAliasGroup (model_t *mod, void *pin, int *posenum,
|
||||||
int extra)
|
maliasframedesc_t *frame, int extra)
|
||||||
{
|
{
|
||||||
daliasgroup_t *pingroup;
|
daliasgroup_t *pingroup;
|
||||||
daliasinterval_t *pin_intervals;
|
daliasinterval_t *pin_intervals;
|
||||||
|
@ -178,7 +180,7 @@ Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame,
|
||||||
frame->numposes = numframes;
|
frame->numposes = numframes;
|
||||||
|
|
||||||
paliasgroup = Hunk_AllocName (field_offset (maliasgroup_t,
|
paliasgroup = Hunk_AllocName (field_offset (maliasgroup_t,
|
||||||
frames[numframes]), loadname);
|
frames[numframes]), mod->name);
|
||||||
paliasgroup->numframes = numframes;
|
paliasgroup->numframes = numframes;
|
||||||
frame->frame = (byte *) paliasgroup - (byte *) pheader;
|
frame->frame = (byte *) paliasgroup - (byte *) pheader;
|
||||||
|
|
||||||
|
@ -189,7 +191,7 @@ Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame,
|
||||||
VectorCompMax (frame->bboxmax.v, aliasbboxmaxs, aliasbboxmaxs);
|
VectorCompMax (frame->bboxmax.v, aliasbboxmaxs, aliasbboxmaxs);
|
||||||
|
|
||||||
pin_intervals = (daliasinterval_t *) (pingroup + 1);
|
pin_intervals = (daliasinterval_t *) (pingroup + 1);
|
||||||
poutintervals = Hunk_AllocName (numframes * sizeof (float), loadname);
|
poutintervals = Hunk_AllocName (numframes * sizeof (float), mod->name);
|
||||||
paliasgroup->intervals = (byte *) poutintervals - (byte *) pheader;
|
paliasgroup->intervals = (byte *) poutintervals - (byte *) pheader;
|
||||||
frame->interval = LittleFloat (pin_intervals->interval);
|
frame->interval = LittleFloat (pin_intervals->interval);
|
||||||
for (i = 0; i < numframes; i++) {
|
for (i = 0; i < numframes; i++) {
|
||||||
|
@ -203,7 +205,7 @@ Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame,
|
||||||
ptemp = (void *) pin_intervals;
|
ptemp = (void *) pin_intervals;
|
||||||
for (i = 0; i < numframes; i++) {
|
for (i = 0; i < numframes; i++) {
|
||||||
maliasframedesc_t temp_frame;
|
maliasframedesc_t temp_frame;
|
||||||
ptemp = Mod_LoadAliasFrame (ptemp, posenum, &temp_frame, extra);
|
ptemp = Mod_LoadAliasFrame (mod, ptemp, posenum, &temp_frame, extra);
|
||||||
memcpy (&paliasgroup->frames[i], &temp_frame,
|
memcpy (&paliasgroup->frames[i], &temp_frame,
|
||||||
sizeof (paliasgroup->frames[i]));
|
sizeof (paliasgroup->frames[i]));
|
||||||
}
|
}
|
||||||
|
@ -242,7 +244,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
||||||
// allocate space for a working header, plus all the data except the
|
// allocate space for a working header, plus all the data except the
|
||||||
// frames, skin and group info
|
// frames, skin and group info
|
||||||
size = field_offset (aliashdr_t, frames[LittleLong (pinmodel->numframes)]);
|
size = field_offset (aliashdr_t, frames[LittleLong (pinmodel->numframes)]);
|
||||||
pheader = Hunk_AllocName (size, loadname);
|
pheader = Hunk_AllocName (size, mod->name);
|
||||||
memset (pheader, 0, size);
|
memset (pheader, 0, size);
|
||||||
pmodel = &pheader->mdl;
|
pmodel = &pheader->mdl;
|
||||||
pheader->model = (byte *) pmodel - (byte *) pheader;
|
pheader->model = (byte *) pmodel - (byte *) pheader;
|
||||||
|
@ -294,7 +296,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
||||||
|
|
||||||
// load the skins
|
// load the skins
|
||||||
pskintype = (daliasskintype_t *) &pinmodel[1];
|
pskintype = (daliasskintype_t *) &pinmodel[1];
|
||||||
pskintype = Mod_LoadAllSkins (pheader->mdl.numskins, pskintype,
|
pskintype = Mod_LoadAllSkins (mod, pheader->mdl.numskins, pskintype,
|
||||||
&pheader->skindesc);
|
&pheader->skindesc);
|
||||||
|
|
||||||
// load base s and t vertices
|
// load base s and t vertices
|
||||||
|
@ -332,11 +334,11 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
||||||
|
|
||||||
if (frametype == ALIAS_SINGLE) {
|
if (frametype == ALIAS_SINGLE) {
|
||||||
pframetype = (daliasframetype_t *)
|
pframetype = (daliasframetype_t *)
|
||||||
Mod_LoadAliasFrame (pframetype + 1, &posenum,
|
Mod_LoadAliasFrame (mod, pframetype + 1, &posenum,
|
||||||
&pheader->frames[i], extra);
|
&pheader->frames[i], extra);
|
||||||
} else {
|
} else {
|
||||||
pframetype = (daliasframetype_t *)
|
pframetype = (daliasframetype_t *)
|
||||||
Mod_LoadAliasGroup (pframetype + 1, &posenum,
|
Mod_LoadAliasGroup (mod, pframetype + 1, &posenum,
|
||||||
&pheader->frames[i], extra);
|
&pheader->frames[i], extra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,7 +369,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
||||||
end = Hunk_LowMark ();
|
end = Hunk_LowMark ();
|
||||||
total = end - start;
|
total = end - start;
|
||||||
|
|
||||||
mem = allocator (&mod->cache, total, loadname);
|
mem = allocator (&mod->cache, total, mod->name);
|
||||||
if (mem)
|
if (mem)
|
||||||
memcpy (mem, pheader, total);
|
memcpy (mem, pheader, total);
|
||||||
|
|
||||||
|
|
|
@ -50,12 +50,12 @@
|
||||||
|
|
||||||
|
|
||||||
void *
|
void *
|
||||||
sw_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
sw_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum, int gnum,
|
||||||
qboolean group, maliasskindesc_t *skindesc)
|
qboolean group, maliasskindesc_t *skindesc)
|
||||||
{
|
{
|
||||||
byte *pskin;
|
byte *pskin;
|
||||||
|
|
||||||
pskin = Hunk_AllocName (skinsize, loadname);
|
pskin = Hunk_AllocName (skinsize, mod->name);
|
||||||
skindesc->skin = (byte *) pskin - (byte *) pheader;
|
skindesc->skin = (byte *) pskin - (byte *) pheader;
|
||||||
|
|
||||||
memcpy (pskin, skin, skinsize);
|
memcpy (pskin, skin, skinsize);
|
||||||
|
@ -64,7 +64,7 @@ sw_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
process_frame (maliasframedesc_t *frame, int posenum, int extra)
|
process_frame (model_t *mod, maliasframedesc_t *frame, int posenum, int extra)
|
||||||
{
|
{
|
||||||
int size = pheader->mdl.numverts * sizeof (trivertx_t);
|
int size = pheader->mdl.numverts * sizeof (trivertx_t);
|
||||||
trivertx_t *frame_verts;
|
trivertx_t *frame_verts;
|
||||||
|
@ -72,7 +72,7 @@ process_frame (maliasframedesc_t *frame, int posenum, int extra)
|
||||||
if (extra)
|
if (extra)
|
||||||
size *= 2;
|
size *= 2;
|
||||||
|
|
||||||
frame_verts = Hunk_AllocName (size, loadname);
|
frame_verts = Hunk_AllocName (size, mod->name);
|
||||||
frame->frame = (byte *) frame_verts - (byte *) pheader;
|
frame->frame = (byte *) frame_verts - (byte *) pheader;
|
||||||
|
|
||||||
// The low-order 8 bits (actually, fractional) are completely separate
|
// The low-order 8 bits (actually, fractional) are completely separate
|
||||||
|
@ -83,7 +83,7 @@ process_frame (maliasframedesc_t *frame, int posenum, int extra)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sw_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
sw_Mod_MakeAliasModelDisplayLists (model_t *mod, aliashdr_t *hdr, void *_m,
|
||||||
int _s, int extra)
|
int _s, int extra)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -93,9 +93,9 @@ sw_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||||
mtriangle_t *ptri;
|
mtriangle_t *ptri;
|
||||||
|
|
||||||
pstverts = (stvert_t *) Hunk_AllocName (numv * sizeof (stvert_t),
|
pstverts = (stvert_t *) Hunk_AllocName (numv * sizeof (stvert_t),
|
||||||
loadname);
|
mod->name);
|
||||||
ptri = (mtriangle_t *) Hunk_AllocName (numt * sizeof (mtriangle_t),
|
ptri = (mtriangle_t *) Hunk_AllocName (numt * sizeof (mtriangle_t),
|
||||||
loadname);
|
mod->name);
|
||||||
|
|
||||||
hdr->stverts = (byte *) pstverts - (byte *) hdr;
|
hdr->stverts = (byte *) pstverts - (byte *) hdr;
|
||||||
hdr->triangles = (byte *) ptri - (byte *) hdr;
|
hdr->triangles = (byte *) ptri - (byte *) hdr;
|
||||||
|
@ -117,16 +117,16 @@ sw_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||||
maliasgroup_t *group;
|
maliasgroup_t *group;
|
||||||
group = (maliasgroup_t *) ((byte *) pheader + frame->frame);
|
group = (maliasgroup_t *) ((byte *) pheader + frame->frame);
|
||||||
for (j = 0; j < group->numframes; j++)
|
for (j = 0; j < group->numframes; j++)
|
||||||
process_frame ((maliasframedesc_t *) &group->frames[j],
|
process_frame (mod, (maliasframedesc_t *) &group->frames[j],
|
||||||
posenum++, extra);
|
posenum++, extra);
|
||||||
} else {
|
} else {
|
||||||
process_frame (frame, posenum++, extra);
|
process_frame (mod, frame, posenum++, extra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sw_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr)
|
sw_Mod_FinalizeAliasModel (model_t *mod, aliashdr_t *hdr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,8 +110,8 @@ vulkan_alias_clear (model_t *m, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
Vulkan_Mod_LoadSkin (byte *skinpix, int skinsize, int snum, int gnum,
|
Vulkan_Mod_LoadSkin (model_t *mod, byte *skinpix, int skinsize, int snum,
|
||||||
qboolean group, maliasskindesc_t *skindesc,
|
int gnum, qboolean group, maliasskindesc_t *skindesc,
|
||||||
vulkan_ctx_t *ctx)
|
vulkan_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
aliasskin_t *skin;
|
aliasskin_t *skin;
|
||||||
|
@ -131,25 +131,25 @@ Vulkan_Mod_LoadSkin (byte *skinpix, int skinsize, int snum, int gnum,
|
||||||
if (Mod_CalcFullbright (tskin, tskin + skinsize, skinsize)) {
|
if (Mod_CalcFullbright (tskin, tskin + skinsize, skinsize)) {
|
||||||
skin->glow = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
skin->glow = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
||||||
va (ctx->va_ctx, "%s:%d:%d:glow",
|
va (ctx->va_ctx, "%s:%d:%d:glow",
|
||||||
loadmodel->name, snum, gnum));
|
mod->name, snum, gnum));
|
||||||
Mod_ClearFullbright (tskin, tskin, skinsize);
|
Mod_ClearFullbright (tskin, tskin, skinsize);
|
||||||
}
|
}
|
||||||
if (Skin_CalcTopColors (tskin, tskin + skinsize, skinsize)) {
|
if (Skin_CalcTopColors (tskin, tskin + skinsize, skinsize)) {
|
||||||
skin->colora = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
skin->colora = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
||||||
va (ctx->va_ctx, "%s:%d:%d:colora",
|
va (ctx->va_ctx, "%s:%d:%d:colora",
|
||||||
loadmodel->name, snum, gnum));
|
mod->name, snum, gnum));
|
||||||
Skin_ClearTopColors (tskin, tskin, skinsize);
|
Skin_ClearTopColors (tskin, tskin, skinsize);
|
||||||
}
|
}
|
||||||
if (Skin_CalcBottomColors (tskin, tskin + skinsize, skinsize)) {
|
if (Skin_CalcBottomColors (tskin, tskin + skinsize, skinsize)) {
|
||||||
skin->colorb = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
skin->colorb = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
||||||
va (ctx->va_ctx, "%s:%d:%d:colorb",
|
va (ctx->va_ctx, "%s:%d:%d:colorb",
|
||||||
loadmodel->name, snum, gnum));
|
mod->name, snum, gnum));
|
||||||
Skin_ClearBottomColors (tskin, tskin, skinsize);
|
Skin_ClearBottomColors (tskin, tskin, skinsize);
|
||||||
}
|
}
|
||||||
skin_tex.data = tskin;
|
skin_tex.data = tskin;
|
||||||
skin->tex = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
skin->tex = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
||||||
va (ctx->va_ctx, "%s:%d:%d:tex",
|
va (ctx->va_ctx, "%s:%d:%d:tex",
|
||||||
loadmodel->name,
|
mod->name,
|
||||||
snum, gnum));
|
snum, gnum));
|
||||||
|
|
||||||
free (tskin);
|
free (tskin);
|
||||||
|
@ -185,7 +185,7 @@ get_buffer_size (qfv_device_t *device, VkBuffer buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
Vulkan_Mod_MakeAliasModelDisplayLists (model_t *mod, aliashdr_t *hdr, void *_m,
|
||||||
int _s, int extra, vulkan_ctx_t *ctx)
|
int _s, int extra, vulkan_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
@ -255,13 +255,13 @@ Vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||||
| VK_BUFFER_USAGE_INDEX_BUFFER_BIT);
|
| VK_BUFFER_USAGE_INDEX_BUFFER_BIT);
|
||||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_BUFFER, vbuff,
|
QFV_duSetObjectName (device, VK_OBJECT_TYPE_BUFFER, vbuff,
|
||||||
va (ctx->va_ctx, "buffer:alias:vertex:%s",
|
va (ctx->va_ctx, "buffer:alias:vertex:%s",
|
||||||
loadmodel->name));
|
mod->name));
|
||||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_BUFFER, uvbuff,
|
QFV_duSetObjectName (device, VK_OBJECT_TYPE_BUFFER, uvbuff,
|
||||||
va (ctx->va_ctx, "buffer:alias:uv:%s",
|
va (ctx->va_ctx, "buffer:alias:uv:%s",
|
||||||
loadmodel->name));
|
mod->name));
|
||||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_BUFFER, ibuff,
|
QFV_duSetObjectName (device, VK_OBJECT_TYPE_BUFFER, ibuff,
|
||||||
va (ctx->va_ctx, "buffer:alias:index:%s",
|
va (ctx->va_ctx, "buffer:alias:index:%s",
|
||||||
loadmodel->name));
|
mod->name));
|
||||||
size_t voffs = 0;
|
size_t voffs = 0;
|
||||||
size_t uvoffs = voffs + get_buffer_size (device, vbuff);
|
size_t uvoffs = voffs + get_buffer_size (device, vbuff);
|
||||||
size_t ioffs = uvoffs + get_buffer_size (device, uvbuff);
|
size_t ioffs = uvoffs + get_buffer_size (device, uvbuff);
|
||||||
|
@ -272,7 +272,7 @@ Vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||||
buff_size, 0);
|
buff_size, 0);
|
||||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_DEVICE_MEMORY, mem,
|
QFV_duSetObjectName (device, VK_OBJECT_TYPE_DEVICE_MEMORY, mem,
|
||||||
va (ctx->va_ctx, "memory:alias:vuvi:%s",
|
va (ctx->va_ctx, "memory:alias:vuvi:%s",
|
||||||
loadmodel->name));
|
mod->name));
|
||||||
QFV_BindBufferMemory (device, vbuff, mem, voffs);
|
QFV_BindBufferMemory (device, vbuff, mem, voffs);
|
||||||
QFV_BindBufferMemory (device, uvbuff, mem, uvoffs);
|
QFV_BindBufferMemory (device, uvbuff, mem, uvoffs);
|
||||||
QFV_BindBufferMemory (device, ibuff, mem, ioffs);
|
QFV_BindBufferMemory (device, ibuff, mem, ioffs);
|
||||||
|
@ -280,7 +280,7 @@ Vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||||
qfv_stagebuf_t *stage = QFV_CreateStagingBuffer (device,
|
qfv_stagebuf_t *stage = QFV_CreateStagingBuffer (device,
|
||||||
va (ctx->va_ctx,
|
va (ctx->va_ctx,
|
||||||
"alias:%s",
|
"alias:%s",
|
||||||
loadmodel->name),
|
mod->name),
|
||||||
buff_size, ctx->cmdpool);
|
buff_size, ctx->cmdpool);
|
||||||
qfv_packet_t *packet = QFV_PacketAcquire (stage);
|
qfv_packet_t *packet = QFV_PacketAcquire (stage);
|
||||||
verts = QFV_PacketExtend (packet, vert_size);
|
verts = QFV_PacketExtend (packet, vert_size);
|
||||||
|
|
|
@ -86,7 +86,7 @@ Mod_LoadExternalTextures (model_t *mod, texture_t *tx)
|
||||||
int external = 0;
|
int external = 0;
|
||||||
|
|
||||||
gltx = tx->render;
|
gltx = tx->render;
|
||||||
if ((base = Mod_LoadAnExternalTexture (tx->name, mod->name))) {
|
if ((base = Mod_LoadAnExternalTexture (tx->name, mod->path))) {
|
||||||
external = 1;
|
external = 1;
|
||||||
gltx->gl_texturenum =
|
gltx->gl_texturenum =
|
||||||
GL_LoadTexture (tx->name, base->width, base->height,
|
GL_LoadTexture (tx->name, base->width, base->height,
|
||||||
|
@ -94,10 +94,10 @@ Mod_LoadExternalTextures (model_t *mod, texture_t *tx)
|
||||||
base->format > 2 ? base->format : 1);
|
base->format > 2 ? base->format : 1);
|
||||||
|
|
||||||
luma = Mod_LoadAnExternalTexture (va (0, "%s_luma", tx->name),
|
luma = Mod_LoadAnExternalTexture (va (0, "%s_luma", tx->name),
|
||||||
mod->name);
|
mod->path);
|
||||||
if (!luma)
|
if (!luma)
|
||||||
luma = Mod_LoadAnExternalTexture (va (0, "%s_glow", tx->name),
|
luma = Mod_LoadAnExternalTexture (va (0, "%s_glow", tx->name),
|
||||||
mod->name);
|
mod->path);
|
||||||
|
|
||||||
gltx->gl_fb_texturenum = 0;
|
gltx->gl_fb_texturenum = 0;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ Mod_LoadExternalTextures (model_t *mod, texture_t *tx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gl_Mod_ProcessTexture (texture_t *tx)
|
gl_Mod_ProcessTexture (model_t *mod, texture_t *tx)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ gl_Mod_ProcessTexture (texture_t *tx)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (gl_textures_external && gl_textures_external->int_val) {
|
if (gl_textures_external && gl_textures_external->int_val) {
|
||||||
if (Mod_LoadExternalTextures (loadmodel, tx)) {
|
if (Mod_LoadExternalTextures (mod, tx)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ gl_Mod_ProcessTexture (texture_t *tx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gl_Mod_LoadLighting (bsp_t *bsp)
|
gl_Mod_LoadLighting (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
byte d;
|
byte d;
|
||||||
byte *in, *out, *data;
|
byte *in, *out, *data;
|
||||||
|
@ -151,13 +151,13 @@ gl_Mod_LoadLighting (bsp_t *bsp)
|
||||||
int ver;
|
int ver;
|
||||||
QFile *lit_file;
|
QFile *lit_file;
|
||||||
|
|
||||||
dstring_copystr (litfilename, loadmodel->name);
|
dstring_copystr (litfilename, mod->path);
|
||||||
loadmodel->lightdata = NULL;
|
mod->lightdata = NULL;
|
||||||
if (mod_lightmap_bytes > 1) {
|
if (mod_lightmap_bytes > 1) {
|
||||||
// LordHavoc: check for a .lit file to load
|
// LordHavoc: check for a .lit file to load
|
||||||
QFS_StripExtension (litfilename->str, litfilename->str);
|
QFS_StripExtension (litfilename->str, litfilename->str);
|
||||||
dstring_appendstr (litfilename, ".lit");
|
dstring_appendstr (litfilename, ".lit");
|
||||||
lit_file = QFS_VOpenFile (litfilename->str, 0, loadmodel->vpath);
|
lit_file = QFS_VOpenFile (litfilename->str, 0, mod->vpath);
|
||||||
data = (byte *) QFS_LoadHunkFile (lit_file);
|
data = (byte *) QFS_LoadHunkFile (lit_file);
|
||||||
if (data) {
|
if (data) {
|
||||||
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I'
|
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I'
|
||||||
|
@ -165,7 +165,7 @@ gl_Mod_LoadLighting (bsp_t *bsp)
|
||||||
ver = LittleLong (((int32_t *) data)[1]);
|
ver = LittleLong (((int32_t *) data)[1]);
|
||||||
if (ver == 1) {
|
if (ver == 1) {
|
||||||
Sys_MaskPrintf (SYS_DEV, "%s loaded", litfilename->str);
|
Sys_MaskPrintf (SYS_DEV, "%s loaded", litfilename->str);
|
||||||
loadmodel->lightdata = data + 8;
|
mod->lightdata = data + 8;
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
Sys_MaskPrintf (SYS_DEV,
|
Sys_MaskPrintf (SYS_DEV,
|
||||||
|
@ -179,11 +179,10 @@ gl_Mod_LoadLighting (bsp_t *bsp)
|
||||||
dstring_delete (litfilename);
|
dstring_delete (litfilename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadmodel->lightdata = Hunk_AllocName (bsp->lightdatasize
|
mod->lightdata = Hunk_AllocName (bsp->lightdatasize * mod_lightmap_bytes,
|
||||||
* mod_lightmap_bytes,
|
litfilename->str);
|
||||||
litfilename->str);
|
|
||||||
in = bsp->lightdata;
|
in = bsp->lightdata;
|
||||||
out = loadmodel->lightdata;
|
out = mod->lightdata;
|
||||||
|
|
||||||
if (mod_lightmap_bytes > 1)
|
if (mod_lightmap_bytes > 1)
|
||||||
for (i = 0; i < bsp->lightdatasize ; i++) {
|
for (i = 0; i < bsp->lightdatasize ; i++) {
|
||||||
|
@ -304,7 +303,7 @@ SubdividePolygon (int numverts, float *verts)
|
||||||
can be done reasonably.
|
can be done reasonably.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gl_Mod_SubdivideSurface (msurface_t *fa)
|
gl_Mod_SubdivideSurface (model_t *mod, msurface_t *fa)
|
||||||
{
|
{
|
||||||
float *vec;
|
float *vec;
|
||||||
int lindex, numverts, i;
|
int lindex, numverts, i;
|
||||||
|
@ -315,12 +314,12 @@ gl_Mod_SubdivideSurface (msurface_t *fa)
|
||||||
// convert edges back to a normal polygon
|
// convert edges back to a normal polygon
|
||||||
numverts = 0;
|
numverts = 0;
|
||||||
for (i = 0; i < fa->numedges; i++) {
|
for (i = 0; i < fa->numedges; i++) {
|
||||||
lindex = loadmodel->surfedges[fa->firstedge + i];
|
lindex = mod->surfedges[fa->firstedge + i];
|
||||||
|
|
||||||
if (lindex > 0)
|
if (lindex > 0)
|
||||||
vec = loadmodel->vertexes[loadmodel->edges[lindex].v[0]].position;
|
vec = mod->vertexes[mod->edges[lindex].v[0]].position;
|
||||||
else
|
else
|
||||||
vec = loadmodel->vertexes[loadmodel->edges[-lindex].v[1]].position;
|
vec = mod->vertexes[mod->edges[-lindex].v[1]].position;
|
||||||
VectorCopy (vec, verts[numverts]);
|
VectorCopy (vec, verts[numverts]);
|
||||||
numverts++;
|
numverts++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ load_skytex (texture_t *tx, byte *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
glsl_Mod_ProcessTexture (texture_t *tx)
|
glsl_Mod_ProcessTexture (model_t *mod, texture_t *tx)
|
||||||
{
|
{
|
||||||
if (!tx) {
|
if (!tx) {
|
||||||
r_notexture_mip->render = &glsl_notexture;
|
r_notexture_mip->render = &glsl_notexture;
|
||||||
|
@ -145,15 +145,15 @@ glsl_Mod_ProcessTexture (texture_t *tx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
glsl_Mod_LoadLighting (bsp_t *bsp)
|
glsl_Mod_LoadLighting (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
// a bit hacky, but it's as good a place as any
|
// a bit hacky, but it's as good a place as any
|
||||||
loadmodel->clear = glsl_brush_clear;
|
mod->clear = glsl_brush_clear;
|
||||||
mod_lightmap_bytes = 1;
|
mod_lightmap_bytes = 1;
|
||||||
if (!bsp->lightdatasize) {
|
if (!bsp->lightdatasize) {
|
||||||
loadmodel->lightdata = NULL;
|
mod->lightdata = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadmodel->lightdata = Hunk_AllocName (bsp->lightdatasize, loadname);
|
mod->lightdata = Hunk_AllocName (bsp->lightdatasize, mod->name);
|
||||||
memcpy (loadmodel->lightdata, bsp->lightdata, bsp->lightdatasize);
|
memcpy (mod->lightdata, bsp->lightdata, bsp->lightdatasize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,9 @@
|
||||||
#include "QF/plugin/vid_render.h"
|
#include "QF/plugin/vid_render.h"
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
#include "mod_internal.h"
|
||||||
|
|
||||||
byte mod_novis[MAX_MAP_LEAFS / 8];
|
static byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||||
|
|
||||||
VISIBLE cvar_t *gl_sky_divide; //FIXME visibility?
|
VISIBLE cvar_t *gl_sky_divide; //FIXME visibility?
|
||||||
VISIBLE int mod_lightmap_bytes = 1; //FIXME should this be visible?
|
VISIBLE int mod_lightmap_bytes = 1; //FIXME should this be visible?
|
||||||
|
@ -122,8 +123,12 @@ Mod_DecompressVis (byte * in, model_t *model)
|
||||||
VISIBLE byte *
|
VISIBLE byte *
|
||||||
Mod_LeafPVS (mleaf_t *leaf, model_t *model)
|
Mod_LeafPVS (mleaf_t *leaf, model_t *model)
|
||||||
{
|
{
|
||||||
if (leaf == model->leafs)
|
if (leaf == model->leafs) {
|
||||||
|
if (!mod_novis[0]) {
|
||||||
|
memset (mod_novis, 0xff, sizeof (mod_novis));
|
||||||
|
}
|
||||||
return mod_novis;
|
return mod_novis;
|
||||||
|
}
|
||||||
return Mod_DecompressVis (leaf->compressed_vis, model);
|
return Mod_DecompressVis (leaf->compressed_vis, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +163,7 @@ mod_unique_miptex_name (texture_t **textures, texture_t *tx, int ind)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadTextures (bsp_t *bsp)
|
Mod_LoadTextures (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
dmiptexlump_t *m;
|
dmiptexlump_t *m;
|
||||||
int i, j, pixels, num, max, altmax;
|
int i, j, pixels, num, max, altmax;
|
||||||
|
@ -167,14 +172,14 @@ Mod_LoadTextures (bsp_t *bsp)
|
||||||
texture_t *anims[10], *altanims[10];
|
texture_t *anims[10], *altanims[10];
|
||||||
|
|
||||||
if (!bsp->texdatasize) {
|
if (!bsp->texdatasize) {
|
||||||
loadmodel->textures = NULL;
|
mod->textures = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m = (dmiptexlump_t *) bsp->texdata;
|
m = (dmiptexlump_t *) bsp->texdata;
|
||||||
|
|
||||||
loadmodel->numtextures = m->nummiptex;
|
mod->numtextures = m->nummiptex;
|
||||||
loadmodel->textures = Hunk_AllocName (m->nummiptex * sizeof
|
mod->textures = Hunk_AllocName (m->nummiptex * sizeof (*mod->textures),
|
||||||
(*loadmodel->textures), loadname);
|
mod->name);
|
||||||
|
|
||||||
for (i = 0; i < m->nummiptex; i++) {
|
for (i = 0; i < m->nummiptex; i++) {
|
||||||
if (m->dataofs[i] == -1)
|
if (m->dataofs[i] == -1)
|
||||||
|
@ -188,12 +193,12 @@ Mod_LoadTextures (bsp_t *bsp)
|
||||||
if ((mt->width & 15) || (mt->height & 15))
|
if ((mt->width & 15) || (mt->height & 15))
|
||||||
Sys_Error ("Texture %s is not 16 aligned", mt->name);
|
Sys_Error ("Texture %s is not 16 aligned", mt->name);
|
||||||
pixels = mt->width * mt->height / 64 * 85;
|
pixels = mt->width * mt->height / 64 * 85;
|
||||||
tx = Hunk_AllocName (sizeof (texture_t) + pixels, loadname);
|
tx = Hunk_AllocName (sizeof (texture_t) + pixels, mod->name);
|
||||||
|
|
||||||
loadmodel->textures[i] = tx;
|
mod->textures[i] = tx;
|
||||||
|
|
||||||
tx->name = strndup(mt->name, sizeof (mt->name));
|
tx->name = strndup(mt->name, sizeof (mt->name));
|
||||||
mod_unique_miptex_name (loadmodel->textures, tx, i);
|
mod_unique_miptex_name (mod->textures, tx, i);
|
||||||
tx->width = mt->width;
|
tx->width = mt->width;
|
||||||
tx->height = mt->height;
|
tx->height = mt->height;
|
||||||
for (j = 0; j < MIPLEVELS; j++)
|
for (j = 0; j < MIPLEVELS; j++)
|
||||||
|
@ -203,28 +208,28 @@ Mod_LoadTextures (bsp_t *bsp)
|
||||||
memcpy (tx + 1, mt + 1, pixels);
|
memcpy (tx + 1, mt + 1, pixels);
|
||||||
|
|
||||||
if (!strncmp (mt->name, "sky", 3))
|
if (!strncmp (mt->name, "sky", 3))
|
||||||
loadmodel->skytexture = tx;
|
mod->skytexture = tx;
|
||||||
}
|
}
|
||||||
if (mod_funcs && mod_funcs->Mod_ProcessTexture) {
|
if (mod_funcs && mod_funcs->Mod_ProcessTexture) {
|
||||||
size_t render_size = mod_funcs->texture_render_size;
|
size_t render_size = mod_funcs->texture_render_size;
|
||||||
byte *render_data = 0;
|
byte *render_data = 0;
|
||||||
if (render_size) {
|
if (render_size) {
|
||||||
render_data = Hunk_AllocName (m->nummiptex * render_size,
|
render_data = Hunk_AllocName (m->nummiptex * render_size,
|
||||||
loadname);
|
mod->name);
|
||||||
}
|
}
|
||||||
for (i = 0; i < m->nummiptex; i++) {
|
for (i = 0; i < m->nummiptex; i++) {
|
||||||
tx = loadmodel->textures[i];
|
tx = mod->textures[i];
|
||||||
tx->render = render_data;
|
tx->render = render_data;
|
||||||
render_data += render_size;
|
render_data += render_size;
|
||||||
mod_funcs->Mod_ProcessTexture (tx);
|
mod_funcs->Mod_ProcessTexture (mod, tx);
|
||||||
}
|
}
|
||||||
// signal the end of the textures
|
// signal the end of the textures
|
||||||
mod_funcs->Mod_ProcessTexture (0);
|
mod_funcs->Mod_ProcessTexture (mod, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// sequence the animations
|
// sequence the animations
|
||||||
for (i = 0; i < m->nummiptex; i++) {
|
for (i = 0; i < m->nummiptex; i++) {
|
||||||
tx = loadmodel->textures[i];
|
tx = mod->textures[i];
|
||||||
if (!tx || tx->name[0] != '+')
|
if (!tx || tx->name[0] != '+')
|
||||||
continue;
|
continue;
|
||||||
if (tx->anim_next)
|
if (tx->anim_next)
|
||||||
|
@ -251,7 +256,7 @@ Mod_LoadTextures (bsp_t *bsp)
|
||||||
Sys_Error ("Bad animating texture %s", tx->name);
|
Sys_Error ("Bad animating texture %s", tx->name);
|
||||||
|
|
||||||
for (j = i + 1; j < m->nummiptex; j++) {
|
for (j = i + 1; j < m->nummiptex; j++) {
|
||||||
tx2 = loadmodel->textures[j];
|
tx2 = mod->textures[j];
|
||||||
if (!tx2 || tx2->name[0] != '+')
|
if (!tx2 || tx2->name[0] != '+')
|
||||||
continue;
|
continue;
|
||||||
if (strcmp (tx2->name + 2, tx->name + 2))
|
if (strcmp (tx2->name + 2, tx->name + 2))
|
||||||
|
@ -302,29 +307,29 @@ Mod_LoadTextures (bsp_t *bsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadVisibility (bsp_t *bsp)
|
Mod_LoadVisibility (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
if (!bsp->visdatasize) {
|
if (!bsp->visdatasize) {
|
||||||
loadmodel->visdata = NULL;
|
mod->visdata = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadmodel->visdata = Hunk_AllocName (bsp->visdatasize, loadname);
|
mod->visdata = Hunk_AllocName (bsp->visdatasize, mod->name);
|
||||||
memcpy (loadmodel->visdata, bsp->visdata, bsp->visdatasize);
|
memcpy (mod->visdata, bsp->visdata, bsp->visdatasize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadEntities (bsp_t *bsp)
|
Mod_LoadEntities (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
if (!bsp->entdatasize) {
|
if (!bsp->entdatasize) {
|
||||||
loadmodel->entities = NULL;
|
mod->entities = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadmodel->entities = Hunk_AllocName (bsp->entdatasize, loadname);
|
mod->entities = Hunk_AllocName (bsp->entdatasize, mod->name);
|
||||||
memcpy (loadmodel->entities, bsp->entdata, bsp->entdatasize);
|
memcpy (mod->entities, bsp->entdata, bsp->entdatasize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadVertexes (bsp_t *bsp)
|
Mod_LoadVertexes (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
dvertex_t *in;
|
dvertex_t *in;
|
||||||
int count, i;
|
int count, i;
|
||||||
|
@ -332,27 +337,27 @@ Mod_LoadVertexes (bsp_t *bsp)
|
||||||
|
|
||||||
in = bsp->vertexes;
|
in = bsp->vertexes;
|
||||||
count = bsp->numvertexes;
|
count = bsp->numvertexes;
|
||||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||||
|
|
||||||
loadmodel->vertexes = out;
|
mod->vertexes = out;
|
||||||
loadmodel->numvertexes = count;
|
mod->numvertexes = count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++)
|
for (i = 0; i < count; i++, in++, out++)
|
||||||
VectorCopy (in->point, out->position);
|
VectorCopy (in->point, out->position);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadSubmodels (bsp_t *bsp)
|
Mod_LoadSubmodels (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
dmodel_t *in, *out;
|
dmodel_t *in, *out;
|
||||||
int count, i, j;
|
int count, i, j;
|
||||||
|
|
||||||
in = bsp->models;
|
in = bsp->models;
|
||||||
count = bsp->nummodels;
|
count = bsp->nummodels;
|
||||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||||
|
|
||||||
loadmodel->submodels = out;
|
mod->submodels = out;
|
||||||
loadmodel->numsubmodels = count;
|
mod->numsubmodels = count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++) {
|
for (i = 0; i < count; i++, in++, out++) {
|
||||||
static vec3_t offset = {1, 1, 1};
|
static vec3_t offset = {1, 1, 1};
|
||||||
|
@ -367,11 +372,11 @@ Mod_LoadSubmodels (bsp_t *bsp)
|
||||||
out->numfaces = in->numfaces;
|
out->numfaces = in->numfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
out = loadmodel->submodels;
|
out = mod->submodels;
|
||||||
|
|
||||||
if (out->visleafs > MAX_MAP_LEAFS) {
|
if (out->visleafs > MAX_MAP_LEAFS) {
|
||||||
Sys_Error ("Mod_LoadSubmodels: too many visleafs (%d, max = %d) in %s",
|
Sys_Error ("Mod_LoadSubmodels: too many visleafs (%d, max = %d) in %s",
|
||||||
out->visleafs, MAX_MAP_LEAFS, loadmodel->name);
|
out->visleafs, MAX_MAP_LEAFS, mod->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out->visleafs > 8192)
|
if (out->visleafs > 8192)
|
||||||
|
@ -381,7 +386,7 @@ Mod_LoadSubmodels (bsp_t *bsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadEdges (bsp_t *bsp)
|
Mod_LoadEdges (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
dedge_t *in;
|
dedge_t *in;
|
||||||
int count, i;
|
int count, i;
|
||||||
|
@ -389,10 +394,10 @@ Mod_LoadEdges (bsp_t *bsp)
|
||||||
|
|
||||||
in = bsp->edges;
|
in = bsp->edges;
|
||||||
count = bsp->numedges;
|
count = bsp->numedges;
|
||||||
out = Hunk_AllocName ((count + 1) * sizeof (*out), loadname);
|
out = Hunk_AllocName ((count + 1) * sizeof (*out), mod->name);
|
||||||
|
|
||||||
loadmodel->edges = out;
|
mod->edges = out;
|
||||||
loadmodel->numedges = count;
|
mod->numedges = count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++) {
|
for (i = 0; i < count; i++, in++, out++) {
|
||||||
out->v[0] = in->v[0];
|
out->v[0] = in->v[0];
|
||||||
|
@ -401,7 +406,7 @@ Mod_LoadEdges (bsp_t *bsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadTexinfo (bsp_t *bsp)
|
Mod_LoadTexinfo (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
float len1, len2;
|
float len1, len2;
|
||||||
int count, miptex, i, j;
|
int count, miptex, i, j;
|
||||||
|
@ -410,10 +415,10 @@ Mod_LoadTexinfo (bsp_t *bsp)
|
||||||
|
|
||||||
in = bsp->texinfo;
|
in = bsp->texinfo;
|
||||||
count = bsp->numtexinfo;
|
count = bsp->numtexinfo;
|
||||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||||
|
|
||||||
loadmodel->texinfo = out;
|
mod->texinfo = out;
|
||||||
loadmodel->numtexinfo = count;
|
mod->numtexinfo = count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++) {
|
for (i = 0; i < count; i++, in++, out++) {
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
|
@ -436,13 +441,13 @@ Mod_LoadTexinfo (bsp_t *bsp)
|
||||||
miptex = in->miptex;
|
miptex = in->miptex;
|
||||||
out->flags = in->flags;
|
out->flags = in->flags;
|
||||||
|
|
||||||
if (!loadmodel->textures) {
|
if (!mod->textures) {
|
||||||
out->texture = r_notexture_mip; // checkerboard texture
|
out->texture = r_notexture_mip; // checkerboard texture
|
||||||
out->flags = 0;
|
out->flags = 0;
|
||||||
} else {
|
} else {
|
||||||
if (miptex >= loadmodel->numtextures)
|
if (miptex >= mod->numtextures)
|
||||||
Sys_Error ("miptex >= loadmodel->numtextures");
|
Sys_Error ("miptex >= mod->numtextures");
|
||||||
out->texture = loadmodel->textures[miptex];
|
out->texture = mod->textures[miptex];
|
||||||
if (!out->texture) {
|
if (!out->texture) {
|
||||||
out->texture = r_notexture_mip; // texture not found
|
out->texture = r_notexture_mip; // texture not found
|
||||||
out->flags = 0;
|
out->flags = 0;
|
||||||
|
@ -457,7 +462,7 @@ Mod_LoadTexinfo (bsp_t *bsp)
|
||||||
Fills in s->texturemins[] and s->extents[]
|
Fills in s->texturemins[] and s->extents[]
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CalcSurfaceExtents (msurface_t *s)
|
CalcSurfaceExtents (model_t *mod, msurface_t *s)
|
||||||
{
|
{
|
||||||
float mins[2], maxs[2], val;
|
float mins[2], maxs[2], val;
|
||||||
int e, i, j;
|
int e, i, j;
|
||||||
|
@ -471,11 +476,11 @@ CalcSurfaceExtents (msurface_t *s)
|
||||||
tex = s->texinfo;
|
tex = s->texinfo;
|
||||||
|
|
||||||
for (i = 0; i < s->numedges; i++) {
|
for (i = 0; i < s->numedges; i++) {
|
||||||
e = loadmodel->surfedges[s->firstedge + i];
|
e = mod->surfedges[s->firstedge + i];
|
||||||
if (e >= 0)
|
if (e >= 0)
|
||||||
v = &loadmodel->vertexes[loadmodel->edges[e].v[0]];
|
v = &mod->vertexes[mod->edges[e].v[0]];
|
||||||
else
|
else
|
||||||
v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]];
|
v = &mod->vertexes[mod->edges[-e].v[1]];
|
||||||
|
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
val = v->position[0] * tex->vecs[j][0] +
|
val = v->position[0] * tex->vecs[j][0] +
|
||||||
|
@ -502,7 +507,7 @@ CalcSurfaceExtents (msurface_t *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadFaces (bsp_t *bsp)
|
Mod_LoadFaces (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
dface_t *in;
|
dface_t *in;
|
||||||
int count, planenum, side, surfnum, i;
|
int count, planenum, side, surfnum, i;
|
||||||
|
@ -510,15 +515,15 @@ Mod_LoadFaces (bsp_t *bsp)
|
||||||
|
|
||||||
in = bsp->faces;
|
in = bsp->faces;
|
||||||
count = bsp->numfaces;
|
count = bsp->numfaces;
|
||||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||||
|
|
||||||
if (count > 32767) {
|
if (count > 32767) {
|
||||||
Sys_MaskPrintf (SYS_WARN,
|
Sys_MaskPrintf (SYS_WARN,
|
||||||
"%i faces exceeds standard limit of 32767.\n", count);
|
"%i faces exceeds standard limit of 32767.\n", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadmodel->surfaces = out;
|
mod->surfaces = out;
|
||||||
loadmodel->numsurfaces = count;
|
mod->numsurfaces = count;
|
||||||
|
|
||||||
for (surfnum = 0; surfnum < count; surfnum++, in++, out++) {
|
for (surfnum = 0; surfnum < count; surfnum++, in++, out++) {
|
||||||
out->firstedge = in->firstedge;
|
out->firstedge = in->firstedge;
|
||||||
|
@ -530,11 +535,11 @@ Mod_LoadFaces (bsp_t *bsp)
|
||||||
if (side)
|
if (side)
|
||||||
out->flags |= SURF_PLANEBACK;
|
out->flags |= SURF_PLANEBACK;
|
||||||
|
|
||||||
out->plane = loadmodel->planes + planenum;
|
out->plane = mod->planes + planenum;
|
||||||
|
|
||||||
out->texinfo = loadmodel->texinfo + in->texinfo;
|
out->texinfo = mod->texinfo + in->texinfo;
|
||||||
|
|
||||||
CalcSurfaceExtents (out);
|
CalcSurfaceExtents (mod, out);
|
||||||
|
|
||||||
// lighting info
|
// lighting info
|
||||||
|
|
||||||
|
@ -544,7 +549,7 @@ Mod_LoadFaces (bsp_t *bsp)
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
out->samples = NULL;
|
out->samples = NULL;
|
||||||
else
|
else
|
||||||
out->samples = loadmodel->lightdata + (i * mod_lightmap_bytes);
|
out->samples = mod->lightdata + (i * mod_lightmap_bytes);
|
||||||
|
|
||||||
// set the drawing flags flag
|
// set the drawing flags flag
|
||||||
if (!out->texinfo->texture || !out->texinfo->texture->name)
|
if (!out->texinfo->texture || !out->texinfo->texture->name)
|
||||||
|
@ -554,7 +559,7 @@ Mod_LoadFaces (bsp_t *bsp)
|
||||||
out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED);
|
out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED);
|
||||||
if (gl_sky_divide && gl_sky_divide->int_val)
|
if (gl_sky_divide && gl_sky_divide->int_val)
|
||||||
if (mod_funcs && mod_funcs->Mod_SubdivideSurface)
|
if (mod_funcs && mod_funcs->Mod_SubdivideSurface)
|
||||||
mod_funcs->Mod_SubdivideSurface (out);
|
mod_funcs->Mod_SubdivideSurface (mod, out);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,7 +573,7 @@ Mod_LoadFaces (bsp_t *bsp)
|
||||||
}
|
}
|
||||||
if (mod_funcs && mod_funcs->Mod_SubdivideSurface) {
|
if (mod_funcs && mod_funcs->Mod_SubdivideSurface) {
|
||||||
// cut up polygon for warps
|
// cut up polygon for warps
|
||||||
mod_funcs->Mod_SubdivideSurface (out);
|
mod_funcs->Mod_SubdivideSurface (mod, out);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -586,7 +591,7 @@ Mod_SetParent (mnode_t *node, mnode_t *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadNodes (bsp_t *bsp)
|
Mod_LoadNodes (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
dnode_t *in;
|
dnode_t *in;
|
||||||
int count, i, j, p;
|
int count, i, j, p;
|
||||||
|
@ -594,15 +599,15 @@ Mod_LoadNodes (bsp_t *bsp)
|
||||||
|
|
||||||
in = bsp->nodes;
|
in = bsp->nodes;
|
||||||
count = bsp->numnodes;
|
count = bsp->numnodes;
|
||||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||||
|
|
||||||
if (count > 32767) {
|
if (count > 32767) {
|
||||||
Sys_MaskPrintf (SYS_WARN,
|
Sys_MaskPrintf (SYS_WARN,
|
||||||
"%i nodes exceeds standard limit of 32767.\n", count);
|
"%i nodes exceeds standard limit of 32767.\n", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadmodel->nodes = out;
|
mod->nodes = out;
|
||||||
loadmodel->numnodes = count;
|
mod->numnodes = count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++) {
|
for (i = 0; i < count; i++, in++, out++) {
|
||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
|
@ -611,7 +616,7 @@ Mod_LoadNodes (bsp_t *bsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
p = in->planenum;
|
p = in->planenum;
|
||||||
out->plane = loadmodel->planes + p;
|
out->plane = mod->planes + p;
|
||||||
|
|
||||||
out->firstsurface = in->firstface;
|
out->firstsurface = in->firstface;
|
||||||
out->numsurfaces = in->numfaces;
|
out->numsurfaces = in->numfaces;
|
||||||
|
@ -620,27 +625,27 @@ Mod_LoadNodes (bsp_t *bsp)
|
||||||
p = in->children[j];
|
p = in->children[j];
|
||||||
// this check is for extended bsp 29 files
|
// this check is for extended bsp 29 files
|
||||||
if (p >= 0) {
|
if (p >= 0) {
|
||||||
out->children[j] = loadmodel->nodes + p;
|
out->children[j] = mod->nodes + p;
|
||||||
} else {
|
} else {
|
||||||
p = ~p;
|
p = ~p;
|
||||||
if (p < loadmodel->numleafs) {
|
if (p < mod->numleafs) {
|
||||||
out->children[j] = (mnode_t *) (loadmodel->leafs + p);
|
out->children[j] = (mnode_t *) (mod->leafs + p);
|
||||||
} else {
|
} else {
|
||||||
Sys_Printf ("Mod_LoadNodes: invalid leaf index %i "
|
Sys_Printf ("Mod_LoadNodes: invalid leaf index %i "
|
||||||
"(file has only %i leafs)\n", p,
|
"(file has only %i leafs)\n", p,
|
||||||
loadmodel->numleafs);
|
mod->numleafs);
|
||||||
//map it to the solid leaf
|
//map it to the solid leaf
|
||||||
out->children[j] = (mnode_t *)(loadmodel->leafs);
|
out->children[j] = (mnode_t *)(mod->leafs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs
|
Mod_SetParent (mod->nodes, NULL); // sets nodes and leafs
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadLeafs (bsp_t *bsp)
|
Mod_LoadLeafs (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
dleaf_t *in;
|
dleaf_t *in;
|
||||||
int count, i, j, p;
|
int count, i, j, p;
|
||||||
|
@ -649,13 +654,13 @@ Mod_LoadLeafs (bsp_t *bsp)
|
||||||
|
|
||||||
in = bsp->leafs;
|
in = bsp->leafs;
|
||||||
count = bsp->numleafs;
|
count = bsp->numleafs;
|
||||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||||
|
|
||||||
loadmodel->leafs = out;
|
mod->leafs = out;
|
||||||
loadmodel->numleafs = count;
|
mod->numleafs = count;
|
||||||
// snprintf(s, sizeof (s), "maps/%s.bsp",
|
// snprintf(s, sizeof (s), "maps/%s.bsp",
|
||||||
// Info_ValueForKey(cl.serverinfo,"map"));
|
// Info_ValueForKey(cl.serverinfo,"map"));
|
||||||
if (!strncmp ("maps/", loadmodel->name, 5))
|
if (!strncmp ("maps/", mod->path, 5))
|
||||||
isnotmap = false;
|
isnotmap = false;
|
||||||
for (i = 0; i < count; i++, in++, out++) {
|
for (i = 0; i < count; i++, in++, out++) {
|
||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
|
@ -666,14 +671,14 @@ Mod_LoadLeafs (bsp_t *bsp)
|
||||||
p = in->contents;
|
p = in->contents;
|
||||||
out->contents = p;
|
out->contents = p;
|
||||||
|
|
||||||
out->firstmarksurface = loadmodel->marksurfaces + in->firstmarksurface;
|
out->firstmarksurface = mod->marksurfaces + in->firstmarksurface;
|
||||||
out->nummarksurfaces = in->nummarksurfaces;
|
out->nummarksurfaces = in->nummarksurfaces;
|
||||||
|
|
||||||
p = in->visofs;
|
p = in->visofs;
|
||||||
if (p == -1)
|
if (p == -1)
|
||||||
out->compressed_vis = NULL;
|
out->compressed_vis = NULL;
|
||||||
else
|
else
|
||||||
out->compressed_vis = loadmodel->visdata + p;
|
out->compressed_vis = mod->visdata + p;
|
||||||
out->efrags = NULL;
|
out->efrags = NULL;
|
||||||
|
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
|
@ -692,7 +697,7 @@ Mod_LoadLeafs (bsp_t *bsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadClipnodes (bsp_t *bsp)
|
Mod_LoadClipnodes (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
dclipnode_t *in;
|
dclipnode_t *in;
|
||||||
mclipnode_t *out;
|
mclipnode_t *out;
|
||||||
|
@ -701,7 +706,7 @@ Mod_LoadClipnodes (bsp_t *bsp)
|
||||||
|
|
||||||
in = bsp->clipnodes;
|
in = bsp->clipnodes;
|
||||||
count = bsp->numclipnodes;
|
count = bsp->numclipnodes;
|
||||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||||
|
|
||||||
if (count > 32767) {
|
if (count > 32767) {
|
||||||
Sys_MaskPrintf (SYS_WARN,
|
Sys_MaskPrintf (SYS_WARN,
|
||||||
|
@ -709,15 +714,15 @@ Mod_LoadClipnodes (bsp_t *bsp)
|
||||||
count);
|
count);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadmodel->clipnodes = out;
|
mod->clipnodes = out;
|
||||||
loadmodel->numclipnodes = count;
|
mod->numclipnodes = count;
|
||||||
|
|
||||||
hull = &loadmodel->hulls[1];
|
hull = &mod->hulls[1];
|
||||||
loadmodel->hull_list[1] = hull;
|
mod->hull_list[1] = hull;
|
||||||
hull->clipnodes = out;
|
hull->clipnodes = out;
|
||||||
hull->firstclipnode = 0;
|
hull->firstclipnode = 0;
|
||||||
hull->lastclipnode = count - 1;
|
hull->lastclipnode = count - 1;
|
||||||
hull->planes = loadmodel->planes;
|
hull->planes = mod->planes;
|
||||||
hull->clip_mins[0] = -16;
|
hull->clip_mins[0] = -16;
|
||||||
hull->clip_mins[1] = -16;
|
hull->clip_mins[1] = -16;
|
||||||
hull->clip_mins[2] = -24;
|
hull->clip_mins[2] = -24;
|
||||||
|
@ -725,12 +730,12 @@ Mod_LoadClipnodes (bsp_t *bsp)
|
||||||
hull->clip_maxs[1] = 16;
|
hull->clip_maxs[1] = 16;
|
||||||
hull->clip_maxs[2] = 32;
|
hull->clip_maxs[2] = 32;
|
||||||
|
|
||||||
hull = &loadmodel->hulls[2];
|
hull = &mod->hulls[2];
|
||||||
loadmodel->hull_list[2] = hull;
|
mod->hull_list[2] = hull;
|
||||||
hull->clipnodes = out;
|
hull->clipnodes = out;
|
||||||
hull->firstclipnode = 0;
|
hull->firstclipnode = 0;
|
||||||
hull->lastclipnode = count - 1;
|
hull->lastclipnode = count - 1;
|
||||||
hull->planes = loadmodel->planes;
|
hull->planes = mod->planes;
|
||||||
hull->clip_mins[0] = -32;
|
hull->clip_mins[0] = -32;
|
||||||
hull->clip_mins[1] = -32;
|
hull->clip_mins[1] = -32;
|
||||||
hull->clip_mins[2] = -24;
|
hull->clip_mins[2] = -24;
|
||||||
|
@ -740,7 +745,7 @@ Mod_LoadClipnodes (bsp_t *bsp)
|
||||||
|
|
||||||
for (i = 0; i < count; i++, out++, in++) {
|
for (i = 0; i < count; i++, out++, in++) {
|
||||||
out->planenum = in->planenum;
|
out->planenum = in->planenum;
|
||||||
if (out->planenum < 0 || out->planenum >= loadmodel->numplanes)
|
if (out->planenum < 0 || out->planenum >= mod->numplanes)
|
||||||
Sys_Error ("Mod_LoadClipnodes: planenum out of bounds");
|
Sys_Error ("Mod_LoadClipnodes: planenum out of bounds");
|
||||||
out->children[0] = in->children[0];
|
out->children[0] = in->children[0];
|
||||||
out->children[1] = in->children[1];
|
out->children[1] = in->children[1];
|
||||||
|
@ -765,39 +770,39 @@ Mod_LoadClipnodes (bsp_t *bsp)
|
||||||
Replicate the drawing hull structure as a clipping hull
|
Replicate the drawing hull structure as a clipping hull
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Mod_MakeHull0 (void)
|
Mod_MakeHull0 (model_t *mod)
|
||||||
{
|
{
|
||||||
mclipnode_t *out;
|
mclipnode_t *out;
|
||||||
hull_t *hull;
|
hull_t *hull;
|
||||||
int count, i, j;
|
int count, i, j;
|
||||||
mnode_t *in, *child;
|
mnode_t *in, *child;
|
||||||
|
|
||||||
hull = &loadmodel->hulls[0];
|
hull = &mod->hulls[0];
|
||||||
loadmodel->hull_list[0] = hull;
|
mod->hull_list[0] = hull;
|
||||||
|
|
||||||
in = loadmodel->nodes;
|
in = mod->nodes;
|
||||||
count = loadmodel->numnodes;
|
count = mod->numnodes;
|
||||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||||
|
|
||||||
hull->clipnodes = out;
|
hull->clipnodes = out;
|
||||||
hull->firstclipnode = 0;
|
hull->firstclipnode = 0;
|
||||||
hull->lastclipnode = count - 1;
|
hull->lastclipnode = count - 1;
|
||||||
hull->planes = loadmodel->planes;
|
hull->planes = mod->planes;
|
||||||
|
|
||||||
for (i = 0; i < count; i++, out++, in++) {
|
for (i = 0; i < count; i++, out++, in++) {
|
||||||
out->planenum = in->plane - loadmodel->planes;
|
out->planenum = in->plane - mod->planes;
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
child = in->children[j];
|
child = in->children[j];
|
||||||
if (child->contents < 0)
|
if (child->contents < 0)
|
||||||
out->children[j] = child->contents;
|
out->children[j] = child->contents;
|
||||||
else
|
else
|
||||||
out->children[j] = child - loadmodel->nodes;
|
out->children[j] = child - mod->nodes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadMarksurfaces (bsp_t *bsp)
|
Mod_LoadMarksurfaces (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
int count, i, j;
|
int count, i, j;
|
||||||
msurface_t **out;
|
msurface_t **out;
|
||||||
|
@ -805,7 +810,7 @@ Mod_LoadMarksurfaces (bsp_t *bsp)
|
||||||
|
|
||||||
in = bsp->marksurfaces;
|
in = bsp->marksurfaces;
|
||||||
count = bsp->nummarksurfaces;
|
count = bsp->nummarksurfaces;
|
||||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||||
|
|
||||||
if (count > 32767) {
|
if (count > 32767) {
|
||||||
Sys_MaskPrintf (SYS_WARN,
|
Sys_MaskPrintf (SYS_WARN,
|
||||||
|
@ -813,19 +818,19 @@ Mod_LoadMarksurfaces (bsp_t *bsp)
|
||||||
count);
|
count);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadmodel->marksurfaces = out;
|
mod->marksurfaces = out;
|
||||||
loadmodel->nummarksurfaces = count;
|
mod->nummarksurfaces = count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
j = in[i];
|
j = in[i];
|
||||||
if (j >= loadmodel->numsurfaces)
|
if (j >= mod->numsurfaces)
|
||||||
Sys_Error ("Mod_ParseMarksurfaces: bad surface number");
|
Sys_Error ("Mod_ParseMarksurfaces: bad surface number");
|
||||||
out[i] = loadmodel->surfaces + j;
|
out[i] = mod->surfaces + j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadSurfedges (bsp_t *bsp)
|
Mod_LoadSurfedges (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
int count, i;
|
int count, i;
|
||||||
int32_t *in;
|
int32_t *in;
|
||||||
|
@ -833,17 +838,17 @@ Mod_LoadSurfedges (bsp_t *bsp)
|
||||||
|
|
||||||
in = bsp->surfedges;
|
in = bsp->surfedges;
|
||||||
count = bsp->numsurfedges;
|
count = bsp->numsurfedges;
|
||||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||||
|
|
||||||
loadmodel->surfedges = out;
|
mod->surfedges = out;
|
||||||
loadmodel->numsurfedges = count;
|
mod->numsurfedges = count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
out[i] = in[i];
|
out[i] = in[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadPlanes (bsp_t *bsp)
|
Mod_LoadPlanes (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
dplane_t *in;
|
dplane_t *in;
|
||||||
int bits, count, i, j;
|
int bits, count, i, j;
|
||||||
|
@ -851,10 +856,10 @@ Mod_LoadPlanes (bsp_t *bsp)
|
||||||
|
|
||||||
in = bsp->planes;
|
in = bsp->planes;
|
||||||
count = bsp->numplanes;
|
count = bsp->numplanes;
|
||||||
out = Hunk_AllocName (count * 2 * sizeof (*out), loadname);
|
out = Hunk_AllocName (count * 2 * sizeof (*out), mod->name);
|
||||||
|
|
||||||
loadmodel->planes = out;
|
mod->planes = out;
|
||||||
loadmodel->numplanes = count;
|
mod->numplanes = count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++) {
|
for (i = 0; i < count; i++, in++, out++) {
|
||||||
bits = 0;
|
bits = 0;
|
||||||
|
@ -897,22 +902,22 @@ do_checksums (const bsp_t *bsp, void *_mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
recurse_draw_tree (mnode_t *node, int depth)
|
recurse_draw_tree (model_t *mod, mnode_t *node, int depth)
|
||||||
{
|
{
|
||||||
if (!node || node->contents < 0) {
|
if (!node || node->contents < 0) {
|
||||||
if (depth > loadmodel->depth)
|
if (depth > mod->depth)
|
||||||
loadmodel->depth = depth;
|
mod->depth = depth;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
recurse_draw_tree (node->children[0], depth + 1);
|
recurse_draw_tree (mod, node->children[0], depth + 1);
|
||||||
recurse_draw_tree (node->children[1], depth + 1);
|
recurse_draw_tree (mod, node->children[1], depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_FindDrawDepth (void)
|
Mod_FindDrawDepth (model_t *mod)
|
||||||
{
|
{
|
||||||
loadmodel->depth = 0;
|
mod->depth = 0;
|
||||||
recurse_draw_tree (loadmodel->nodes, 1);
|
recurse_draw_tree (mod, mod->nodes, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -922,34 +927,34 @@ Mod_LoadBrushModel (model_t *mod, void *buffer)
|
||||||
int i, j;
|
int i, j;
|
||||||
bsp_t *bsp;
|
bsp_t *bsp;
|
||||||
|
|
||||||
loadmodel->type = mod_brush;
|
mod->type = mod_brush;
|
||||||
|
|
||||||
bsp = LoadBSPMem (buffer, qfs_filesize, do_checksums, mod);
|
bsp = LoadBSPMem (buffer, qfs_filesize, do_checksums, mod);
|
||||||
|
|
||||||
// load into heap
|
// load into heap
|
||||||
Mod_LoadVertexes (bsp);
|
Mod_LoadVertexes (mod, bsp);
|
||||||
Mod_LoadEdges (bsp);
|
Mod_LoadEdges (mod, bsp);
|
||||||
Mod_LoadSurfedges (bsp);
|
Mod_LoadSurfedges (mod, bsp);
|
||||||
Mod_LoadTextures (bsp);
|
Mod_LoadTextures (mod, bsp);
|
||||||
if (mod_funcs && mod_funcs->Mod_LoadLighting) {
|
if (mod_funcs && mod_funcs->Mod_LoadLighting) {
|
||||||
mod_funcs->Mod_LoadLighting (bsp);
|
mod_funcs->Mod_LoadLighting (mod, bsp);
|
||||||
}
|
}
|
||||||
Mod_LoadPlanes (bsp);
|
Mod_LoadPlanes (mod, bsp);
|
||||||
Mod_LoadTexinfo (bsp);
|
Mod_LoadTexinfo (mod, bsp);
|
||||||
Mod_LoadFaces (bsp);
|
Mod_LoadFaces (mod, bsp);
|
||||||
Mod_LoadMarksurfaces (bsp);
|
Mod_LoadMarksurfaces (mod, bsp);
|
||||||
Mod_LoadVisibility (bsp);
|
Mod_LoadVisibility (mod, bsp);
|
||||||
Mod_LoadLeafs (bsp);
|
Mod_LoadLeafs (mod, bsp);
|
||||||
Mod_LoadNodes (bsp);
|
Mod_LoadNodes (mod, bsp);
|
||||||
Mod_LoadClipnodes (bsp);
|
Mod_LoadClipnodes (mod, bsp);
|
||||||
Mod_LoadEntities (bsp);
|
Mod_LoadEntities (mod, bsp);
|
||||||
Mod_LoadSubmodels (bsp);
|
Mod_LoadSubmodels (mod, bsp);
|
||||||
|
|
||||||
BSP_Free(bsp);
|
BSP_Free(bsp);
|
||||||
|
|
||||||
Mod_MakeHull0 ();
|
Mod_MakeHull0 (mod);
|
||||||
|
|
||||||
Mod_FindDrawDepth ();
|
Mod_FindDrawDepth (mod);
|
||||||
for (i = 0; i < MAX_MAP_HULLS; i++)
|
for (i = 0; i < MAX_MAP_HULLS; i++)
|
||||||
Mod_FindClipDepth (&mod->hulls[i]);
|
Mod_FindClipDepth (&mod->hulls[i]);
|
||||||
|
|
||||||
|
@ -984,7 +989,7 @@ Mod_LoadBrushModel (model_t *mod, void *buffer)
|
||||||
snprintf (name, sizeof (name), "*%i", i + 1);
|
snprintf (name, sizeof (name), "*%i", i + 1);
|
||||||
model_t *m = Mod_FindName (name);
|
model_t *m = Mod_FindName (name);
|
||||||
*m = *mod;
|
*m = *mod;
|
||||||
strcpy (m->name, name);
|
strcpy (m->path, name);
|
||||||
mod = m;
|
mod = m;
|
||||||
// make sure clear is called only for the main model
|
// make sure clear is called only for the main model
|
||||||
m->clear = 0;
|
m->clear = 0;
|
||||||
|
|
|
@ -41,13 +41,13 @@
|
||||||
#include "mod_internal.h"
|
#include "mod_internal.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
sw_Mod_LoadLighting (bsp_t *bsp)
|
sw_Mod_LoadLighting (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
mod_lightmap_bytes = 1;
|
mod_lightmap_bytes = 1;
|
||||||
if (!bsp->lightdatasize) {
|
if (!bsp->lightdatasize) {
|
||||||
loadmodel->lightdata = NULL;
|
mod->lightdata = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadmodel->lightdata = Hunk_AllocName (bsp->lightdatasize, loadname);
|
mod->lightdata = Hunk_AllocName (bsp->lightdatasize, mod->name);
|
||||||
memcpy (loadmodel->lightdata, bsp->lightdata, bsp->lightdatasize);
|
memcpy (mod->lightdata, bsp->lightdata, bsp->lightdatasize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,15 +63,15 @@
|
||||||
|
|
||||||
static vulktex_t vulkan_notexture = { };
|
static vulktex_t vulkan_notexture = { };
|
||||||
|
|
||||||
static void vulkan_brush_clear (model_t *model, void *data)
|
static void vulkan_brush_clear (model_t *mod, void *data)
|
||||||
{
|
{
|
||||||
modelctx_t *mctx = data;
|
modelctx_t *mctx = data;
|
||||||
vulkan_ctx_t *ctx = mctx->ctx;
|
vulkan_ctx_t *ctx = mctx->ctx;
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
qfv_devfuncs_t *dfunc = device->funcs;
|
qfv_devfuncs_t *dfunc = device->funcs;
|
||||||
|
|
||||||
for (int i = 0; i < model->numtextures; i++) {
|
for (int i = 0; i < mod->numtextures; i++) {
|
||||||
texture_t *tx = model->textures[i];
|
texture_t *tx = mod->textures[i];
|
||||||
if (!tx) {
|
if (!tx) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -173,19 +173,19 @@ copy_mips (qfv_packet_t *packet, texture_t *tx, qfv_tex_t *tex,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
load_textures (model_t *model, vulkan_ctx_t *ctx)
|
load_textures (model_t *mod, vulkan_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
qfv_devfuncs_t *dfunc = device->funcs;
|
qfv_devfuncs_t *dfunc = device->funcs;
|
||||||
modelctx_t *mctx = model->data;
|
modelctx_t *mctx = mod->data;
|
||||||
VkImage image = 0;
|
VkImage image = 0;
|
||||||
byte *buffer;
|
byte *buffer;
|
||||||
|
|
||||||
size_t image_count = 0;
|
size_t image_count = 0;
|
||||||
size_t copy_count = 0;
|
size_t copy_count = 0;
|
||||||
size_t memsize = 0;
|
size_t memsize = 0;
|
||||||
for (int i = 0; i < model->numtextures; i++) {
|
for (int i = 0; i < mod->numtextures; i++) {
|
||||||
texture_t *tx = model->textures[i];
|
texture_t *tx = mod->textures[i];
|
||||||
if (!tx) {
|
if (!tx) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -211,20 +211,18 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
||||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
||||||
memsize, 0);
|
memsize, 0);
|
||||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_DEVICE_MEMORY,
|
QFV_duSetObjectName (device, VK_OBJECT_TYPE_DEVICE_MEMORY,
|
||||||
mem, va (ctx->va_ctx, "memory:%s:texture",
|
mem, va (ctx->va_ctx, "memory:%s:texture", mod->name));
|
||||||
loadmodel->name));
|
|
||||||
mctx->texture_memory = mem;
|
mctx->texture_memory = mem;
|
||||||
|
|
||||||
qfv_stagebuf_t *stage = QFV_CreateStagingBuffer (device,
|
qfv_stagebuf_t *stage = QFV_CreateStagingBuffer (device,
|
||||||
va (ctx->va_ctx,
|
va (ctx->va_ctx,
|
||||||
"brush:%s",
|
"brush:%s", mod->name),
|
||||||
loadmodel->name),
|
|
||||||
memsize, ctx->cmdpool);
|
memsize, ctx->cmdpool);
|
||||||
qfv_packet_t *packet = QFV_PacketAcquire (stage);
|
qfv_packet_t *packet = QFV_PacketAcquire (stage);
|
||||||
buffer = QFV_PacketExtend (packet, memsize);
|
buffer = QFV_PacketExtend (packet, memsize);
|
||||||
|
|
||||||
for (int i = 0; i < model->numtextures; i++) {
|
for (int i = 0; i < mod->numtextures; i++) {
|
||||||
texture_t *tx = model->textures[i];
|
texture_t *tx = mod->textures[i];
|
||||||
byte *palette = vid.palette32;
|
byte *palette = vid.palette32;
|
||||||
if (!tx) {
|
if (!tx) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -249,7 +247,7 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
||||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE_VIEW,
|
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE_VIEW,
|
||||||
tex->tex->view,
|
tex->tex->view,
|
||||||
va (ctx->va_ctx, "iview:%s:%s:tex",
|
va (ctx->va_ctx, "iview:%s:%s:tex",
|
||||||
loadmodel->name, tx->name));
|
mod->name, tx->name));
|
||||||
transfer_mips (buffer + tex->tex->offset, tx + 1, tx, palette);
|
transfer_mips (buffer + tex->tex->offset, tx + 1, tx, palette);
|
||||||
if (tex->glow) {
|
if (tex->glow) {
|
||||||
dfunc->vkBindImageMemory (device->dev, tex->glow->image, mem,
|
dfunc->vkBindImageMemory (device->dev, tex->glow->image, mem,
|
||||||
|
@ -263,8 +261,7 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
||||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE_VIEW,
|
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE_VIEW,
|
||||||
tex->glow->view,
|
tex->glow->view,
|
||||||
va (ctx->va_ctx, "iview:%s:%s:glow",
|
va (ctx->va_ctx, "iview:%s:%s:glow",
|
||||||
loadmodel->name,
|
mod->name, tx->name));
|
||||||
tx->name));
|
|
||||||
transfer_mips (buffer + tex->glow->offset, tex->glow->memory, tx,
|
transfer_mips (buffer + tex->glow->offset, tex->glow->memory, tx,
|
||||||
palette);
|
palette);
|
||||||
}
|
}
|
||||||
|
@ -278,8 +275,8 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
||||||
|
|
||||||
__auto_type barriers = QFV_AllocImageBarrierSet (image_count, malloc);
|
__auto_type barriers = QFV_AllocImageBarrierSet (image_count, malloc);
|
||||||
barriers->size = 0;
|
barriers->size = 0;
|
||||||
for (int i = 0; i < model->numtextures; i++) {
|
for (int i = 0; i < mod->numtextures; i++) {
|
||||||
texture_t *tx = model->textures[i];
|
texture_t *tx = mod->textures[i];
|
||||||
if (!tx) {
|
if (!tx) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -299,8 +296,8 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
||||||
dfunc->vkCmdPipelineBarrier (packet->cmd, stages.src, stages.dst,
|
dfunc->vkCmdPipelineBarrier (packet->cmd, stages.src, stages.dst,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
barriers->size, barriers->a);
|
barriers->size, barriers->a);
|
||||||
for (int i = 0, j = 0; i < model->numtextures; i++) {
|
for (int i = 0, j = 0; i < mod->numtextures; i++) {
|
||||||
texture_t *tx = model->textures[i];
|
texture_t *tx = mod->textures[i];
|
||||||
if (!tx) {
|
if (!tx) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -330,19 +327,18 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_Mod_ProcessTexture (texture_t *tx, vulkan_ctx_t *ctx)
|
Vulkan_Mod_ProcessTexture (model_t *mod, texture_t *tx, vulkan_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
qfv_device_t *device = ctx->device;
|
qfv_device_t *device = ctx->device;
|
||||||
|
|
||||||
if (!tx) {
|
if (!tx) {
|
||||||
modelctx_t *mctx = Hunk_AllocName (sizeof (modelctx_t),
|
modelctx_t *mctx = Hunk_AllocName (sizeof (modelctx_t), mod->name);
|
||||||
loadmodel->name);
|
|
||||||
mctx->ctx = ctx;
|
mctx->ctx = ctx;
|
||||||
loadmodel->clear = vulkan_brush_clear;
|
mod->clear = vulkan_brush_clear;
|
||||||
loadmodel->data = mctx;
|
mod->data = mctx;
|
||||||
|
|
||||||
r_notexture_mip->render = &vulkan_notexture;
|
r_notexture_mip->render = &vulkan_notexture;
|
||||||
load_textures (loadmodel, ctx);
|
load_textures (mod, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +365,7 @@ Vulkan_Mod_ProcessTexture (texture_t *tx, vulkan_ctx_t *ctx)
|
||||||
| VK_IMAGE_USAGE_SAMPLED_BIT);
|
| VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE,
|
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE,
|
||||||
tex->tex->image,
|
tex->tex->image,
|
||||||
va (ctx->va_ctx, "image:%s:%s:tex", loadmodel->name,
|
va (ctx->va_ctx, "image:%s:%s:tex", mod->name,
|
||||||
tx->name));
|
tx->name));
|
||||||
if (layers > 1) {
|
if (layers > 1) {
|
||||||
// skys are unlit, so no fullbrights
|
// skys are unlit, so no fullbrights
|
||||||
|
@ -394,7 +390,7 @@ Vulkan_Mod_ProcessTexture (texture_t *tx, vulkan_ctx_t *ctx)
|
||||||
| VK_IMAGE_USAGE_SAMPLED_BIT);
|
| VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE,
|
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE,
|
||||||
tex->glow->image,
|
tex->glow->image,
|
||||||
va (ctx->va_ctx, "image:%s:%s:glow", loadmodel->name,
|
va (ctx->va_ctx, "image:%s:%s:glow", mod->name,
|
||||||
tx->name));
|
tx->name));
|
||||||
// store the pointer to the fullbright data: memory will never be set to
|
// store the pointer to the fullbright data: memory will never be set to
|
||||||
// actual device memory because all of the textures will be loaded in one
|
// actual device memory because all of the textures will be loaded in one
|
||||||
|
@ -403,11 +399,11 @@ Vulkan_Mod_ProcessTexture (texture_t *tx, vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Vulkan_Mod_LoadLighting (bsp_t *bsp, vulkan_ctx_t *ctx)
|
Vulkan_Mod_LoadLighting (model_t *mod, bsp_t *bsp, vulkan_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
mod_lightmap_bytes = 3;
|
mod_lightmap_bytes = 3;
|
||||||
if (!bsp->lightdatasize) {
|
if (!bsp->lightdatasize) {
|
||||||
loadmodel->lightdata = NULL;
|
mod->lightdata = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,14 +413,14 @@ Vulkan_Mod_LoadLighting (bsp_t *bsp, vulkan_ctx_t *ctx)
|
||||||
int ver;
|
int ver;
|
||||||
QFile *lit_file;
|
QFile *lit_file;
|
||||||
|
|
||||||
loadmodel->lightdata = 0;
|
mod->lightdata = 0;
|
||||||
if (mod_lightmap_bytes > 1) {
|
if (mod_lightmap_bytes > 1) {
|
||||||
// LordHavoc: check for a .lit file to load
|
// LordHavoc: check for a .lit file to load
|
||||||
dstring_t *litfilename = dstring_new ();
|
dstring_t *litfilename = dstring_new ();
|
||||||
dstring_copystr (litfilename, loadmodel->name);
|
dstring_copystr (litfilename, mod->name);
|
||||||
QFS_StripExtension (litfilename->str, litfilename->str);
|
QFS_StripExtension (litfilename->str, litfilename->str);
|
||||||
dstring_appendstr (litfilename, ".lit");
|
dstring_appendstr (litfilename, ".lit");
|
||||||
lit_file = QFS_VOpenFile (litfilename->str, 0, loadmodel->vpath);
|
lit_file = QFS_VOpenFile (litfilename->str, 0, mod->vpath);
|
||||||
data = (byte *) QFS_LoadHunkFile (lit_file);
|
data = (byte *) QFS_LoadHunkFile (lit_file);
|
||||||
if (data) {
|
if (data) {
|
||||||
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I'
|
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I'
|
||||||
|
@ -432,7 +428,7 @@ Vulkan_Mod_LoadLighting (bsp_t *bsp, vulkan_ctx_t *ctx)
|
||||||
ver = LittleLong (((int32_t *) data)[1]);
|
ver = LittleLong (((int32_t *) data)[1]);
|
||||||
if (ver == 1) {
|
if (ver == 1) {
|
||||||
Sys_MaskPrintf (SYS_DEV, "%s loaded", litfilename->str);
|
Sys_MaskPrintf (SYS_DEV, "%s loaded", litfilename->str);
|
||||||
loadmodel->lightdata = data + 8;
|
mod->lightdata = data + 8;
|
||||||
} else {
|
} else {
|
||||||
Sys_MaskPrintf (SYS_DEV,
|
Sys_MaskPrintf (SYS_DEV,
|
||||||
"Unknown .lit file version (%d)\n", ver);
|
"Unknown .lit file version (%d)\n", ver);
|
||||||
|
@ -443,14 +439,13 @@ Vulkan_Mod_LoadLighting (bsp_t *bsp, vulkan_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
dstring_delete (litfilename);
|
dstring_delete (litfilename);
|
||||||
}
|
}
|
||||||
if (loadmodel->lightdata || !bsp->lightdatasize) {
|
if (mod->lightdata || !bsp->lightdatasize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// LordHavoc: oh well, expand the white lighting data
|
// LordHavoc: oh well, expand the white lighting data
|
||||||
loadmodel->lightdata = Hunk_AllocName (bsp->lightdatasize * 3,
|
mod->lightdata = Hunk_AllocName (bsp->lightdatasize * 3, mod->name);
|
||||||
loadmodel->name);
|
|
||||||
in = bsp->lightdata;
|
in = bsp->lightdata;
|
||||||
out = loadmodel->lightdata;
|
out = mod->lightdata;
|
||||||
|
|
||||||
for (i = 0; i < bsp->lightdatasize ; i++) {
|
for (i = 0; i < bsp->lightdatasize ; i++) {
|
||||||
d = *in++;
|
d = *in++;
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "QF/clip_hull.h"
|
#include "QF/clip_hull.h"
|
||||||
#include "QF/model.h"
|
#include "QF/model.h"
|
||||||
|
|
||||||
|
#include "mod_internal.h"
|
||||||
|
|
||||||
VISIBLE clip_hull_t *
|
VISIBLE clip_hull_t *
|
||||||
MOD_Alloc_Hull (int nodes, int planes)
|
MOD_Alloc_Hull (int nodes, int planes)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "r_local.h"
|
#include "mod_internal.h"
|
||||||
|
|
||||||
VISIBLE int
|
VISIBLE int
|
||||||
Mod_CalcFullbright (const byte *in, byte *out, int pixels)
|
Mod_CalcFullbright (const byte *in, byte *out, int pixels)
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include "QF/qendian.h"
|
#include "QF/qendian.h"
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
|
|
||||||
#include "r_local.h"
|
#include "mod_internal.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
Mod_Fullbright (byte *skin, int width, int height, const char *name)
|
Mod_Fullbright (byte *skin, int width, int height, const char *name)
|
||||||
|
|
|
@ -497,25 +497,25 @@ Mod_LoadIQM (model_t *mod, void *buffer)
|
||||||
uint32_t *swap;
|
uint32_t *swap;
|
||||||
|
|
||||||
if (!strequal (hdr->magic, IQM_MAGIC))
|
if (!strequal (hdr->magic, IQM_MAGIC))
|
||||||
Sys_Error ("%s: not an IQM", loadname);
|
Sys_Error ("%s: not an IQM", mod->path);
|
||||||
// Byte swap the header. Everything is the same type, so no problem :)
|
// Byte swap the header. Everything is the same type, so no problem :)
|
||||||
for (swap = &hdr->version; swap <= &hdr->ofs_extensions; swap++)
|
for (swap = &hdr->version; swap <= &hdr->ofs_extensions; swap++)
|
||||||
*swap = LittleLong (*swap);
|
*swap = LittleLong (*swap);
|
||||||
//if (hdr->version < 1 || hdr->version > IQM_VERSION)
|
//if (hdr->version < 1 || hdr->version > IQM_VERSION)
|
||||||
if (hdr->version != IQM_VERSION)
|
if (hdr->version != IQM_VERSION)
|
||||||
Sys_Error ("%s: unable to handle iqm version %d", loadname,
|
Sys_Error ("%s: unable to handle iqm version %d", mod->path,
|
||||||
hdr->version);
|
hdr->version);
|
||||||
if (hdr->filesize != (uint32_t) qfs_filesize)
|
if (hdr->filesize != (uint32_t) qfs_filesize)
|
||||||
Sys_Error ("%s: invalid filesize", loadname);
|
Sys_Error ("%s: invalid filesize", mod->path);
|
||||||
iqm = calloc (1, sizeof (iqm_t));
|
iqm = calloc (1, sizeof (iqm_t));
|
||||||
iqm->text = malloc (hdr->num_text);
|
iqm->text = malloc (hdr->num_text);
|
||||||
memcpy (iqm->text, (byte *) buffer + hdr->ofs_text, hdr->num_text);
|
memcpy (iqm->text, (byte *) buffer + hdr->ofs_text, hdr->num_text);
|
||||||
mod->aliashdr = (aliashdr_t *) iqm;
|
mod->aliashdr = (aliashdr_t *) iqm;
|
||||||
mod->type = mod_iqm;
|
mod->type = mod_iqm;
|
||||||
if (hdr->num_meshes && !load_iqm_meshes (mod, hdr, (byte *) buffer))
|
if (hdr->num_meshes && !load_iqm_meshes (mod, hdr, (byte *) buffer))
|
||||||
Sys_Error ("%s: error loading meshes", loadname);
|
Sys_Error ("%s: error loading meshes", mod->path);
|
||||||
if (hdr->num_anims && !load_iqm_anims (mod, hdr, (byte *) buffer))
|
if (hdr->num_anims && !load_iqm_anims (mod, hdr, (byte *) buffer))
|
||||||
Sys_Error ("%s: error loading anims", loadname);
|
Sys_Error ("%s: error loading anims", mod->path);
|
||||||
m_funcs->Mod_IQMFinish (mod);
|
m_funcs->Mod_IQMFinish (mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,10 @@
|
||||||
#include "QF/plugin/vid_render.h"
|
#include "QF/plugin/vid_render.h"
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
#include "mod_internal.h"
|
||||||
|
|
||||||
vid_model_funcs_t *mod_funcs;
|
vid_model_funcs_t *mod_funcs;
|
||||||
|
|
||||||
model_t *loadmodel;
|
|
||||||
char *loadname; // for hunk tags
|
|
||||||
|
|
||||||
#define MOD_BLOCK 16 // allocate 16 models at a time
|
#define MOD_BLOCK 16 // allocate 16 models at a time
|
||||||
model_t **mod_known;
|
model_t **mod_known;
|
||||||
int mod_numknown;
|
int mod_numknown;
|
||||||
|
@ -75,7 +73,6 @@ Mod_Init (void)
|
||||||
int m, x, y;
|
int m, x, y;
|
||||||
int mip0size = 16*16, mip1size = 8*8, mip2size = 4*4, mip3size = 2*2;
|
int mip0size = 16*16, mip1size = 8*8, mip2size = 4*4, mip3size = 2*2;
|
||||||
|
|
||||||
memset (mod_novis, 0xff, sizeof (mod_novis));
|
|
||||||
r_notexture_mip = Hunk_AllocName (sizeof (texture_t) + mip0size + mip1size
|
r_notexture_mip = Hunk_AllocName (sizeof (texture_t) + mip0size + mip1size
|
||||||
+ mip2size + mip3size, "notexture");
|
+ mip2size + mip3size, "notexture");
|
||||||
|
|
||||||
|
@ -145,7 +142,7 @@ Mod_FindName (const char *name)
|
||||||
|
|
||||||
// search the currently loaded models
|
// search the currently loaded models
|
||||||
for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++)
|
for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++)
|
||||||
if (!strcmp ((*mod)->name, name))
|
if (!strcmp ((*mod)->path, name))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (i == mod_numknown) {
|
if (i == mod_numknown) {
|
||||||
|
@ -158,7 +155,7 @@ Mod_FindName (const char *name)
|
||||||
mod[i] = mod[0] + i;
|
mod[i] = mod[0] + i;
|
||||||
}
|
}
|
||||||
memset ((*mod), 0, sizeof (model_t));
|
memset ((*mod), 0, sizeof (model_t));
|
||||||
strncpy ((*mod)->name, name, sizeof (*mod)->name - 1);
|
strncpy ((*mod)->path, name, sizeof (*mod)->path - 1);
|
||||||
(*mod)->needload = true;
|
(*mod)->needload = true;
|
||||||
mod_numknown++;
|
mod_numknown++;
|
||||||
Cache_Add (&(*mod)->cache, *mod, Mod_CallbackLoad);
|
Cache_Add (&(*mod)->cache, *mod, Mod_CallbackLoad);
|
||||||
|
@ -173,17 +170,17 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
|
||||||
uint32_t *buf;
|
uint32_t *buf;
|
||||||
|
|
||||||
// load the file
|
// load the file
|
||||||
buf = (uint32_t *) QFS_LoadFile (QFS_FOpenFile (mod->name), 0);
|
buf = (uint32_t *) QFS_LoadFile (QFS_FOpenFile (mod->path), 0);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
if (crash)
|
if (crash)
|
||||||
Sys_Error ("Mod_LoadModel: %s not found", mod->name);
|
Sys_Error ("Mod_LoadModel: %s not found", mod->path);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadname)
|
char *name = QFS_FileBase (mod->path);
|
||||||
free (loadname);
|
strncpy (mod->name, name, sizeof (mod->name - 1));
|
||||||
loadname = QFS_FileBase (mod->name);
|
mod->name[sizeof (mod->name) - 1] = 0;
|
||||||
loadmodel = mod;
|
free (name);
|
||||||
|
|
||||||
// fill it in
|
// fill it in
|
||||||
mod->vpath = qfs_foundfile.vpath;
|
mod->vpath = qfs_foundfile.vpath;
|
||||||
|
@ -204,17 +201,17 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
|
||||||
break;
|
break;
|
||||||
case IDHEADER_MDL: // Type 6: Quake 1 .mdl
|
case IDHEADER_MDL: // Type 6: Quake 1 .mdl
|
||||||
case HEADER_MDL16: // QF Type 6 extended for 16bit precision
|
case HEADER_MDL16: // QF Type 6 extended for 16bit precision
|
||||||
if (strequal (mod->name, "progs/grenade.mdl")) {
|
if (strequal (mod->path, "progs/grenade.mdl")) {
|
||||||
mod->fullbright = 0;
|
mod->fullbright = 0;
|
||||||
mod->shadow_alpha = 255;
|
mod->shadow_alpha = 255;
|
||||||
} else if (strnequal (mod->name, "progs/flame", 11)
|
} else if (strnequal (mod->path, "progs/flame", 11)
|
||||||
|| strnequal (mod->name, "progs/bolt", 10)) {
|
|| strnequal (mod->path, "progs/bolt", 10)) {
|
||||||
mod->fullbright = 1;
|
mod->fullbright = 1;
|
||||||
mod->shadow_alpha = 0;
|
mod->shadow_alpha = 0;
|
||||||
}
|
}
|
||||||
if (strnequal (mod->name, "progs/v_", 8)) {
|
if (strnequal (mod->path, "progs/v_", 8)) {
|
||||||
mod->min_light = 0.12;
|
mod->min_light = 0.12;
|
||||||
} else if (strequal (mod->name, "progs/player.mdl")) {
|
} else if (strequal (mod->path, "progs/player.mdl")) {
|
||||||
mod->min_light = 0.04;
|
mod->min_light = 0.04;
|
||||||
}
|
}
|
||||||
if (mod_funcs)
|
if (mod_funcs)
|
||||||
|
@ -309,7 +306,7 @@ Mod_Print (void)
|
||||||
|
|
||||||
Sys_Printf ("Cached models:\n");
|
Sys_Printf ("Cached models:\n");
|
||||||
for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) {
|
for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) {
|
||||||
Sys_Printf ("%8p : %s\n", (*mod)->cache.data, (*mod)->name);
|
Sys_Printf ("%8p : %s\n", (*mod)->cache.data, (*mod)->path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,13 @@
|
||||||
#include "mod_internal.h"
|
#include "mod_internal.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
gl_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
gl_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||||
|
int framenum)
|
||||||
{
|
{
|
||||||
tex_t *targa;
|
tex_t *targa;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
targa = LoadImage (name = va (0, "%s_%i", loadmodel->name, framenum), 1);
|
targa = LoadImage (name = va (0, "%s_%i", mod->path, framenum), 1);
|
||||||
if (targa) {
|
if (targa) {
|
||||||
if (targa->format < 4)
|
if (targa->format < 4)
|
||||||
pspriteframe->gl_texturenum = GL_LoadTexture (name,
|
pspriteframe->gl_texturenum = GL_LoadTexture (name,
|
||||||
|
|
|
@ -71,12 +71,13 @@ glsl_sprite_clear (model_t *m, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
glsl_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
glsl_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||||
|
int framenum)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
loadmodel->clear = glsl_sprite_clear;
|
mod->clear = glsl_sprite_clear;
|
||||||
name = va (0, "%s_%i", loadmodel->name, framenum);
|
name = va (0, "%s_%i", mod->path, framenum);
|
||||||
pspriteframe->gl_texturenum =
|
pspriteframe->gl_texturenum =
|
||||||
GLSL_LoadQuakeTexture (name, pspriteframe->width, pspriteframe->height,
|
GLSL_LoadQuakeTexture (name, pspriteframe->width, pspriteframe->height,
|
||||||
pspriteframe->pixels);
|
pspriteframe->pixels);
|
||||||
|
|
|
@ -42,7 +42,8 @@
|
||||||
#include "mod_internal.h"
|
#include "mod_internal.h"
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
Mod_LoadSpriteFrame (model_t *mod, void *pin, mspriteframe_t **ppframe,
|
||||||
|
int framenum)
|
||||||
{
|
{
|
||||||
dspriteframe_t *pinframe;
|
dspriteframe_t *pinframe;
|
||||||
int width, height, size, origin[2];
|
int width, height, size, origin[2];
|
||||||
|
@ -54,7 +55,7 @@ Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
||||||
height = LittleLong (pinframe->height);
|
height = LittleLong (pinframe->height);
|
||||||
size = width * height;
|
size = width * height;
|
||||||
|
|
||||||
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size, loadname);
|
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size, mod->name);
|
||||||
|
|
||||||
memset (pspriteframe, 0, sizeof (mspriteframe_t) + size);
|
memset (pspriteframe, 0, sizeof (mspriteframe_t) + size);
|
||||||
|
|
||||||
|
@ -72,13 +73,14 @@ Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
||||||
|
|
||||||
memcpy (pspriteframe->pixels, (byte *) (pinframe + 1), size);
|
memcpy (pspriteframe->pixels, (byte *) (pinframe + 1), size);
|
||||||
|
|
||||||
m_funcs->Mod_SpriteLoadTexture (pspriteframe, framenum);
|
m_funcs->Mod_SpriteLoadTexture (mod, pspriteframe, framenum);
|
||||||
|
|
||||||
return (void *) ((byte *) pinframe + sizeof (dspriteframe_t) + size);
|
return (void *) ((byte *) pinframe + sizeof (dspriteframe_t) + size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum)
|
Mod_LoadSpriteGroup (model_t *mod, void *pin, mspriteframe_t **ppframe,
|
||||||
|
int framenum)
|
||||||
{
|
{
|
||||||
dspritegroup_t *pingroup;
|
dspritegroup_t *pingroup;
|
||||||
dspriteinterval_t *pin_intervals;
|
dspriteinterval_t *pin_intervals;
|
||||||
|
@ -92,7 +94,8 @@ Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum)
|
||||||
numframes = LittleLong (pingroup->numframes);
|
numframes = LittleLong (pingroup->numframes);
|
||||||
|
|
||||||
pspritegroup = Hunk_AllocName (field_offset (mspritegroup_t,
|
pspritegroup = Hunk_AllocName (field_offset (mspritegroup_t,
|
||||||
frames[numframes]), loadname);
|
frames[numframes]),
|
||||||
|
mod->name);
|
||||||
|
|
||||||
pspritegroup->numframes = numframes;
|
pspritegroup->numframes = numframes;
|
||||||
|
|
||||||
|
@ -100,7 +103,7 @@ Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum)
|
||||||
|
|
||||||
pin_intervals = (dspriteinterval_t *) (pingroup + 1);
|
pin_intervals = (dspriteinterval_t *) (pingroup + 1);
|
||||||
|
|
||||||
poutintervals = Hunk_AllocName (numframes * sizeof (float), loadname);
|
poutintervals = Hunk_AllocName (numframes * sizeof (float), mod->name);
|
||||||
|
|
||||||
pspritegroup->intervals = poutintervals;
|
pspritegroup->intervals = poutintervals;
|
||||||
|
|
||||||
|
@ -117,7 +120,7 @@ Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum)
|
||||||
|
|
||||||
for (i = 0; i < numframes; i++) {
|
for (i = 0; i < numframes; i++) {
|
||||||
ptemp =
|
ptemp =
|
||||||
Mod_LoadSpriteFrame (ptemp, &pspritegroup->frames[i],
|
Mod_LoadSpriteFrame (mod, ptemp, &pspritegroup->frames[i],
|
||||||
framenum * 100 + i);
|
framenum * 100 + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,14 +139,14 @@ Mod_LoadSpriteModel (model_t *mod, void *buffer)
|
||||||
|
|
||||||
version = LittleLong (pin->version);
|
version = LittleLong (pin->version);
|
||||||
if (version != SPR_VERSION)
|
if (version != SPR_VERSION)
|
||||||
Sys_Error ("%s has wrong version number "
|
Sys_Error ("%s has wrong version number (%i should be %i)",
|
||||||
"(%i should be %i)", mod->name, version, SPR_VERSION);
|
mod->path, version, SPR_VERSION);
|
||||||
|
|
||||||
numframes = LittleLong (pin->numframes);
|
numframes = LittleLong (pin->numframes);
|
||||||
|
|
||||||
size = field_offset (msprite_t, frames[numframes]);
|
size = field_offset (msprite_t, frames[numframes]);
|
||||||
|
|
||||||
psprite = Hunk_AllocName (size, loadname);
|
psprite = Hunk_AllocName (size, mod->name);
|
||||||
|
|
||||||
mod->cache.data = psprite;
|
mod->cache.data = psprite;
|
||||||
|
|
||||||
|
@ -175,11 +178,11 @@ Mod_LoadSpriteModel (model_t *mod, void *buffer)
|
||||||
|
|
||||||
if (frametype == SPR_SINGLE) {
|
if (frametype == SPR_SINGLE) {
|
||||||
pframetype = (dspriteframetype_t *)
|
pframetype = (dspriteframetype_t *)
|
||||||
Mod_LoadSpriteFrame (pframetype + 1,
|
Mod_LoadSpriteFrame (mod, pframetype + 1,
|
||||||
&psprite->frames[i].frameptr, i);
|
&psprite->frames[i].frameptr, i);
|
||||||
} else {
|
} else {
|
||||||
pframetype = (dspriteframetype_t *)
|
pframetype = (dspriteframetype_t *)
|
||||||
Mod_LoadSpriteGroup (pframetype + 1,
|
Mod_LoadSpriteGroup (mod, pframetype + 1,
|
||||||
&psprite->frames[i].frameptr, i);
|
&psprite->frames[i].frameptr, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "mod_internal.h"
|
#include "mod_internal.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
sw_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
sw_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||||
|
int framenum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,7 @@ gl_R_ReadPointFile_f (void)
|
||||||
vec3_t org;
|
vec3_t org;
|
||||||
QFile *f;
|
QFile *f;
|
||||||
|
|
||||||
mapname = strdup (r_worldentity.model->name);
|
mapname = strdup (r_worldentity.model->path);
|
||||||
if (!mapname)
|
if (!mapname)
|
||||||
Sys_Error ("Can't duplicate mapname!");
|
Sys_Error ("Can't duplicate mapname!");
|
||||||
QFS_StripExtension (mapname, mapname);
|
QFS_StripExtension (mapname, mapname);
|
||||||
|
|
|
@ -585,7 +585,7 @@ gl_overbright_f (cvar_t *var)
|
||||||
|
|
||||||
if (m->type != mod_brush)
|
if (m->type != mod_brush)
|
||||||
continue;
|
continue;
|
||||||
if (m->name[0] == '*')
|
if (m->path[0] == '*')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (j = 0, fa = m->surfaces; j < m->numsurfaces; j++, fa++) {
|
for (j = 0, fa = m->surfaces; j < m->numsurfaces; j++, fa++) {
|
||||||
|
@ -732,7 +732,7 @@ GL_BuildLightmaps (model_t **models, int num_models)
|
||||||
m = models[j];
|
m = models[j];
|
||||||
if (!m)
|
if (!m)
|
||||||
break;
|
break;
|
||||||
if (m->name[0] == '*') {
|
if (m->path[0] == '*') {
|
||||||
// sub model surfaces are processed as part of the main model
|
// sub model surfaces are processed as part of the main model
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ gl_R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
|
||||||
for (i = 0; i < num_models; i++) {
|
for (i = 0; i < num_models; i++) {
|
||||||
if (!models[i])
|
if (!models[i])
|
||||||
continue;
|
continue;
|
||||||
if (*models[i]->name == '*')
|
if (*models[i]->path == '*')
|
||||||
continue;
|
continue;
|
||||||
if (models[i] != r_worldentity.model && models[i]->type == mod_brush)
|
if (models[i] != r_worldentity.model && models[i]->type == mod_brush)
|
||||||
register_textures (models[i]);
|
register_textures (models[i]);
|
||||||
|
|
|
@ -436,7 +436,7 @@ glsl_R_RegisterTextures (model_t **models, int num_models)
|
||||||
if (!m)
|
if (!m)
|
||||||
continue;
|
continue;
|
||||||
// sub-models are done as part of the main model
|
// sub-models are done as part of the main model
|
||||||
if (*m->name == '*')
|
if (*m->path == '*')
|
||||||
continue;
|
continue;
|
||||||
// world has already been done, not interested in non-brush models
|
// world has already been done, not interested in non-brush models
|
||||||
if (m == r_worldentity.model || m->type != mod_brush)
|
if (m == r_worldentity.model || m->type != mod_brush)
|
||||||
|
@ -561,7 +561,7 @@ glsl_R_BuildDisplayLists (model_t **models, int num_models)
|
||||||
if (!m)
|
if (!m)
|
||||||
continue;
|
continue;
|
||||||
// sub-models are done as part of the main model
|
// sub-models are done as part of the main model
|
||||||
if (*m->name == '*')
|
if (*m->path == '*')
|
||||||
continue;
|
continue;
|
||||||
// non-bsp models don't have surfaces.
|
// non-bsp models don't have surfaces.
|
||||||
dm = m->submodels;
|
dm = m->submodels;
|
||||||
|
|
|
@ -210,7 +210,7 @@ glsl_R_BuildLightmaps (model_t **models, int num_models)
|
||||||
m = models[j];
|
m = models[j];
|
||||||
if (!m)
|
if (!m)
|
||||||
break;
|
break;
|
||||||
if (m->name[0] == '*') {
|
if (m->path[0] == '*') {
|
||||||
// sub model surfaces are processed as part of the main model
|
// sub model surfaces are processed as part of the main model
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ glsl_R_BuildLightmaps (model_t **models, int num_models)
|
||||||
m = models[j];
|
m = models[j];
|
||||||
if (!m)
|
if (!m)
|
||||||
break;
|
break;
|
||||||
if (m->name[0] == '*') {
|
if (m->path[0] == '*') {
|
||||||
// sub model surfaces are processed as part of the main model
|
// sub model surfaces are processed as part of the main model
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,7 +313,7 @@ glsl_R_ReadPointFile_f (void)
|
||||||
vec3_t org;
|
vec3_t org;
|
||||||
QFile *f;
|
QFile *f;
|
||||||
|
|
||||||
mapname = strdup (r_worldentity.model->name);
|
mapname = strdup (r_worldentity.model->path);
|
||||||
if (!mapname)
|
if (!mapname)
|
||||||
Sys_Error ("Can't duplicate mapname!");
|
Sys_Error ("Can't duplicate mapname!");
|
||||||
QFS_StripExtension (mapname, mapname);
|
QFS_StripExtension (mapname, mapname);
|
||||||
|
|
|
@ -106,7 +106,7 @@ R_AliasCheckBBox (void)
|
||||||
frame = currententity->frame;
|
frame = currententity->frame;
|
||||||
// TODO: don't repeat this check when drawing?
|
// TODO: don't repeat this check when drawing?
|
||||||
if ((frame >= pmdl->numframes) || (frame < 0)) {
|
if ((frame >= pmdl->numframes) || (frame < 0)) {
|
||||||
Sys_MaskPrintf (SYS_DEV, "No such frame %d %s\n", frame, pmodel->name);
|
Sys_MaskPrintf (SYS_DEV, "No such frame %d %s\n", frame, pmodel->path);
|
||||||
frame = 0;
|
frame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ R_ReadPointFile_f (void)
|
||||||
const char *name;
|
const char *name;
|
||||||
char *mapname;
|
char *mapname;
|
||||||
|
|
||||||
mapname = strdup (r_worldentity.model->name);
|
mapname = strdup (r_worldentity.model->path);
|
||||||
if (!mapname)
|
if (!mapname)
|
||||||
Sys_Error ("Can't duplicate mapname!");
|
Sys_Error ("Can't duplicate mapname!");
|
||||||
QFS_StripExtension (mapname, mapname);
|
QFS_StripExtension (mapname, mapname);
|
||||||
|
|
|
@ -109,7 +109,7 @@ sw32_R_AliasCheckBBox (void)
|
||||||
frame = currententity->frame;
|
frame = currententity->frame;
|
||||||
// TODO: don't repeat this check when drawing?
|
// TODO: don't repeat this check when drawing?
|
||||||
if ((frame >= pmdl->numframes) || (frame < 0)) {
|
if ((frame >= pmdl->numframes) || (frame < 0)) {
|
||||||
Sys_MaskPrintf (SYS_DEV, "No such frame %d %s\n", frame, pmodel->name);
|
Sys_MaskPrintf (SYS_DEV, "No such frame %d %s\n", frame, pmodel->path);
|
||||||
frame = 0;
|
frame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ sw32_R_ReadPointFile_f (void)
|
||||||
const char *name;
|
const char *name;
|
||||||
char *mapname;
|
char *mapname;
|
||||||
|
|
||||||
mapname = strdup (r_worldentity.model->name);
|
mapname = strdup (r_worldentity.model->path);
|
||||||
if (!mapname)
|
if (!mapname)
|
||||||
Sys_Error ("Can't duplicate mapname!");
|
Sys_Error ("Can't duplicate mapname!");
|
||||||
QFS_StripExtension (mapname, mapname);
|
QFS_StripExtension (mapname, mapname);
|
||||||
|
|
|
@ -401,35 +401,35 @@ vulkan_r_particles_style_f (struct cvar_s *var)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vulkan_Mod_LoadLighting (bsp_t *bsp)
|
vulkan_Mod_LoadLighting (model_t *mod, bsp_t *bsp)
|
||||||
{
|
{
|
||||||
Vulkan_Mod_LoadLighting (bsp, vulkan_ctx);
|
Vulkan_Mod_LoadLighting (mod, bsp, vulkan_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vulkan_Mod_SubdivideSurface (msurface_t *fa)
|
vulkan_Mod_SubdivideSurface (model_t *mod, msurface_t *fa)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vulkan_Mod_ProcessTexture (texture_t *tx)
|
vulkan_Mod_ProcessTexture (model_t *mod, texture_t *tx)
|
||||||
{
|
{
|
||||||
Vulkan_Mod_ProcessTexture (tx, vulkan_ctx);
|
Vulkan_Mod_ProcessTexture (mod, tx, vulkan_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr,
|
vulkan_Mod_MakeAliasModelDisplayLists (model_t *mod, aliashdr_t *hdr,
|
||||||
void *_m, int _s, int extra)
|
void *_m, int _s, int extra)
|
||||||
{
|
{
|
||||||
Vulkan_Mod_MakeAliasModelDisplayLists (m, hdr, _m, _s, extra, vulkan_ctx);
|
Vulkan_Mod_MakeAliasModelDisplayLists (mod, hdr, _m, _s, extra, vulkan_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vulkan_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
vulkan_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum,
|
||||||
qboolean group, maliasskindesc_t *skindesc)
|
int gnum, qboolean group, maliasskindesc_t *skindesc)
|
||||||
{
|
{
|
||||||
return Vulkan_Mod_LoadSkin (skin, skinsize, snum, gnum, group, skindesc,
|
return Vulkan_Mod_LoadSkin (mod, skin, skinsize, snum, gnum, group,
|
||||||
vulkan_ctx);
|
skindesc, vulkan_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -449,7 +449,8 @@ vulkan_Mod_IQMFinish (model_t *mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vulkan_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
vulkan_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||||
|
int framenum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,7 @@ Vulkan_RegisterTextures (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
||||||
if (!m)
|
if (!m)
|
||||||
continue;
|
continue;
|
||||||
// sub-models are done as part of the main model
|
// sub-models are done as part of the main model
|
||||||
if (*m->name == '*')
|
if (*m->path == '*')
|
||||||
continue;
|
continue;
|
||||||
// world has already been done, not interested in non-brush models
|
// world has already been done, not interested in non-brush models
|
||||||
if (m == r_worldentity.model || m->type != mod_brush)
|
if (m == r_worldentity.model || m->type != mod_brush)
|
||||||
|
@ -421,7 +421,7 @@ Vulkan_BuildDisplayLists (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
||||||
if (!m)
|
if (!m)
|
||||||
continue;
|
continue;
|
||||||
// sub-models are done as part of the main model
|
// sub-models are done as part of the main model
|
||||||
if (*m->name == '*')
|
if (*m->path == '*')
|
||||||
continue;
|
continue;
|
||||||
// non-bsp models don't have surfaces.
|
// non-bsp models don't have surfaces.
|
||||||
dm = m->submodels;
|
dm = m->submodels;
|
||||||
|
|
|
@ -228,7 +228,7 @@ Vulkan_BuildLightmaps (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
||||||
m = models[j];
|
m = models[j];
|
||||||
if (!m)
|
if (!m)
|
||||||
break;
|
break;
|
||||||
if (m->name[0] == '*') {
|
if (m->path[0] == '*') {
|
||||||
// sub model surfaces are processed as part of the main model
|
// sub model surfaces are processed as part of the main model
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ Vulkan_BuildLightmaps (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
||||||
if (!m) {
|
if (!m) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m->name[0] == '*') {
|
if (m->path[0] == '*') {
|
||||||
// sub model surfaces are processed as part of the main model
|
// sub model surfaces are processed as part of the main model
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,7 +338,7 @@ demo_default_name (const char *argv1)
|
||||||
strftime (timestring, 19, "%Y-%m-%d-%H-%M", localtime (&tim));
|
strftime (timestring, 19, "%Y-%m-%d-%H-%M", localtime (&tim));
|
||||||
|
|
||||||
// the leading path-name is to be removed from cl.worldmodel->name
|
// the leading path-name is to be removed from cl.worldmodel->name
|
||||||
mapname = QFS_SkipPath (cl.worldmodel->name);
|
mapname = QFS_SkipPath (cl.worldmodel->path);
|
||||||
|
|
||||||
// the map name is cut off after any "." because this would prevent
|
// the map name is cut off after any "." because this would prevent
|
||||||
// an extension being appended
|
// an extension being appended
|
||||||
|
|
|
@ -408,7 +408,7 @@ CL_PrintEntities_f (void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Sys_Printf ("%s:%2i (%5.1f,%5.1f,%5.1f) [%5.1f %5.1f %5.1f]\n",
|
Sys_Printf ("%s:%2i (%5.1f,%5.1f,%5.1f) [%5.1f %5.1f %5.1f]\n",
|
||||||
ent->model->name, ent->frame, VectorExpand (ent->origin),
|
ent->model->path, ent->frame, VectorExpand (ent->origin),
|
||||||
VectorExpand (ent->angles));
|
VectorExpand (ent->angles));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1198,7 +1198,7 @@ SV_SpawnServer (const char *server)
|
||||||
ent = EDICT_NUM (&sv_pr_state, 0);
|
ent = EDICT_NUM (&sv_pr_state, 0);
|
||||||
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
|
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
|
||||||
ent->free = false;
|
ent->free = false;
|
||||||
SVstring (ent, model) = PR_SetString (&sv_pr_state, sv.worldmodel->name);
|
SVstring (ent, model) = PR_SetString (&sv_pr_state, sv.worldmodel->path);
|
||||||
SVfloat (ent, modelindex) = 1; // world model
|
SVfloat (ent, modelindex) = 1; // world model
|
||||||
SVfloat (ent, solid) = SOLID_BSP;
|
SVfloat (ent, solid) = SOLID_BSP;
|
||||||
SVfloat (ent, movetype) = MOVETYPE_PUSH;
|
SVfloat (ent, movetype) = MOVETYPE_PUSH;
|
||||||
|
|
|
@ -634,7 +634,7 @@ demo_default_name (const char *argv1)
|
||||||
strftime (timestring, 19, "%Y-%m-%d-%H-%M", localtime (&tim));
|
strftime (timestring, 19, "%Y-%m-%d-%H-%M", localtime (&tim));
|
||||||
|
|
||||||
// the leading path-name is to be removed from cl.worldmodel->name
|
// the leading path-name is to be removed from cl.worldmodel->name
|
||||||
mapname = QFS_SkipPath (cl.worldmodel->name);
|
mapname = QFS_SkipPath (cl.worldmodel->path);
|
||||||
|
|
||||||
// the map name is cut off after any "." because this would prevent
|
// the map name is cut off after any "." because this would prevent
|
||||||
// an extension being appended
|
// an extension being appended
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ Sbar_LogFrags (void)
|
||||||
if (t)
|
if (t)
|
||||||
Qwrite (file, t, strlen (t));
|
Qwrite (file, t, strlen (t));
|
||||||
|
|
||||||
Qprintf (file, "%s\n%s %s\n", cls.servername->str, cl.worldmodel->name,
|
Qprintf (file, "%s\n%s %s\n", cls.servername->str, cl.worldmodel->path,
|
||||||
cl.levelname);
|
cl.levelname);
|
||||||
|
|
||||||
// scores
|
// scores
|
||||||
|
|
|
@ -420,7 +420,7 @@ SV_SpawnServer (const char *server)
|
||||||
|
|
||||||
ent = EDICT_NUM (&sv_pr_state, 0);
|
ent = EDICT_NUM (&sv_pr_state, 0);
|
||||||
ent->free = false;
|
ent->free = false;
|
||||||
SVstring (ent, model) = PR_SetString (&sv_pr_state, sv.worldmodel->name);
|
SVstring (ent, model) = PR_SetString (&sv_pr_state, sv.worldmodel->path);
|
||||||
SVfloat (ent, modelindex) = 1; // world model
|
SVfloat (ent, modelindex) = 1; // world model
|
||||||
SVfloat (ent, solid) = SOLID_BSP;
|
SVfloat (ent, solid) = SOLID_BSP;
|
||||||
SVfloat (ent, movetype) = MOVETYPE_PUSH;
|
SVfloat (ent, movetype) = MOVETYPE_PUSH;
|
||||||
|
|
|
@ -288,8 +288,8 @@ Team_NewMap (void)
|
||||||
|
|
||||||
died = false;
|
died = false;
|
||||||
recorded_location = false;
|
recorded_location = false;
|
||||||
mapname = strdup (cl.worldmodel->name);
|
mapname = strdup (cl.worldmodel->path);
|
||||||
t2 = malloc (sizeof (cl.worldmodel->name));
|
t2 = malloc (sizeof (cl.worldmodel->path));
|
||||||
if (!mapname || !t2)
|
if (!mapname || !t2)
|
||||||
Sys_Error ("Can't duplicate mapname!");
|
Sys_Error ("Can't duplicate mapname!");
|
||||||
map_to_loc (mapname,t2);
|
map_to_loc (mapname,t2);
|
||||||
|
@ -345,10 +345,10 @@ locs_loc (void)
|
||||||
}
|
}
|
||||||
if (Cmd_Argc () >= 3)
|
if (Cmd_Argc () >= 3)
|
||||||
desc = Cmd_Args (2);
|
desc = Cmd_Args (2);
|
||||||
mapname = malloc (sizeof (cl.worldmodel->name));
|
mapname = malloc (sizeof (cl.worldmodel->path));
|
||||||
if (!mapname)
|
if (!mapname)
|
||||||
Sys_Error ("Can't duplicate mapname!");
|
Sys_Error ("Can't duplicate mapname!");
|
||||||
map_to_loc (cl.worldmodel->name, mapname);
|
map_to_loc (cl.worldmodel->path, mapname);
|
||||||
snprintf (locfile, sizeof (locfile), "%s/%s",
|
snprintf (locfile, sizeof (locfile), "%s/%s",
|
||||||
qfs_gamedir->dir.def, mapname);
|
qfs_gamedir->dir.def, mapname);
|
||||||
free (mapname);
|
free (mapname);
|
||||||
|
|
Loading…
Reference in a new issue