3#include "Services/PropertiesManager.h"
5#include "ResourceBase.h"
9#include "Foundation/Geometry/BoundingBox.hpp"
15 const size_t NoParentPart = uint32_t(-1);
16 const uint32_t NoIndex = uint32_t(-1);
18 const glm::mat4 ModelPartIdentity = glm::mat4(1.0f);
26 uint32_t parentIndex = NoParentPart;
27 uint32_t boundsIndex = NoIndex;
28 uint32_t meshIndex = NoIndex;
29 uint32_t materialIndex = NoIndex;
31 uint32_t startIndex = 0;
32 uint32_t vertexCount =
static_cast<uint32_t
>(-1);
34 uint32_t nameIndex = NoIndex;
35 uint32_t transformIndex = NoIndex;
37 uint32_t firstProperty = 0;
38 uint32_t numProperties = 0;
40 uint32_t primitiveType =
static_cast<uint32_t
>(-1);
71 part.nameIndex = properties.addProperty(
"n", name);
76 if (part.nameIndex == NoIndex)
return {};
77 return properties.getString(part.nameIndex);
80 void setPartTransform(ModelPart & part,
const glm::mat4 & t)
83 auto values = std::span(glm::value_ptr(tt), 16);
84 part.transformIndex = properties.addProperty(
"t", values);
87 const glm::mat4 & getPartTransform(
const ModelPart & part)
const
89 if (part.transformIndex != NoIndex) {
90 auto values = properties.getFloatArray(part.transformIndex);
91 return *
reinterpret_cast<const glm::mat4 *
>(values.data());
94 return ModelPartIdentity;
97 std::vector<MeshHandle> meshes;
98 std::vector<MaterialInstanceHandle> materials;
100 std::vector<Geometry::BoundingBox> bounds;
101 std::vector<ModelPart> parts;
103 PropertyStore properties;
110 AnimationHandle animation;
Provides a weakly referenced view over the contents of a string.
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
Model resources define a template for a set of connected entities, with resources such as meshes,...
Model & operator=(Model &&other) noexcept=default
Move assign a Model from other.
Model(Model &&other) noexcept=default
Move construct a Model from other.
Model(const Model &other)=delete
Disabled copy construction.
Model()=default
Default constructs a Model resource.
Base class for engine resources.