Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
GltfLoader.h
1#pragma once
2#include "Engine/Animation/AnimationAsset.h"
3#include "Engine/Animation/SkinAsset.h"
4#include "Engine/Ecs/EcsData.h"
5#include "Engine/Material/MaterialData.h"
6#include "Engine/World/Transform.h"
7
8#include <Engine/Mesh/Vertex.h>
9#include <filesystem>
10#include <glm/gtc/quaternion.hpp>
11#include <limits>
12#include <tiny_gltf.h>
13#include <vector>
14
15class NamedThreadPool;
16
17namespace Engine::Assets
18{
19 class RuntimeTexture;
20 class Texture;
21} // namespace Engine::Assets
22
23namespace Engine::Core
24{
25 class AssetManager;
26} // namespace Engine::Core
27
29{
30
39 {
40 public:
45 GltfLoader( NamedThreadPool * threadPool = nullptr );
46
51
59 {
67 const std::vector<tinygltf::Buffer> & buffers,
68 const std::vector<tinygltf::BufferView> & bufferViews,
69 const tinygltf::Accessor & accessor
70 );
71
75 const tinygltf::Accessor & accessor;
76
80 const tinygltf::BufferView & bufferView;
81
85 const tinygltf::Buffer & buffer;
86
90 const float * data;
91 };
92
97 {
106 const std::vector<tinygltf::Buffer> & buffers,
107 const std::vector<tinygltf::BufferView> & bufferViews,
108 const std::vector<tinygltf::Accessor> & accessors,
109 const tinygltf::Primitive & primitive
110 );
111
115 std::optional<GltfBufferDataView> positionDataView;
116
120 std::optional<GltfBufferDataView> normalDataView;
121
126 std::optional<GltfBufferDataView>
127 tangentDataView; // TANGENT attribute (vec4: xyz=tangent, w=handedness)
128
132 std::optional<GltfBufferDataView> uvDataView;
133
137 std::optional<GltfBufferDataView> lightmapDataView;
138
142 std::optional<GltfBufferDataView> indexDataView;
143
147 std::optional<GltfBufferDataView> jointsDataView;
148
152 std::optional<GltfBufferDataView> weightsDataView;
153 };
154
161 std::vector<Vertex> getPrimitiveVertices( const tinygltf::Primitive & primitive );
162
169
174 {
178 GltfTextureData() = default;
179
184 GltfTextureData( const tinygltf::Image & image ) : image( image ) {}
185
190 [[nodiscard]] tinygltf::Image getImage() const
191 {
192 return image;
193 }
194
199 [[nodiscard]] bool hasTextureData() const;
200
201 private:
202 tinygltf::Image image = tinygltf::Image();
203 };
204
209 {
214
219 StaticMeshSettings( const tinygltf::Value & extras );
220
224 bool bUsesLightMaps = false;
225
229 std::filesystem::path lightMapPath = std::filesystem::path();
230
234 int lightMapUvIndex = std::numeric_limits<int>::max();
235 };
236
245 {
250 {
251 std::string name;
252 uint32_t nodeIndex = 0;
253 };
254
259
266 const tinygltf::Value & vs_extension,
267 const tinygltf::Model * model = nullptr
268 );
269
274 {
279 explicit MeshProperties( const tinygltf::Value & extension );
280
285
290 };
291
296 {
301 explicit LightProperties( const tinygltf::Value & extension );
302
307 {
312 explicit LightmapProperties( const tinygltf::Value & extension );
313
317 std::filesystem::path lightmapPath;
318
322 std::filesystem::path lightmapKtxPath;
323
328
334
339 [[nodiscard]] const std::filesystem::path & getRuntimeLightmapPath() const;
340 };
341
346 bool getCastShadows() const;
347
352 bool getReceiveShadows() const;
353
358 bool getHasLightmaps() const;
359
360 private:
361 std::optional<LightmapProperties> lightmapProperties;
362
366 };
367
371 struct metadata
372 {
376 std::string blenderObjectName;
377 };
378
386 {
407
412
419 const tinygltf::Value & extension,
420 const tinygltf::Model * model = nullptr
421 );
422
427
431 bool generateConvexHull = false;
432
436 std::string collisionProfile;
437
441 glm::vec3 offset{ 0.0f };
442
443 // Primitive params
447 glm::vec3 boxHalfExtents{ 0.5f };
448
452 float sphereRadius = 0.5f;
453
457 float capsuleRadius = 0.5f;
458
462 float capsuleHeight = 1.0f;
463
464 // Convex/mesh data
468 std::vector<glm::vec3> vertices;
469
473 std::vector<uint32_t> indices;
474
475 // Compound children
480 {
484 std::string name;
485
489 std::vector<glm::vec3> vertices;
490
494 std::vector<uint32_t> indices;
495
499 std::vector<uint32_t> edgeIndices;
500
504 glm::vec3 offset{ 0.0f };
505
509 glm::quat rotation{ glm::identity<glm::quat>() };
510 };
511
515 std::vector<CompoundChild> compoundChildren;
516
521 [[nodiscard]] bool hasCollision() const
522 {
523 return shapeType != ShapeType::NONE;
524 }
525
526 private:
527 static ShapeType parseShapeType( const std::string & typeStr );
528 };
529
534 {
539 explicit PointLightProperties( const tinygltf::Value & extension );
540
544 glm::vec3 color{ 1.0f };
545
549 float intensity = 1.0f;
550
554 float radius = 10.0f;
555
559 float cullDistance = 100.0f;
560 };
561
566 {
571 explicit DirectionalLightProperties( const tinygltf::Value & extension );
572
576 glm::vec3 color{ 1.0f };
577
581 glm::vec3 direction{ 0.0f, -1.0f, 0.0f };
582
586 float intensity = 1.0f;
587
591 bool enabled = true;
592
596 bool castsShadows = true;
597
601 bool hasDirection = false;
602
607 };
608
612 std::optional<LightProperties> lightProperties;
613
617 std::optional<MeshProperties> meshProperties;
618
622 std::optional<LightProperties::LightmapProperties> lightmapProperties;
623
627 std::optional<CollisionProperties> collisionProperties;
628
632 std::optional<PointLightProperties> pointLightProperties;
633
637 std::optional<DirectionalLightProperties> directionalLightProperties;
638
639 std::vector<AnchorPointReference> anchorPoints;
640
645 [[nodiscard]] bool hasLightProperties() const;
646
651 [[nodiscard]] bool hasLightmapProperties() const;
652
657 [[nodiscard]] bool hasMeshProperties() const;
658
663 [[nodiscard]] bool hasCollisionProperties() const;
664
669 [[nodiscard]] bool hasPointLightProperties() const;
670
675 [[nodiscard]] bool hasDirectionalLightProperties() const;
676
681 [[nodiscard]] bool hasAnchorPoints() const;
682
683 private:
694 static std::string extractVersion( const tinygltf::Value & vs_extension );
695 };
696
704 {
709
714 explicit VulkanSchneeMaterialExtension( const tinygltf::Value & vs_extension );
715
720 {
725 explicit ShaderParameter( const tinygltf::Value & param );
726
730 std::string type; // "connected" or "value"
731
735 std::string socketType; // Socket type from Blender
736
740 tinygltf::Value value; // Only valid if type == "value"
741 };
742
746 std::string shaderType;
747
752
756 std::map<std::string, ShaderParameter> shaderParameters;
757
761 std::map<std::string, double> nodeProperties;
762
766 std::map<std::string, tinygltf::Value> customProperties;
767
771 bool normalMapBC5 = false; // True when normal map uses BC5 (2-channel RG)
772 };
773
778 {
783
788 explicit MaterialExtensions( const tinygltf::ExtensionMap & material );
789
793 std::optional<VulkanSchneeMaterialExtension> vulkanSchneeMaterialExtension;
794 };
795
800 {
805
810 explicit StaticMeshExtensions( const tinygltf::ExtensionMap & extensions );
811
817 StaticMeshExtensions( const tinygltf::Model & model, const tinygltf::ExtensionMap & extensions );
818
822 std::optional<VulkanSchneeExtension> vulkanSchneeExtension;
823 };
824
832 {
836 GltfMaterialData() = default;
837
846 const tinygltf::Model & model,
847 const tinygltf::Material & material,
848 const StaticMeshExtensions & meshSettings
849 );
850
855 [[nodiscard]] bool hasTexture() const;
856
861 [[nodiscard]] uint32_t getTextureIndex() const;
862
867 [[nodiscard]] bool hasVulkanSchneeExtension() const;
868
875
880 [[nodiscard]] std::string getShaderName() const;
881
886 [[nodiscard]] const Materials::MaterialData & getMaterialData() const
887 {
888 return materialData;
889 }
890
896 {
897 return materialData;
898 }
899
904 [[nodiscard]] uint32_t getNormalTextureIndex() const
905 {
906 return normalTextureIndex;
907 }
908
913 [[nodiscard]] uint32_t getRoughnessMetallicTextureIndex() const
914 {
916 }
917
922 [[nodiscard]] uint32_t getEmissiveTextureIndex() const
923 {
925 }
926
931 [[nodiscard]] float getRoughnessFactor() const
932 {
933 return roughnessFactor;
934 }
935
940 [[nodiscard]] float getMetallicFactor() const
941 {
942 return metallicFactor;
943 }
944
949 [[nodiscard]] float getNormalScale() const
950 {
951 return normalScale;
952 }
953
958 [[nodiscard]] glm::vec3 getEmissiveFactor() const
959 {
960 return emissiveFactor;
961 }
962
967 [[nodiscard]] bool hasNormalTexture() const
968 {
969 return gltfNormalTextureIndex >= 0;
970 }
971
976 [[nodiscard]] bool hasMetallicRoughnessTexture() const
977 {
979 }
980
985 [[nodiscard]] bool hasEmissiveTexture() const
986 {
987 return gltfEmissiveTextureIndex >= 0;
988 }
989
994 [[nodiscard]] int32_t getGltfNormalTextureIndex() const
995 {
997 }
998
1003 [[nodiscard]] int32_t getGltfMetallicRoughnessTextureIndex() const
1004 {
1006 }
1007
1012 [[nodiscard]] int32_t getGltfEmissiveTextureIndex() const
1013 {
1015 }
1016
1021 [[nodiscard]] bool hasLightmapTexture() const
1022 {
1023 return !lightmapPath.empty();
1024 }
1025
1030 [[nodiscard]] const std::filesystem::path & getLightmapPath() const
1031 {
1032 return lightmapPath;
1033 }
1034
1035 private:
1037 void parsePbrData( const tinygltf::Model & model, const tinygltf::Material & material );
1038
1040
1041 std::optional<MaterialExtensions> materialExtensions;
1042 glm::vec4 baseColorFactor = glm::vec4( 0.0f, 0.0f, 0.0f, 0.0f );
1043 uint32_t textureIndex = std::numeric_limits<uint32_t>::max();
1044
1045 // PBR texture indices (0xFFFFFFFF = not present)
1046 uint32_t normalTextureIndex = 0xFFFFFFFF;
1047 uint32_t roughnessMetallicTextureIndex = 0xFFFFFFFF;
1048 uint32_t emissiveTextureIndex = 0xFFFFFFFF;
1049
1050 // PBR material factors
1051 float roughnessFactor = 1.0f;
1052 float metallicFactor = 0.0f;
1053 float normalScale = 1.0f;
1054 glm::vec3 emissiveFactor = glm::vec3( 0.0f );
1055
1056 // GLTF indices for mapping to texture paths (-1 = not present)
1060
1061 // Lightmap path (from VulkanSchnee extension)
1062 std::filesystem::path lightmapPath;
1063 };
1064
1069 {
1071
1076
1084 tinygltf::Model model,
1085 tinygltf::Primitive primitive,
1086 StaticMeshExtensions meshSettings
1087 );
1088
1094 [[nodiscard]] std::vector<Vertex> getVertices() const;
1095
1100 [[nodiscard]] std::vector<uint32_t> getIndices() const;
1101
1106 [[nodiscard]] GltfMaterialData getMaterialData() const;
1107
1115 [[nodiscard]] RuntimeTexture * getColorTexturePtr() const;
1116
1121 [[nodiscard]] uint32_t getColorTextureIndex() const;
1122
1127 [[nodiscard]] const std::vector<BoneVertexData> & getBoneVertexData() const
1128 {
1129 return boneVertexData;
1130 }
1131
1136 [[nodiscard]] bool hasSkinData() const
1137 {
1138 return !boneVertexData.empty();
1139 }
1140
1141 private:
1142 uint32_t textureIndex = std::numeric_limits<uint32_t>::max();
1144
1145 tinygltf::Primitive primitive;
1147 std::vector<Vertex> vertices;
1148 std::vector<uint32_t> indices;
1149 std::vector<BoneVertexData> boneVertexData;
1150 };
1151
1156 {
1165 const tinygltf::Model & model,
1166 const tinygltf::Mesh & mesh,
1167 const tinygltf::Node & node,
1168 const glm::mat4 & transform
1169 );
1170
1175 [[nodiscard]] std::vector<GltfMeshPrimitiveData> getPrimitives() const
1176 {
1177 return primitives;
1178 }
1179
1184 [[nodiscard]] std::vector<GltfMeshPrimitiveData> & getPrimitivesRef()
1185 {
1186 return primitives;
1187 }
1188
1193 [[nodiscard]] std::string getName() const
1194 {
1195 return name;
1196 }
1197
1202 [[nodiscard]] glm::mat4 getTransform() const
1203 {
1204 return transform;
1205 }
1206
1211 [[nodiscard]] int getSkinIndex() const
1212 {
1213 return skinIndex;
1214 }
1215
1216 private:
1217 std::string name;
1218 tinygltf::Mesh mesh;
1219 std::vector<GltfMeshPrimitiveData> primitives;
1220 glm::mat4 transform;
1221 int skinIndex = -1;
1222 };
1223
1234 static Assets::Skin loadSkinData( const tinygltf::Model & model, int skinIndex );
1235
1247 static Animation
1248 loadAnimationData( const tinygltf::Model & model, int animIndex, const Assets::Skin & skin );
1249
1259 void load( const std::filesystem::path & path, std::vector<GltfMeshData> & meshes ) const;
1260
1271 std::optional<tinygltf::Model> loadModel( const std::filesystem::path & path ) const;
1272
1282 tinygltf::Model loadAsync( const std::filesystem::path & path ) const;
1283
1293 tinygltf::Model loadMetadataOnly( const std::filesystem::path & path ) const;
1294
1295 private:
1296 NamedThreadPool * threadPool = nullptr;
1297 };
1298} // namespace Engine::Assets::Loaders
Animation clip loaded from glTF animation data.
std::vector< Vertex > getPrimitiveVertices(const tinygltf::Primitive &primitive)
Legacy primitive vertex extraction entry point.
std::optional< tinygltf::Model > loadModel(const std::filesystem::path &path) const
Loads a full ASCII glTF model through tinygltf.
static Assets::Skin loadSkinData(const tinygltf::Model &model, int skinIndex)
Loads skin data from a glTF model.
GltfLoader(NamedThreadPool *threadPool=nullptr)
Creates a loader that can use an optional thread pool for deferred work.
tinygltf::Model loadMetadataOnly(const std::filesystem::path &path) const
Loads only glTF metadata without loading buffer data.
void load(const std::filesystem::path &path, std::vector< GltfMeshData > &meshes) const
Loads mesh nodes from a glTF file.
Ecs::PrimitiveData loadPrimitiveData(GltfVertexData vertexData)
Converts resolved glTF vertex and index views into engine primitive data.
static Animation loadAnimationData(const tinygltf::Model &model, int animIndex, const Assets::Skin &skin)
Loads animation data from a glTF model.
tinygltf::Model loadAsync(const std::filesystem::path &path) const
Loads a glTF model while skipping image payload loading.
~GltfLoader()
Waits for queued work on the supplied thread pool before destruction.
Runtime-owned Vulkan texture resource.
Definition Texture.h:33
Skeleton definition loaded from glTF skin data.
Definition SkinAsset.h:30
Wrapper for texture data.
Coordinates engine asset loading pipelines and runtime texture descriptor ownership.
Engine::Core::MaterialData MaterialData
Alias for the unified material data type.
PipelineNames
Named graphics pipelines used by material selection and shader lookup.
const tinygltf::Buffer & buffer
Buffer referenced by bufferView.buffer.
Definition GltfLoader.h:85
GltfBufferDataView(const std::vector< tinygltf::Buffer > &buffers, const std::vector< tinygltf::BufferView > &bufferViews, const tinygltf::Accessor &accessor)
Resolves an accessor to its buffer view, buffer, and raw data pointer.
const tinygltf::Accessor & accessor
Accessor that describes the element count, type, and component type.
Definition GltfLoader.h:75
const tinygltf::BufferView & bufferView
Buffer view referenced by accessor.bufferView.
Definition GltfLoader.h:80
const float * data
Raw pointer to the first accessor byte, interpreted as float data by callers.
Definition GltfLoader.h:90
Material data extracted from a glTF material and engine extensions.
Definition GltfLoader.h:832
float getMetallicFactor() const
Gets the glTF metallic factor.
Definition GltfLoader.h:940
glm::vec3 getEmissiveFactor() const
Gets the emissive factor.
Definition GltfLoader.h:958
bool hasVulkanSchneeExtension() const
Checks whether the material has a Vulkan Schnee material extension.
void parsePbrData(const tinygltf::Model &model, const tinygltf::Material &material)
const Materials::MaterialData & getMaterialData() const
Gets immutable engine material data generated from glTF and extension data.
Definition GltfLoader.h:886
GltfMaterialData()=default
Creates default material data with no parsed source material.
uint32_t getNormalTextureIndex() const
Gets the engine normal texture index.
Definition GltfLoader.h:904
bool hasTexture() const
Checks whether the material references a base color texture.
GltfMaterialData(const tinygltf::Model &model, const tinygltf::Material &material, const StaticMeshExtensions &meshSettings)
Parses material data from glTF and engine extension metadata.
int32_t getGltfMetallicRoughnessTextureIndex() const
Gets the original glTF metallic-roughness texture index.
bool hasEmissiveTexture() const
Checks whether the glTF material references an emissive texture.
Definition GltfLoader.h:985
bool hasNormalTexture() const
Checks whether the glTF material references a normal texture.
Definition GltfLoader.h:967
uint32_t getTextureIndex() const
Gets the engine texture index for the base color texture.
const VulkanSchneeMaterialExtension & getVulkanSchneeExtension() const
Gets the parsed Vulkan Schnee material extension.
const std::filesystem::path & getLightmapPath() const
Gets the lightmap texture path from the engine extension.
int32_t getGltfNormalTextureIndex() const
Gets the original glTF normal texture index.
Definition GltfLoader.h:994
int32_t getGltfEmissiveTextureIndex() const
Gets the original glTF emissive texture index.
float getRoughnessFactor() const
Gets the glTF roughness factor.
Definition GltfLoader.h:931
uint32_t getEmissiveTextureIndex() const
Gets the engine emissive texture index.
Definition GltfLoader.h:922
std::optional< MaterialExtensions > materialExtensions
float getNormalScale() const
Gets the normal map scale.
Definition GltfLoader.h:949
uint32_t getRoughnessMetallicTextureIndex() const
Gets the engine metallic-roughness texture index.
Definition GltfLoader.h:913
bool hasMetallicRoughnessTexture() const
Checks whether the glTF material references a metallic-roughness texture.
Definition GltfLoader.h:976
Materials::MaterialData & getMaterialDataRef()
Gets mutable engine material data generated from glTF and extension data.
Definition GltfLoader.h:895
bool hasLightmapTexture() const
Checks whether this material uses a lightmap texture path.
std::string getShaderName() const
Gets the shader name selected for this material.
std::vector< GltfMeshPrimitiveData > getPrimitives() const
Gets a copy of parsed primitives.
std::string getName() const
Gets the mesh node name.
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)
Parses one mesh node into engine primitive data.
std::vector< GltfMeshPrimitiveData > & getPrimitivesRef()
Gets mutable parsed primitives.
std::vector< GltfMeshPrimitiveData > primitives
glm::mat4 getTransform() const
Gets the imported model transform for the mesh node.
int getSkinIndex() const
Gets the glTF skin index referenced by the mesh node.
GltfMaterialData getMaterialData() const
Gets material data parsed for this primitive.
const std::vector< BoneVertexData > & getBoneVertexData() const
Gets per-vertex bone weights and joint indices.
GltfMeshPrimitiveData()=default
Creates empty primitive data.
bool hasSkinData() const
Checks whether this primitive has skinning data.
uint32_t getColorTextureIndex() const
Gets the glTF color texture index referenced by this primitive.
std::vector< Vertex > getVertices() const
Gets the vertices parsed for this primitive.
RuntimeTexture * getColorTexturePtr() const
Gets the pointer to the primitive of the color texture.
GltfMeshPrimitiveData(tinygltf::Model model, tinygltf::Primitive primitive, StaticMeshExtensions meshSettings)
Extracts primitive geometry and material data from tinygltf objects.
std::vector< BoneVertexData > boneVertexData
Empty for static meshes.
std::vector< uint32_t > getIndices() const
Gets local primitive indices.
GltfTextureData()=default
Creates an empty texture payload.
bool hasTextureData() const
Checks whether an image payload is stored.
GltfTextureData(const tinygltf::Image &image)
Stores an image payload from tinygltf.
Definition GltfLoader.h:184
tinygltf::Image getImage() const
Gets the stored tinygltf image.
Definition GltfLoader.h:190
Resolved vertex attribute and index views for a glTF primitive.
Definition GltfLoader.h:97
std::optional< GltfBufferDataView > uvDataView
TEXCOORD_0 attribute view when present.
Definition GltfLoader.h:132
std::optional< GltfBufferDataView > positionDataView
POSITION attribute view when present.
Definition GltfLoader.h:115
std::optional< GltfBufferDataView > normalDataView
NORMAL attribute view when present.
Definition GltfLoader.h:120
std::optional< GltfBufferDataView > indexDataView
Primitive index accessor view.
Definition GltfLoader.h:142
GltfVertexData(const std::vector< tinygltf::Buffer > &buffers, const std::vector< tinygltf::BufferView > &bufferViews, const std::vector< tinygltf::Accessor > &accessors, const tinygltf::Primitive &primitive)
Extracts known attribute views from a primitive.
std::optional< GltfBufferDataView > jointsDataView
JOINTS_0 attribute view when present.
Definition GltfLoader.h:147
std::optional< GltfBufferDataView > tangentDataView
TANGENT attribute view when present. The xyz values store tangent direction and w stores handedness.
Definition GltfLoader.h:127
std::optional< GltfBufferDataView > lightmapDataView
TEXCOORD_1 attribute view when present.
Definition GltfLoader.h:137
std::optional< GltfBufferDataView > weightsDataView
WEIGHTS_0 attribute view when present.
Definition GltfLoader.h:152
MaterialExtensions()=default
Creates an empty material extension bundle.
std::optional< VulkanSchneeMaterialExtension > vulkanSchneeMaterialExtension
Parsed Vulkan Schnee material extension when present.
Definition GltfLoader.h:793
MaterialExtensions(const tinygltf::ExtensionMap &material)
Parses material-level glTF extensions recognized by the engine.
Parsed extension bundle for one mesh or node.
Definition GltfLoader.h:800
StaticMeshExtensions(const tinygltf::Model &model, const tinygltf::ExtensionMap &extensions)
Parses mesh or node extensions with access to model-dependent data.
StaticMeshExtensions(const tinygltf::ExtensionMap &extensions)
Parses mesh or node extensions without model-dependent data.
StaticMeshExtensions()=default
Creates an empty static mesh extension bundle.
std::optional< VulkanSchneeExtension > vulkanSchneeExtension
Parsed Vulkan Schnee engine extension when present.
Definition GltfLoader.h:822
StaticMeshSettings(const tinygltf::Value &extras)
Parses lightmap settings from a tinygltf extras object.
StaticMeshSettings()=default
Creates settings with lightmaps disabled.
std::filesystem::path lightMapPath
Path to the baked lightmap texture.
Definition GltfLoader.h:229
bool bUsesLightMaps
True when the mesh uses baked lightmaps.
Definition GltfLoader.h:224
int lightMapUvIndex
UV channel index used for lightmap sampling.
Definition GltfLoader.h:234
Syntax-level reference from an owning mesh node to an AnchorPoint node.
Definition GltfLoader.h:250
uint32_t nodeIndex
Referenced entry in the source glTF node array.
Definition GltfLoader.h:252
std::string name
Authored empty-node name used for runtime lookup.
Definition GltfLoader.h:251
std::vector< uint32_t > edgeIndices
Child edge indices used by collision visualization and hull tooling.
Definition GltfLoader.h:499
glm::vec3 offset
Child local offset relative to the parent collision shape.
Definition GltfLoader.h:504
std::vector< glm::vec3 > vertices
Child collision vertices in child-local space after imported transforms are applied.
Definition GltfLoader.h:489
glm::quat rotation
Child local rotation relative to the parent collision shape.
Definition GltfLoader.h:509
std::string collisionProfile
Named collision response profile imported from the authoring tool.
Definition GltfLoader.h:436
ShapeType
Collision shape type imported from the engine glTF extension.
Definition GltfLoader.h:391
@ TRIANGLE_MESH
Triangle mesh built from imported vertices and indices.
Definition GltfLoader.h:403
CollisionProperties()=default
Creates collision settings with collision disabled.
std::vector< uint32_t > indices
Triangle indices for triangle mesh collision.
Definition GltfLoader.h:473
bool hasCollision() const
Checks whether this record describes a collision shape.
Definition GltfLoader.h:521
bool generateConvexHull
True when runtime collision generation should build a convex hull.
Definition GltfLoader.h:431
glm::vec3 offset
Local collision shape offset in node space.
Definition GltfLoader.h:441
CollisionProperties(const tinygltf::Value &extension, const tinygltf::Model *model=nullptr)
Parses collisionProperties from the engine extension.
std::vector< CompoundChild > compoundChildren
Compound collision children.
Definition GltfLoader.h:515
std::vector< glm::vec3 > vertices
Collision vertices for convex hull and triangle mesh shapes.
Definition GltfLoader.h:468
glm::vec3 direction
Direction vector in glTF node space or exported world space, depending on authoring data.
Definition GltfLoader.h:581
float angularDiameterDegrees
Angular diameter used for sun disk and soft shadow calculations.
Definition GltfLoader.h:606
DirectionalLightProperties(const tinygltf::Value &extension)
Parses directional light settings from directionalLightProperties.
bool hasDirection
True when the extension supplied a non-zero direction vector.
Definition GltfLoader.h:601
bool isLightmapPathValid() const
Checks whether either lightmap path is present.
std::filesystem::path lightmapPath
Authored lightmap image path, usually relative to the glTF file.
Definition GltfLoader.h:317
LightmapProperties(const tinygltf::Value &extension)
Parses a lightmapProperties object.
std::filesystem::path lightmapKtxPath
Runtime KTX lightmap path when the export converted the source image.
Definition GltfLoader.h:322
const std::filesystem::path & getRuntimeLightmapPath() const
Gets the texture path used at runtime.
bool getReceiveShadows() const
Checks whether the object receives shadows.
bool getCastShadows() const
Checks whether the object casts shadows.
bool getHasLightmaps() const
Checks whether the object uses baked lightmaps.
LightProperties(const tinygltf::Value &extension)
Parses lightingProperties from the parent engine extension object.
bool collisionEnabled
True when authored collision should be enabled on the spawned mesh actor.
Definition GltfLoader.h:289
bool isStatic
True when the object is authored as static.
Definition GltfLoader.h:284
MeshProperties(const tinygltf::Value &extension)
Parses meshProperties from the parent engine extension object.
PointLightProperties(const tinygltf::Value &extension)
Parses point light settings from pointLightProperties.
Legacy object metadata imported from older exporter output.
Definition GltfLoader.h:372
std::string blenderObjectName
Blender object name stored by legacy metadata paths.
Definition GltfLoader.h:376
VulkanSchneeExtension(const tinygltf::Value &vs_extension, const tinygltf::Model *model=nullptr)
Parses the engine extension object.
VulkanSchneeExtension()=default
Creates an empty extension record.
std::optional< LightProperties > lightProperties
Parsed object lighting flags when lightingProperties is present.
Definition GltfLoader.h:612
bool hasPointLightProperties() const
Checks whether point light settings were parsed.
std::optional< DirectionalLightProperties > directionalLightProperties
Parsed directional light settings when directionalLightProperties is present.
Definition GltfLoader.h:637
bool hasCollisionProperties() const
Checks whether collision settings were parsed.
static std::string extractVersion(const tinygltf::Value &vs_extension)
Extracts the version from the material extension.
bool hasAnchorPoints() const
Checks whether valid AnchorPoint references were parsed.
std::vector< AnchorPointReference > anchorPoints
Valid AnchorPoint references parsed from the extension.
Definition GltfLoader.h:639
std::optional< PointLightProperties > pointLightProperties
Parsed point light settings when pointLightProperties is present.
Definition GltfLoader.h:632
bool hasLightProperties() const
Checks whether object lighting flags were parsed.
bool hasMeshProperties() const
Checks whether mesh behavior flags were parsed.
bool hasLightmapProperties() const
Checks whether lightmap settings were parsed.
std::optional< MeshProperties > meshProperties
Parsed mesh behavior flags when meshProperties is present.
Definition GltfLoader.h:617
std::optional< LightProperties::LightmapProperties > lightmapProperties
Parsed lightmap settings when lightmapProperties is present.
Definition GltfLoader.h:622
std::optional< CollisionProperties > collisionProperties
Parsed collision settings when collisionProperties is present.
Definition GltfLoader.h:627
bool hasDirectionalLightProperties() const
Checks whether directional light settings were parsed.
std::string type
Parameter source type, usually connected or value.
Definition GltfLoader.h:730
ShaderParameter(const tinygltf::Value &param)
Parses one shader parameter object.
std::string socketType
Blender socket type string for the parameter.
Definition GltfLoader.h:735
tinygltf::Value value
Direct parameter value when type is value.
Definition GltfLoader.h:740
Parsed VULKAN_SCHNEE_materials material extension data.
Definition GltfLoader.h:704
std::map< std::string, tinygltf::Value > customProperties
Custom material properties preserved as tinygltf values.
Definition GltfLoader.h:766
VulkanSchneeMaterialExtension()=default
Creates an empty material extension record.
VulkanSchneeMaterialExtension(const tinygltf::Value &vs_extension)
Parses a VULKAN_SCHNEE_materials extension object.
std::string shaderType
Shader type string exported by the Blender material node.
Definition GltfLoader.h:746
bool normalMapBC5
True when the normal map texture uses BC5 two-channel encoding.
Definition GltfLoader.h:771
std::map< std::string, ShaderParameter > shaderParameters
Shader socket parameters keyed by exported socket name.
Definition GltfLoader.h:756
Rendering::PipelineNames materialName
Renderer pipeline name resolved from shaderType.
Definition GltfLoader.h:751
std::map< std::string, double > nodeProperties
Numeric node properties keyed by exported property name.
Definition GltfLoader.h:761
CPU geometry for one mesh primitive before renderer upload.
Definition EcsData.h:317