+template<typename T>
+void ReadJointAccessor(MeshDefinition::RawData& raw, const MeshDefinition::Accessor& accessor, std::istream& source, const std::string& meshPath)
+{
+ constexpr auto sizeofBlobUnit = sizeof(T) * 4;
+
+ DALI_ASSERT_ALWAYS(((accessor.mBlob.mLength % sizeofBlobUnit == 0) ||
+ accessor.mBlob.mStride >= sizeofBlobUnit) &&
+ "Joints buffer length not a multiple of element size");
+ const auto inBufferSize = accessor.mBlob.GetBufferSize();
+ const auto outBufferSize = (sizeof(Vector4) / sizeofBlobUnit) * inBufferSize;
+
+ std::vector<uint8_t> buffer(outBufferSize);
+ auto inBuffer = buffer.data() + outBufferSize - inBufferSize;
+ if(!ReadAccessor(accessor, source, inBuffer))
+ {
+ ExceptionFlinger(ASSERT_LOCATION) << "Failed to read joints from '" << meshPath << "'.";
+ }
+
+ if constexpr(sizeofBlobUnit != sizeof(Vector4))
+ {
+ auto floats = reinterpret_cast<float*>(buffer.data());
+ const auto end = inBuffer + inBufferSize;
+ while(inBuffer != end)
+ {
+ const auto value = *reinterpret_cast<T*>(inBuffer);
+ *floats = static_cast<float>(value);
+
+ inBuffer += sizeof(T);
+ ++floats;
+ }
+ }
+ raw.mAttribs.push_back({"aJoints", Property::VECTOR4, static_cast<uint32_t>(outBufferSize / sizeof(Vector4)), std::move(buffer)});
+}
+