2#include "BS_tracy_thread_pool.hpp"
13#include <glm/gtc/quaternion.hpp>
41 const std::vector<tinygltf::BufferView>& bufferViews,
52 const std::vector<tinygltf::BufferView> &bufferViews,
53 const std::vector<tinygltf::Accessor> &accessors,
const tinygltf::Primitive &primitive);
79 tinygltf::Image
image = tinygltf::Image();
103 const tinygltf::Model* model =
nullptr);
165 const tinygltf::Model* model =
nullptr);
363 void parsePbrData(
const tinygltf::Model &model,
const tinygltf::Material &material);
451 GltfMeshData(
const tinygltf::Model &model,
const tinygltf::Mesh &
mesh,
const tinygltf::Node &node,
513 void load(
const std::filesystem::path &path, std::vector<GltfMeshData> &meshes)
const;
515 std::optional<tinygltf::Model>
loadModel(
const std::filesystem::path &path)
const;
517 tinygltf::Model
loadAsync(
const std::filesystem::path &path)
const;
Animation clip loaded from glTF animation data.
std::vector< Vertex > getPrimitiveVertices(const tinygltf::Primitive &primitive)
NamedThreadPool * threadPool
std::optional< tinygltf::Model > loadModel(const std::filesystem::path &path) const
static Assets::Skin loadSkinData(const tinygltf::Model &model, int skinIndex)
Load skin (skeleton) data from a glTF model.
GltfLoader(NamedThreadPool *threadPool=nullptr)
tinygltf::Model loadMetadataOnly(const std::filesystem::path &path) const
Loads only the GLTF metadata (nodes, names, transforms) without loading buffer data.
void load(const std::filesystem::path &path, std::vector< GltfMeshData > &meshes) const
Loads a vector of meshes from a gltf file.
Ecs::PrimitiveData loadPrimitiveData(GltfVertexData vertexData)
static Animation loadAnimationData(const tinygltf::Model &model, int animIndex, const Assets::Skin &skin)
Load animation data from a glTF model.
tinygltf::Model loadAsync(const std::filesystem::path &path) const
Skeleton definition loaded from glTF skin data.
Wrapper for texture data.
Tracy-named thread pool using BS_tracy::tracy_thread_pool.
Engine::Core::MaterialData MaterialData
Core audio subsystem owning the miniaudio engine and managing playback.
const tinygltf::Buffer & buffer
GltfBufferDataView(const std::vector< tinygltf::Buffer > &buffers, const std::vector< tinygltf::BufferView > &bufferViews, const tinygltf::Accessor &accessor)
const tinygltf::Accessor & accessor
const tinygltf::BufferView & bufferView
Stores the material data which is relevant for our current set of shaders.
float getMetallicFactor() const
glm::vec3 getEmissiveFactor() const
bool hasVulkanSchneeExtension() const
void parsePbrData(const tinygltf::Model &model, const tinygltf::Material &material)
const Materials::MaterialData & getMaterialData() const
GltfMaterialData()=default
uint32_t getNormalTextureIndex() const
GltfMaterialData(const tinygltf::Model &model, const tinygltf::Material &material, const StaticMeshExtensions &meshSettings)
int32_t getGltfMetallicRoughnessTextureIndex() const
bool hasEmissiveTexture() const
bool hasNormalTexture() const
int32_t gltfNormalTextureIndex
uint32_t roughnessMetallicTextureIndex
uint32_t getTextureIndex() const
const VulkanSchneeMaterialExtension & getVulkanSchneeExtension() const
const std::filesystem::path & getLightmapPath() const
int32_t getGltfNormalTextureIndex() const
int32_t getGltfEmissiveTextureIndex() const
float getRoughnessFactor() const
int32_t gltfMetallicRoughnessTextureIndex
uint32_t getEmissiveTextureIndex() const
Materials::MaterialData materialData
std::optional< MaterialExtensions > materialExtensions
float getNormalScale() const
uint32_t getRoughnessMetallicTextureIndex() const
bool hasMetallicRoughnessTexture() const
Materials::MaterialData & getMaterialDataRef()
std::filesystem::path lightmapPath
uint32_t normalTextureIndex
int32_t gltfEmissiveTextureIndex
glm::vec4 baseColorFactor
uint32_t emissiveTextureIndex
bool hasLightmapTexture() const
std::string getShaderName() const
std::vector< GltfMeshPrimitiveData > getPrimitives() const
std::string getName() const
int skinIndex
glTF skin index (-1 = no skin)
GltfMeshData(const tinygltf::Model &model, const tinygltf::Mesh &mesh, const tinygltf::Node &node, const glm::mat4 &transform)
std::vector< GltfMeshPrimitiveData > & getPrimitivesRef()
std::vector< GltfMeshPrimitiveData > primitives
glm::mat4 getTransform() const
Gets the model matrix for the object from the file it was imported from.
GltfMaterialData getMaterialData() const
const std::vector< BoneVertexData > & getBoneVertexData() const
GltfMeshPrimitiveData()=default
RuntimeTexture * colorTexturePtr
uint32_t getColorTextureIndex() const
std::vector< Vertex > vertices
std::vector< Vertex > getVertices() const
Gets a list of all unprocessed vertices of this primtitive.
RuntimeTexture * getColorTexturePtr() const
Gets the pointer to the primitive of the color texture. This is only a valid pointer after it has bee...
GltfMeshPrimitiveData(tinygltf::Model model, tinygltf::Primitive primitive, StaticMeshExtensions meshSettings)
Extracts all relevant data from the tinygltf importer objects.
std::vector< uint32_t > indices
tinygltf::Primitive primitive
std::vector< BoneVertexData > boneVertexData
Empty for static meshes.
std::vector< uint32_t > getIndices() const
Gets the raw unprocessed list of all indices.
GltfMaterialData materialData
GltfTextureData()=default
bool hasTextureData() const
GltfTextureData(const tinygltf::Image &image)
tinygltf::Image getImage() const
std::optional< GltfBufferDataView > uvDataView
std::optional< GltfBufferDataView > positionDataView
std::optional< GltfBufferDataView > normalDataView
std::optional< GltfBufferDataView > indexDataView
GltfVertexData(const std::vector< tinygltf::Buffer > &buffers, const std::vector< tinygltf::BufferView > &bufferViews, const std::vector< tinygltf::Accessor > &accessors, const tinygltf::Primitive &primitive)
std::optional< GltfBufferDataView > jointsDataView
JOINTS_0 (typically uint16 x4)
std::optional< GltfBufferDataView > tangentDataView
std::optional< GltfBufferDataView > lightmapDataView
std::optional< GltfBufferDataView > weightsDataView
WEIGHTS_0 (float x4)
MaterialExtensions()=default
std::optional< VulkanSchneeMaterialExtension > vulkanSchneeMaterialExtension
MaterialExtensions(const tinygltf::ExtensionMap &material)
Parses all extensions and extracts recognized extensions.
StaticMeshExtensions(const tinygltf::Model &model, const tinygltf::ExtensionMap &extensions)
StaticMeshExtensions(const tinygltf::ExtensionMap &extensions)
StaticMeshExtensions()=default
std::optional< VulkanSchneeExtension > vulkanSchneeExtension
StaticMeshSettings(const tinygltf::Value &extras)
StaticMeshSettings()=default
std::filesystem::path lightMapPath
std::vector< uint32_t > edgeIndices
std::vector< glm::vec3 > vertices
std::vector< uint32_t > indices
CollisionProperties()=default
std::vector< uint32_t > indices
bool hasCollision() const
static ShapeType parseShapeType(const std::string &typeStr)
CollisionProperties(const tinygltf::Value &extension, const tinygltf::Model *model=nullptr)
std::vector< CompoundChild > compoundChildren
std::vector< glm::vec3 > vertices
float angularDiameterDegrees
DirectionalLightProperties(const tinygltf::Value &extension)
bool isLightmapPathValid() const
std::filesystem::path lightmapPath
LightmapProperties(const tinygltf::Value &extension)
std::filesystem::path lightmapKtxPath
const std::filesystem::path & getRuntimeLightmapPath() const
std::optional< LightmapProperties > lightmapProperties
bool getReceiveShadows() const
bool getCastShadows() const
bool getHasLightmaps() const
LightProperties(const tinygltf::Value &extension)
MeshProperties(const tinygltf::Value &extension)
PointLightProperties(const tinygltf::Value &extension)
VulkanSchneeExtension(const tinygltf::Value &vs_extension, const tinygltf::Model *model=nullptr)
VulkanSchneeExtension()=default
std::optional< LightProperties > lightProperties
bool hasPointLightProperties() const
std::optional< DirectionalLightProperties > directionalLightProperties
bool hasCollisionProperties() const
static std::string extractVersion(const tinygltf::Value &vs_extension)
Extracts the version from the material extension.
std::optional< PointLightProperties > pointLightProperties
bool hasLightProperties() const
bool hasMeshProperties() const
bool hasLightmapProperties() const
std::optional< MeshProperties > meshProperties
std::optional< LightProperties::LightmapProperties > lightmapProperties
std::optional< CollisionProperties > collisionProperties
bool hasDirectionalLightProperties() const
ShaderParameter(const tinygltf::Value ¶m)
Extracts all material data from the gltf file. All data during runtime will be read from an object of...
std::map< std::string, tinygltf::Value > customProperties
VulkanSchneeMaterialExtension()=default
VulkanSchneeMaterialExtension(const tinygltf::Value &vs_extension)
std::map< std::string, ShaderParameter > shaderParameters
Rendering::PipelineNames materialName
std::map< std::string, double > nodeProperties