2021-01-17 00:45:10 +01:00
|
|
|
#pragma once
|
|
|
|
#include "vk_core.h"
|
2021-11-21 22:40:11 +01:00
|
|
|
#include "vk_image.h"
|
2022-01-08 08:22:19 +01:00
|
|
|
#include "vk_const.h"
|
2021-01-17 00:45:10 +01:00
|
|
|
|
2021-01-04 21:39:09 +01:00
|
|
|
#include "xash3d_types.h"
|
|
|
|
#include "const.h"
|
|
|
|
#include "render_api.h"
|
|
|
|
#include "com_image.h"
|
|
|
|
|
|
|
|
typedef struct vk_texture_s
|
|
|
|
{
|
|
|
|
char name[256];
|
|
|
|
int width, height;
|
|
|
|
texFlags_t flags;
|
|
|
|
uint texnum;
|
|
|
|
|
2021-01-17 00:45:10 +01:00
|
|
|
struct {
|
2021-11-21 22:40:11 +01:00
|
|
|
xvk_image_t image;
|
2021-01-17 00:45:10 +01:00
|
|
|
VkDescriptorSet descriptor;
|
|
|
|
} vk;
|
|
|
|
|
2021-01-04 21:39:09 +01:00
|
|
|
uint hashValue;
|
|
|
|
struct vk_texture_s *nextHash;
|
|
|
|
} vk_texture_t;
|
|
|
|
|
|
|
|
#define MAX_LIGHTMAPS 256
|
|
|
|
|
|
|
|
typedef struct vk_textures_global_s
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
|
|
|
int skytexturenum; // this not a gl_texturenum!
|
2021-11-19 20:31:45 +01:00
|
|
|
int skyboxbasenum; // start with 5800 FIXME remove this, lewa says this is a GL1 hack
|
|
|
|
|
|
|
|
qboolean fCustomSkybox; // TODO do we need this for anything?
|
2021-11-21 23:53:51 +01:00
|
|
|
|
|
|
|
vk_texture_t skybox_cube;
|
|
|
|
vk_texture_t cubemap_placeholder;
|
2022-01-08 08:22:19 +01:00
|
|
|
|
|
|
|
VkDescriptorImageInfo dii_all_textures[MAX_TEXTURES];
|
2021-01-04 21:39:09 +01:00
|
|
|
} vk_textures_global_t;
|
|
|
|
|
2021-02-14 02:19:59 +01:00
|
|
|
// TODO rename this consistently
|
2021-01-31 00:31:23 +01:00
|
|
|
extern vk_textures_global_t tglob;
|
|
|
|
|
2021-01-04 21:39:09 +01:00
|
|
|
// Helper functions
|
|
|
|
void initTextures( void );
|
2021-01-17 00:45:10 +01:00
|
|
|
void destroyTextures( void );
|
2021-01-04 21:39:09 +01:00
|
|
|
vk_texture_t *findTexture(int index);
|
|
|
|
|
|
|
|
// Public API functions
|
|
|
|
int VK_FindTexture( const char *name );
|
|
|
|
const char* VK_TextureName( unsigned int texnum );
|
|
|
|
const byte* VK_TextureData( unsigned int texnum );
|
|
|
|
int VK_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
|
|
|
|
int VK_CreateTexture( const char *name, int width, int height, const void *buffer, texFlags_t flags );
|
|
|
|
int VK_LoadTextureArray( const char **names, int flags );
|
|
|
|
int VK_CreateTextureArray( const char *name, int width, int height, int depth, const void *buffer, texFlags_t flags );
|
|
|
|
void VK_FreeTexture( unsigned int texnum );
|
|
|
|
int VK_LoadTextureFromBuffer( const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update );
|
2021-01-31 00:31:23 +01:00
|
|
|
|
2021-11-25 23:38:03 +01:00
|
|
|
int XVK_LoadTextureReplace( const char *name, const byte *buf, size_t size, int flags );
|
|
|
|
|
2021-11-15 00:44:07 +01:00
|
|
|
int XVK_TextureLookupF( const char *fmt, ...);
|
|
|
|
|
2021-01-31 00:31:23 +01:00
|
|
|
#define VK_LoadTextureInternal( name, pic, flags ) VK_LoadTextureFromBuffer( name, pic, flags, false )
|
|
|
|
|
2021-11-19 20:31:45 +01:00
|
|
|
void XVK_SetupSky( const char *skyboxname );
|
2021-12-22 20:02:34 +01:00
|
|
|
|
|
|
|
// 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 XVK_FindTextureNamedLike( const char *texture_name );
|
2021-12-22 20:55:35 +01:00
|
|
|
|
|
|
|
int XVK_CreateDummyTexture( const char *name );
|