2021-01-17 00:45:10 +01:00
|
|
|
#pragma once
|
|
|
|
|
2023-10-20 19:04:33 +02:00
|
|
|
#include "const.h" // required for com_model.h, ref_api.h
|
|
|
|
#include "cvardef.h" // required for ref_api.h
|
|
|
|
#include "com_model.h" // required for ref_api.h
|
|
|
|
#include "ref_api.h" // texFlags_t
|
2021-01-04 21:39:09 +01:00
|
|
|
|
2023-10-24 17:32:42 +02:00
|
|
|
#define MAX_LIGHTMAPS 256
|
|
|
|
|
|
|
|
typedef struct vk_textures_global_s
|
|
|
|
{
|
|
|
|
// TODO Fix these at compile time statically, akin to BLUE_NOISE_TEXTURE_ID
|
|
|
|
int defaultTexture; // use for bad textures
|
|
|
|
int particleTexture;
|
|
|
|
int whiteTexture;
|
|
|
|
int grayTexture;
|
|
|
|
int blackTexture;
|
|
|
|
int solidskyTexture; // quake1 solid-sky layer
|
|
|
|
int alphaskyTexture; // quake1 alpha-sky layer
|
|
|
|
int lightmapTextures[MAX_LIGHTMAPS];
|
|
|
|
int dlightTexture; // custom dlight texture
|
|
|
|
int cinTexture; // cinematic texture
|
|
|
|
|
|
|
|
// TODO wire it up for ref_interface_t return
|
|
|
|
qboolean fCustomSkybox;
|
|
|
|
} vk_textures_global_t;
|
|
|
|
|
|
|
|
// TODO rename this consistently
|
|
|
|
extern vk_textures_global_t tglob;
|
|
|
|
|
2023-10-20 18:39:14 +02:00
|
|
|
qboolean R_TexturesInit( void );
|
2023-10-19 17:15:45 +02:00
|
|
|
void R_TexturesShutdown( void );
|
|
|
|
|
2023-10-27 15:33:01 +02:00
|
|
|
////////////////////////////////////////////////////////////
|
2023-10-19 17:15:45 +02:00
|
|
|
// Ref interface functions, exported
|
2023-10-24 17:32:42 +02:00
|
|
|
// TODO mark names somehow, ie. R_TextureApi... ?
|
2023-10-19 17:15:45 +02:00
|
|
|
int R_TextureFindByName( const char *name );
|
|
|
|
const char* R_TextureGetNameByIndex( unsigned int texnum );
|
2023-10-20 16:55:19 +02:00
|
|
|
|
|
|
|
void R_TextureSetupSky( const char *skyboxname );
|
|
|
|
|
2023-10-19 17:15:45 +02:00
|
|
|
int R_TextureUploadFromFile( const char *name, const byte *buf, size_t size, int flags );
|
|
|
|
int R_TextureUploadFromBuffer( const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update_only );
|
2023-10-20 16:55:19 +02:00
|
|
|
void R_TextureFree( unsigned int texnum );
|
2023-10-19 17:15:45 +02:00
|
|
|
|
2023-10-24 17:32:42 +02:00
|
|
|
int R_TexturesGetParm( int parm, int arg );
|
|
|
|
|
2023-10-27 15:33:01 +02:00
|
|
|
////////////////////////////////////////////////////////////
|
2023-10-24 17:32:42 +02:00
|
|
|
// Extra functions used in ref_vk
|
2023-10-27 15:33:01 +02:00
|
|
|
void R_TextureAcquire( unsigned int texnum );
|
|
|
|
void R_TextureRelease( unsigned int texnum );
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
kColorspaceNative,
|
|
|
|
kColorspaceLinear,
|
|
|
|
kColorspaceGamma,
|
|
|
|
} colorspace_hint_e;
|
|
|
|
|
|
|
|
int R_TextureUploadFromFileExAcquire( const char *filename, colorspace_hint_e colorspace, qboolean force_reload );
|
2023-10-24 17:32:42 +02:00
|
|
|
|
|
|
|
int R_TextureFindByNameF( const char *fmt, ...);
|
|
|
|
|
|
|
|
// Tries to find a texture by its short name
|
|
|
|
// Full names depend on map name, wad name, etc. This function tries them all.
|
|
|
|
// Returns -1 if not found
|
|
|
|
int R_TextureFindByNameLike( const char *texture_name );
|
2023-10-24 18:24:14 +02:00
|
|
|
|
|
|
|
struct vk_texture_s;
|
|
|
|
struct vk_texture_s *R_TextureGetByIndex( uint index );
|