summaryrefslogtreecommitdiffstats
path: root/AssetLoader/interface
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-03 19:34:23 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-03 19:34:23 +0000
commitdca98748aa1c1ef04f8ed50492f8b780354ccdb9 (patch)
treeaa61bf4b1ab55ddbd778da93b8b857c738ab8c4f /AssetLoader/interface
parentGLTF Loader: using dynamic array of joint transform matrices instead of the f... (diff)
downloadDiligentTools-dca98748aa1c1ef04f8ed50492f8b780354ccdb9.tar.gz
DiligentTools-dca98748aa1c1ef04f8ed50492f8b780354ccdb9.zip
GLTF Loader: updated primitives handling
Diffstat (limited to 'AssetLoader/interface')
-rw-r--r--AssetLoader/interface/GLTFLoader.hpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/AssetLoader/interface/GLTFLoader.hpp b/AssetLoader/interface/GLTFLoader.hpp
index a9858e8..e86dec7 100644
--- a/AssetLoader/interface/GLTFLoader.hpp
+++ b/AssetLoader/interface/GLTFLoader.hpp
@@ -145,32 +145,32 @@ struct Material
struct Primitive
{
- Uint32 FirstIndex = 0;
- Uint32 IndexCount = 0;
- Uint32 VertexCount = 0;
- Material& material;
- bool hasIndices;
-
- BoundBox BB;
- bool IsValidBB = false;
-
- Primitive(Uint32 _FirstIndex,
- Uint32 _IndexCount,
- Uint32 _VertexCount,
- Material& _material) :
+ const Uint32 FirstIndex;
+ const Uint32 IndexCount;
+ const Uint32 VertexCount;
+ const Uint32 MaterialId;
+
+ const BoundBox BB;
+
+ Primitive(Uint32 _FirstIndex,
+ Uint32 _IndexCount,
+ Uint32 _VertexCount,
+ Uint32 _MaterialId,
+ const float3& BBMin,
+ const float3& BBMax) :
FirstIndex{_FirstIndex},
IndexCount{_IndexCount},
VertexCount{_VertexCount},
- material{_material},
- hasIndices{_IndexCount > 0}
+ MaterialId{_MaterialId},
+ BB{BBMin, BBMax}
{
}
- void SetBoundingBox(const float3& min, const float3& max)
+ Primitive(Primitive&&) = default;
+
+ bool HasIndices() const
{
- BB.Min = min;
- BB.Max = max;
- IsValidBB = true;
+ return IndexCount > 0;
}
};
@@ -178,7 +178,7 @@ struct Primitive
struct Mesh
{
- std::vector<std::unique_ptr<Primitive>> Primitives;
+ std::vector<Primitive> Primitives;
BoundBox BB;
@@ -220,7 +220,7 @@ struct Node
Skin* _Skin = nullptr;
Int32 SkinIndex = -1;
float3 Translation;
- float3 Scale = float3(1.0f, 1.0f, 1.0f);
+ float3 Scale = float3{1, 1, 1};
Quaternion Rotation;
BoundBox BVH;
BoundBox AABB;