11#define MODEL_ROOT_NODE_INDEX 0
12#define ASSETS_DIR "assets"
16#include <unordered_map>
79 SDL_GPUTexture*
tex =
nullptr;
114inline std::unordered_map<MeshIdInt, Mesh>
meshes_;
115inline std::unordered_map<ModelIdInt, Model>
models_;
117inline std::unordered_map<MaterialIdInt, Material>
materials_;
126inline uint32_t
fnv1a32(
const std::string& str)
128 uint32_t hash = 2166136261u;
129 for (
const char c : str)
130 hash = (hash ^
static_cast<uint8_t
>(c)) * 16777619u;
uint32_t TexIdInt
Definition Asset.hpp:21
uint32_t MeshIdInt
Definition Asset.hpp:19
#define TEX_CHANNELS
Definition Asset.hpp:10
uint32_t ModelIdInt
Definition Asset.hpp:20
uint32_t MaterialIdInt
Definition Asset.hpp:22
glm::mat4 weaponViewModel_
Definition Asset.hpp:121
TexIdInt getTexIdFromString(const std::string &strId)
Convert a string identifier to a TexIdInt hash.
Definition Asset.hpp:161
std::unordered_map< TexIdInt, Texture > textures_
Definition Asset.hpp:116
std::unordered_map< MaterialIdInt, Material > materials_
Definition Asset.hpp:117
uint32_t getIdFromString(const std::string &strId)
Convert a string identifier to a generic 32-bit hash ID.
Definition Asset.hpp:137
ModelIdInt weaponModelId_
Definition Asset.hpp:120
ModelIdInt getModelIdFromString(const std::string &strId)
Convert a string identifier to a ModelIdInt hash.
Definition Asset.hpp:153
MeshIdInt getMeshIdFromString(const std::string &strId)
Convert a string identifier to a MeshIdInt hash.
Definition Asset.hpp:145
std::vector< ModelInstance > modelInstances_
Definition Asset.hpp:119
std::unordered_map< ModelIdInt, Model > models_
Definition Asset.hpp:115
uint32_t fnv1a32(const std::string &str)
Compute a 32-bit FNV-1a hash of the given string.
Definition Asset.hpp:126
MaterialIdInt getMaterialIdFromString(const std::string &strId)
Definition Asset.hpp:166
std::unordered_map< MeshIdInt, Mesh > meshes_
Definition Asset.hpp:114
std::vector< Vertex > vertexData_
Definition Asset.hpp:54
std::vector< uint32_t > indexData_
Definition Asset.hpp:55
References a CPU-side source pointer and its corresponding GPU buffer.
Definition Asset.hpp:29
Uint32 bufferSize
Definition Asset.hpp:32
SDL_GPUBuffer * gpuBuff
Definition Asset.hpp:31
void * srcData
Definition Asset.hpp:30
GeoBufferInfo vBufferInfo_
Definition Asset.hpp:60
GeoBufferInfo iBufferInfo_
Definition Asset.hpp:61
glm::vec3 kEmission_
Definition Asset.hpp:69
float nIor
Definition Asset.hpp:71
glm::vec3 kAmbient_
Definition Asset.hpp:67
TexIdInt texId_[TEX_CHANNELS]
Definition Asset.hpp:73
glm::vec3 kDiffuse_
Definition Asset.hpp:66
bool hasPhongData_
Definition Asset.hpp:72
glm::vec3 kSpecular_
Definition Asset.hpp:68
float nSpecular
Definition Asset.hpp:70
A single mesh: CPU-side vertex/index data plus GPU buffer info.
Definition Asset.hpp:45
GeoBufferInfo iBufferInfo_
Definition Asset.hpp:49
std::vector< Vertex > vertexData_
Definition Asset.hpp:46
std::vector< uint32_t > indexData_
Definition Asset.hpp:47
GeoBufferInfo vBufferInfo_
Definition Asset.hpp:48
MaterialIdInt materialId_
Definition Asset.hpp:88
MeshIdInt meshId_
Definition Asset.hpp:87
glm::mat4 cachedTransform_
Definition Asset.hpp:89
ModelIdInt modelId_
Definition Asset.hpp:109
bool drawInScenePass
Definition Asset.hpp:111
glm::mat4 transform_
Definition Asset.hpp:110
glm::mat4 transform_
Definition Asset.hpp:96
std::vector< uint32_t > modelElementsIndices_
Definition Asset.hpp:95
std::vector< uint32_t > childIndices_
Definition Asset.hpp:94
glm::vec3 muzzleLocalPos
Definition Asset.hpp:104
std::vector< ModelNode > modelNodes_
Definition Asset.hpp:101
std::vector< ModelElement > modelElements_
Definition Asset.hpp:102
bool hasMuzzle
Definition Asset.hpp:103
int channels
Definition Asset.hpp:82
stbi_uc * tex_raw
Definition Asset.hpp:78
int width
Definition Asset.hpp:80
SDL_GPUTexture * tex
Definition Asset.hpp:79
int height
Definition Asset.hpp:81
Per-vertex attributes: position, normal, and texture coordinates.
Definition Asset.hpp:37
glm::vec3 normal
Definition Asset.hpp:39
glm::vec3 position
Definition Asset.hpp:38
glm::vec2 texUV
Definition Asset.hpp:40