10#define MATERIAL_MAX_TEXTURE_COUNT 3
11#define MODEL_ROOT_NODE_INDEX 0
12#define ASSETS_DIR "assets"
15#include <glm/gtc/quaternion.hpp>
18#include <unordered_map>
49 glm::vec4
min{FLT_MAX};
50 glm::vec4
max{-FLT_MAX};
93 SDL_GPUTexture*
tex =
nullptr;
150inline std::unordered_map<MeshIdInt, Mesh>
meshes_;
151inline std::unordered_map<ModelIdInt, Model>
models_;
153inline std::unordered_map<MaterialIdInt, Material>
materials_;
162inline uint32_t
fnv1a32(
const std::string& str)
164 uint32_t hash = 2166136261u;
165 for (
const char c : str)
166 hash = (hash ^
static_cast<uint8_t
>(c)) * 16777619u;
uint32_t TexIdInt
Definition Asset.hpp:23
uint32_t MeshIdInt
Definition Asset.hpp:21
uint32_t ModelIdInt
Definition Asset.hpp:22
uint32_t MaterialIdInt
Definition Asset.hpp:24
glm::mat4 weaponViewModel_
Definition Asset.hpp:157
TexIdInt getTexIdFromString(const std::string &strId)
Convert a string identifier to a TexIdInt hash.
Definition Asset.hpp:197
std::unordered_map< TexIdInt, Texture > textures_
Definition Asset.hpp:152
std::unordered_map< MaterialIdInt, Material > materials_
Definition Asset.hpp:153
uint32_t getIdFromString(const std::string &strId)
Convert a string identifier to a generic 32-bit hash ID.
Definition Asset.hpp:173
ModelIdInt weaponModelId_
Definition Asset.hpp:156
ModelIdInt getModelIdFromString(const std::string &strId)
Convert a string identifier to a ModelIdInt hash.
Definition Asset.hpp:189
MeshIdInt getMeshIdFromString(const std::string &strId)
Convert a string identifier to a MeshIdInt hash.
Definition Asset.hpp:181
std::vector< ModelInstance > modelInstances_
Definition Asset.hpp:155
std::unordered_map< ModelIdInt, Model > models_
Definition Asset.hpp:151
uint32_t fnv1a32(const std::string &str)
Compute a 32-bit FNV-1a hash of the given string.
Definition Asset.hpp:162
MaterialIdInt getMaterialIdFromString(const std::string &strId)
Definition Asset.hpp:202
std::unordered_map< MeshIdInt, Mesh > meshes_
Definition Asset.hpp:150
glm::vec4 max
Definition Asset.hpp:50
glm::vec4 min
Definition Asset.hpp:49
std::vector< Vertex > vertexData_
Definition Asset.hpp:66
std::vector< uint32_t > indexData_
Definition Asset.hpp:67
References a CPU-side source pointer and its corresponding GPU buffer.
Definition Asset.hpp:31
Uint32 bufferSize
Definition Asset.hpp:34
SDL_GPUBuffer * gpuBuff
Definition Asset.hpp:33
void * srcData
Definition Asset.hpp:32
GeoBufferInfo vBufferInfo_
Definition Asset.hpp:72
GeoBufferInfo iBufferInfo_
Definition Asset.hpp:73
glm::vec3 kEmission_
Definition Asset.hpp:81
float nIor
Definition Asset.hpp:83
glm::vec3 kAmbient_
Definition Asset.hpp:79
TexIdInt diffuseTexture
Definition Asset.hpp:85
TexIdInt metallicRoughnessTexture
Definition Asset.hpp:87
TexIdInt normalTexture
Definition Asset.hpp:86
glm::vec3 kDiffuse_
Definition Asset.hpp:78
bool hasPhongData_
Definition Asset.hpp:84
glm::vec3 kSpecular_
Definition Asset.hpp:80
float nSpecular
Definition Asset.hpp:82
A single mesh: CPU-side vertex/index data plus GPU buffer info.
Definition Asset.hpp:54
GeoBufferInfo iBufferInfo_
Definition Asset.hpp:58
std::vector< Vertex > vertexData_
Definition Asset.hpp:55
std::vector< uint32_t > indexData_
Definition Asset.hpp:56
GeoBufferInfo vBufferInfo_
Definition Asset.hpp:57
AABB aabb_
Definition Asset.hpp:59
MaterialIdInt materialId_
Definition Asset.hpp:102
AABB cachedAabb_
Definition Asset.hpp:104
MeshIdInt meshId_
Definition Asset.hpp:101
glm::mat4 cachedTransform_
Definition Asset.hpp:103
ModelIdInt modelId_
Definition Asset.hpp:145
bool drawInScenePass
Definition Asset.hpp:147
glm::mat4 transform_
Definition Asset.hpp:146
glm::mat4 transform_
Definition Asset.hpp:111
std::vector< uint32_t > modelElementsIndices_
Definition Asset.hpp:110
std::vector< uint32_t > childIndices_
Definition Asset.hpp:109
std::vector< MaterialIdInt > materialsByIndex_
Material id for each source material index (parallel to aiScene::mMaterials).
Definition Asset.hpp:136
glm::vec3 muzzleLocalPos
Definition Asset.hpp:140
std::vector< ModelNode > modelNodes_
Definition Asset.hpp:130
std::vector< PointLight > pointLights
Definition Asset.hpp:137
std::unordered_map< std::string, MountPoint > mountPoints
Definition Asset.hpp:138
std::vector< ModelElement > modelElements_
Definition Asset.hpp:131
bool hasMuzzle
Definition Asset.hpp:139
glm::vec3 position
Definition Asset.hpp:116
glm::quat rotation
Definition Asset.hpp:117
glm::vec3 position
Definition Asset.hpp:122
glm::vec3 color
Definition Asset.hpp:124
float range
Definition Asset.hpp:125
float intensity
Definition Asset.hpp:123
int channels
Definition Asset.hpp:96
stbi_uc * tex_raw
Definition Asset.hpp:92
int width
Definition Asset.hpp:94
SDL_GPUTexture * tex
Definition Asset.hpp:93
int height
Definition Asset.hpp:95
Per-vertex attributes: position, normal, texture coordinates, and tangent.
Definition Asset.hpp:39
glm::vec3 normal
Definition Asset.hpp:41
glm::vec4 tangent
Definition Asset.hpp:43
glm::vec3 position
Definition Asset.hpp:40
glm::vec2 lightMapUV
Definition Asset.hpp:44
glm::vec2 texUV
Definition Asset.hpp:42