}
case gltf2::Attribute::JOINTS_N:
{
- meshDefinition.mJoints.emplace_back(MeshDefinition::Accessor{});
- accessorDest = &meshDefinition.mJoints.back();
+ if(meshDefinition.mJoints.size() < MeshDefinition::MAX_NUMBER_OF_JOINT_SETS)
+ {
+ meshDefinition.mJoints.emplace_back(MeshDefinition::Accessor{});
+ accessorDest = &meshDefinition.mJoints.back();
+ }
break;
}
case gltf2::Attribute::WEIGHTS_N:
{
- meshDefinition.mWeights.emplace_back(MeshDefinition::Accessor{});
- accessorDest = &meshDefinition.mWeights.back();
+ if(meshDefinition.mWeights.size() < MeshDefinition::MAX_NUMBER_OF_JOINT_SETS)
+ {
+ meshDefinition.mWeights.emplace_back(MeshDefinition::Accessor{});
+ accessorDest = &meshDefinition.mWeights.back();
+ }
break;
}
case gltf2::Attribute::INVALID:
uint32_t MeshDefinition::GetNumberOfJointSets() const
{
- return static_cast<uint32_t>(mJoints.size());
+ uint32_t number = static_cast<uint32_t>(mJoints.size());
+ if(number > MeshDefinition::MAX_NUMBER_OF_JOINT_SETS)
+ {
+ number = MeshDefinition::MAX_NUMBER_OF_JOINT_SETS;
+ }
+ return number;
}
bool MeshDefinition::HasBlendShapes() const
INVALID = std::numeric_limits<uint32_t>::max()
};
+ enum : uint32_t
+ {
+ MAX_NUMBER_OF_JOINT_SETS = 4
+ };
+
enum Flags : uint32_t
{
FLIP_UVS_VERTICAL = NthBit(0),
/**
* @brief Returns the number of joint sets defined by the mesh
+ *
+ * @note Clamped to 4 to minimise GPU attrs.
*/
uint32_t GetNumberOfJointSets() const;