2012-02-14 12:25:19 +00:00
|
|
|
#ifndef __mod_internal_h
|
|
|
|
#define __mod_internal_h
|
|
|
|
|
2021-02-01 12:11:45 +00:00
|
|
|
#include "QF/darray.h"
|
2012-05-16 09:09:44 +00:00
|
|
|
#include "QF/iqm.h"
|
2012-02-14 12:25:19 +00:00
|
|
|
#include "QF/model.h"
|
|
|
|
#include "QF/skin.h"
|
2012-02-23 03:09:19 +00:00
|
|
|
#include "QF/plugin/vid_render.h"
|
|
|
|
|
[model] Make alias skin loading a batch operation
Really, this won't make all that much difference because alias models
with more than one skin are quite rare, and those with animated skin
groups are even rarer. However, for those models that do have more than
one skin, it will allow for reduced allocation overheads, and when
supported (glsl, vulkan, maybe gl), loading all the skins into an array
texture (since all skins are the same size, though external skins may
vary), but that's not implemented yet, this just wraps the old one skin
at a time code.
2022-04-04 06:38:27 +00:00
|
|
|
typedef struct mod_alias_skin_s {
|
|
|
|
int skin_num;
|
|
|
|
int group_num; // -1 if not in an animated group
|
|
|
|
byte *texels;
|
|
|
|
maliasskindesc_t *skindesc;
|
|
|
|
} mod_alias_skin_t;
|
|
|
|
|
2021-02-01 12:11:45 +00:00
|
|
|
typedef struct stvertset_s DARRAY_TYPE (stvert_t) stvertset_t;
|
|
|
|
typedef struct mtriangleset_s DARRAY_TYPE (mtriangle_t) mtriangleset_t;
|
|
|
|
typedef struct trivertxset_s DARRAY_TYPE (trivertx_t *) trivertxset_t;
|
[model] Make alias skin loading a batch operation
Really, this won't make all that much difference because alias models
with more than one skin are quite rare, and those with animated skin
groups are even rarer. However, for those models that do have more than
one skin, it will allow for reduced allocation overheads, and when
supported (glsl, vulkan, maybe gl), loading all the skins into an array
texture (since all skins are the same size, though external skins may
vary), but that's not implemented yet, this just wraps the old one skin
at a time code.
2022-04-04 06:38:27 +00:00
|
|
|
typedef struct askinset_s DARRAY_TYPE (mod_alias_skin_t) askinset_t;
|
2021-02-01 12:11:45 +00:00
|
|
|
|
|
|
|
typedef struct mod_alias_ctx_s {
|
|
|
|
aliashdr_t *header;
|
|
|
|
model_t *mod;
|
|
|
|
stvertset_t stverts;
|
|
|
|
mtriangleset_t triangles;
|
|
|
|
trivertxset_t poseverts;
|
[model] Make alias skin loading a batch operation
Really, this won't make all that much difference because alias models
with more than one skin are quite rare, and those with animated skin
groups are even rarer. However, for those models that do have more than
one skin, it will allow for reduced allocation overheads, and when
supported (glsl, vulkan, maybe gl), loading all the skins into an array
texture (since all skins are the same size, though external skins may
vary), but that's not implemented yet, this just wraps the old one skin
at a time code.
2022-04-04 06:38:27 +00:00
|
|
|
askinset_t skins;
|
2021-02-01 12:11:45 +00:00
|
|
|
int aliasbboxmins[3];
|
|
|
|
int aliasbboxmaxs[3];
|
|
|
|
} mod_alias_ctx_t;
|
|
|
|
|
2021-12-13 23:36:19 +00:00
|
|
|
typedef struct mod_sprite_ctx_s {
|
|
|
|
model_t *mod;
|
|
|
|
dsprite_t *dsprite;
|
|
|
|
msprite_t *sprite;
|
|
|
|
int numframes;
|
|
|
|
int *frame_numbers;
|
|
|
|
dspriteframe_t **dframes; ///< array of pointers to dframes (in)
|
|
|
|
mspriteframe_t ***frames; ///< array of pointers to mframe pointers (out)
|
|
|
|
} mod_sprite_ctx_t;
|
|
|
|
|
2021-12-07 03:51:33 +00:00
|
|
|
int Mod_CalcFullbright (byte *out, const byte *in, size_t pixels);
|
|
|
|
int Mod_ClearFullbright (byte *out, const byte *in, size_t pixels);
|
2021-02-01 05:39:00 +00:00
|
|
|
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));
|
|
|
|
|
2021-01-19 09:15:05 +00:00
|
|
|
struct vulkan_ctx_s;
|
|
|
|
|
2012-02-23 03:09:19 +00:00
|
|
|
extern vid_model_funcs_t *m_funcs;
|
2012-02-14 12:25:19 +00:00
|
|
|
|
2021-02-01 12:11:45 +00:00
|
|
|
void gl_Mod_MakeAliasModelDisplayLists (mod_alias_ctx_t *alias_ctx, void *_m,
|
2012-02-23 03:55:50 +00:00
|
|
|
int _s, int extra);
|
[model] Make alias skin loading a batch operation
Really, this won't make all that much difference because alias models
with more than one skin are quite rare, and those with animated skin
groups are even rarer. However, for those models that do have more than
one skin, it will allow for reduced allocation overheads, and when
supported (glsl, vulkan, maybe gl), loading all the skins into an array
texture (since all skins are the same size, though external skins may
vary), but that's not implemented yet, this just wraps the old one skin
at a time code.
2022-04-04 06:38:27 +00:00
|
|
|
void gl_Mod_LoadAllSkins (mod_alias_ctx_t *alias_ctx);
|
2021-02-01 12:11:45 +00:00
|
|
|
void gl_Mod_FinalizeAliasModel (mod_alias_ctx_t *alias_ctx);
|
|
|
|
void gl_Mod_LoadExternalSkins (mod_alias_ctx_t *alias_ctx);
|
2012-05-14 14:02:06 +00:00
|
|
|
void gl_Mod_IQMFinish (model_t *mod);
|
2012-02-23 03:55:50 +00:00
|
|
|
|
2021-02-01 12:11:45 +00:00
|
|
|
void glsl_Mod_MakeAliasModelDisplayLists (mod_alias_ctx_t *alias_ctx,
|
2012-02-23 03:55:50 +00:00
|
|
|
void *_m, int _s, int extra);
|
[model] Make alias skin loading a batch operation
Really, this won't make all that much difference because alias models
with more than one skin are quite rare, and those with animated skin
groups are even rarer. However, for those models that do have more than
one skin, it will allow for reduced allocation overheads, and when
supported (glsl, vulkan, maybe gl), loading all the skins into an array
texture (since all skins are the same size, though external skins may
vary), but that's not implemented yet, this just wraps the old one skin
at a time code.
2022-04-04 06:38:27 +00:00
|
|
|
void glsl_Mod_LoadAllSkins (mod_alias_ctx_t *alias_ctx);
|
2021-02-01 12:11:45 +00:00
|
|
|
void glsl_Mod_FinalizeAliasModel (mod_alias_ctx_t *alias_ctx);
|
|
|
|
void glsl_Mod_LoadExternalSkins (mod_alias_ctx_t *alias_ctx);
|
2012-05-14 14:02:06 +00:00
|
|
|
void glsl_Mod_IQMFinish (model_t *mod);
|
2012-02-23 03:55:50 +00:00
|
|
|
|
2021-02-01 12:11:45 +00:00
|
|
|
void sw_Mod_MakeAliasModelDisplayLists (mod_alias_ctx_t *alias_ctx, void *_m,
|
2012-02-23 03:55:50 +00:00
|
|
|
int _s, int extra);
|
[model] Make alias skin loading a batch operation
Really, this won't make all that much difference because alias models
with more than one skin are quite rare, and those with animated skin
groups are even rarer. However, for those models that do have more than
one skin, it will allow for reduced allocation overheads, and when
supported (glsl, vulkan, maybe gl), loading all the skins into an array
texture (since all skins are the same size, though external skins may
vary), but that's not implemented yet, this just wraps the old one skin
at a time code.
2022-04-04 06:38:27 +00:00
|
|
|
void sw_Mod_LoadAllSkins (mod_alias_ctx_t *alias_ctx);
|
2023-03-20 08:45:28 +00:00
|
|
|
void sw_Mod_FinalizeAliasModel (mod_alias_ctx_t *alias_ctx);
|
2012-05-14 14:02:06 +00:00
|
|
|
void sw_Mod_IQMFinish (model_t *mod);
|
2012-02-23 03:55:50 +00:00
|
|
|
|
2021-02-01 05:39:00 +00:00
|
|
|
void gl_Mod_LoadLighting (model_t *mod, bsp_t *bsp);
|
|
|
|
void gl_Mod_SubdivideSurface (model_t *mod, msurface_t *fa);
|
2022-05-26 05:41:08 +00:00
|
|
|
struct texture_s;
|
|
|
|
void gl_Mod_ProcessTexture (model_t *mod, struct texture_s *tx);
|
2012-02-23 03:55:50 +00:00
|
|
|
|
2021-02-01 05:39:00 +00:00
|
|
|
void glsl_Mod_LoadLighting (model_t *mod, bsp_t *bsp);
|
2022-05-26 05:41:08 +00:00
|
|
|
void glsl_Mod_ProcessTexture (model_t *mod, struct texture_s *tx);
|
2012-02-23 03:55:50 +00:00
|
|
|
|
2021-02-01 05:39:00 +00:00
|
|
|
void sw_Mod_LoadLighting (model_t *mod, bsp_t *bsp);
|
2012-02-23 03:55:50 +00:00
|
|
|
|
2021-02-01 05:39:00 +00:00
|
|
|
void Vulkan_Mod_LoadLighting (model_t *mod, bsp_t *bsp,
|
|
|
|
struct vulkan_ctx_s *ctx);
|
|
|
|
void Vulkan_Mod_SubdivideSurface (model_t *mod, msurface_t *fa,
|
|
|
|
struct vulkan_ctx_s *ctx);
|
2022-05-26 05:41:08 +00:00
|
|
|
void Vulkan_Mod_ProcessTexture (model_t *mod, struct texture_s *tx,
|
2021-02-01 05:39:00 +00:00
|
|
|
struct vulkan_ctx_s *ctx);
|
2021-01-19 09:15:05 +00:00
|
|
|
|
2021-12-13 23:36:19 +00:00
|
|
|
void Mod_LoadSpriteFrame (mspriteframe_t *frame, const dspriteframe_t *dframe);
|
|
|
|
void gl_Mod_SpriteLoadFrames (mod_sprite_ctx_t *sprite_ctx);
|
|
|
|
void glsl_Mod_SpriteLoadFrames (mod_sprite_ctx_t *sprite_ctx);
|
|
|
|
void sw_Mod_SpriteLoadFrames (mod_sprite_ctx_t *sprite_ctx);
|
2012-02-23 04:18:59 +00:00
|
|
|
|
2012-04-27 05:40:06 +00:00
|
|
|
void Mod_LoadIQM (model_t *mod, void *buffer);
|
2012-05-16 09:09:44 +00:00
|
|
|
void Mod_FreeIQM (iqm_t *iqm);
|
2012-05-17 06:55:38 +00:00
|
|
|
iqmblend_t *Mod_IQMBuildBlendPalette (iqm_t *iqm, int *size);
|
2012-05-21 23:23:22 +00:00
|
|
|
void Mod_LoadAliasModel (model_t *mod, void *buffer,
|
2012-02-14 12:25:19 +00:00
|
|
|
cache_allocator_t allocator);
|
|
|
|
void Mod_LoadSpriteModel (model_t *mod, void *buffer);
|
|
|
|
|
2022-11-15 04:09:41 +00:00
|
|
|
int Skin_CalcTopColors (byte *out, const byte *in, size_t pixels, int stride);
|
|
|
|
int Skin_CalcTopMask (byte *out, const byte *in, size_t pixels, int stride);
|
|
|
|
int Skin_CalcBottomColors(byte *out, const byte *in, size_t pixels, int stride);
|
|
|
|
int Skin_CalcBottomMask (byte *out, const byte *in, size_t pixels, int stride);
|
2021-12-07 03:51:33 +00:00
|
|
|
int Skin_ClearTopColors (byte *out, const byte *in, size_t pixels);
|
|
|
|
int Skin_ClearBottomColors (byte *out, const byte *in, size_t pixels);
|
2024-01-14 17:26:24 +00:00
|
|
|
void Skin_SetColormap (byte *dest, int top, int bottom);
|
|
|
|
void Skin_SetPalette (byte *dest, int top, int bottom);
|
|
|
|
|
|
|
|
typedef struct tex_s tex_t;
|
|
|
|
typedef struct colormap_s colormap_t;
|
|
|
|
|
|
|
|
tex_t *Skin_DupTex (const tex_t *tex);
|
|
|
|
|
|
|
|
typedef struct skin_s {
|
|
|
|
tex_t *tex;
|
|
|
|
uint32_t id;
|
|
|
|
} skin_t;
|
|
|
|
|
2024-01-15 01:28:02 +00:00
|
|
|
typedef struct glskin_s {
|
|
|
|
uint32_t id;
|
|
|
|
uint32_t fb;
|
|
|
|
} glskin_t;
|
|
|
|
|
2024-01-15 06:26:09 +00:00
|
|
|
void Skin_Init (void);
|
|
|
|
uint32_t Skin_Set (const char *skinname);
|
2024-01-14 17:26:24 +00:00
|
|
|
skin_t *Skin_Get (uint32_t skin) __attribute__((pure));
|
2012-02-23 03:09:19 +00:00
|
|
|
|
2024-01-15 06:26:09 +00:00
|
|
|
void sw_Skin_SetupSkin (skin_t *skin);
|
2024-01-14 17:26:24 +00:00
|
|
|
void sw_Skin_Destroy (skin_t *skin);
|
|
|
|
const byte *sw_Skin_Colormap (const colormap_t *colormap);
|
2012-02-23 03:09:19 +00:00
|
|
|
|
2024-01-15 06:26:09 +00:00
|
|
|
void glsl_Skin_SetupSkin (skin_t *skin);
|
2024-01-14 17:26:24 +00:00
|
|
|
void glsl_Skin_Destroy (skin_t *skin);
|
|
|
|
uint32_t glsl_Skin_Colormap (const colormap_t *colormap);
|
2012-02-23 03:09:19 +00:00
|
|
|
|
2024-01-15 06:26:09 +00:00
|
|
|
void gl_Skin_SetupSkin (skin_t *skin);
|
2024-01-14 17:26:24 +00:00
|
|
|
void gl_Skin_Destroy (skin_t *skin);
|
2024-01-15 05:12:59 +00:00
|
|
|
glskin_t gl_Skin_Get (const tex_t *tex, const colormap_t *colormap,
|
|
|
|
const byte *texel_base);
|
2024-01-14 17:26:24 +00:00
|
|
|
|
2012-02-14 12:25:19 +00:00
|
|
|
#endif// __mod_internal_h
|