Skip to content

Commit

Permalink
Explicitly include DirectXPackedVector.h and add unsigned byte vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
spnda committed Nov 16, 2024
1 parent d820384 commit 49fab01
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions include/fastgltf/dxmath_element_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

#include <fastgltf/tools.hpp>

#if __has_include(<directxmath.h>)
#include <directxmath.h>
#if __has_include(<DirectXMath.h>)
#include <DirectXMath.h>
#endif

#if __has_include(<DirectXPackedVector.h>)
#include <DirectXPackedVector.h>
#endif

namespace fastgltf {
Expand All @@ -21,16 +25,22 @@ template <>
struct ElementTraits<DirectX::XMFLOAT4> : ElementTraitsBase<DirectX::XMFLOAT4, AccessorType::Vec4, float> {};

template<>
struct ElementTraits<DirectX::PackedVector::XMBYTE2> : ElementTraitsBase<DirectX::PackedVector::XMBYTE2, AccessorType::Vec2, std::uint8_t> {};
struct ElementTraits<DirectX::PackedVector::XMBYTE2> : ElementTraitsBase<DirectX::PackedVector::XMBYTE2, AccessorType::Vec2, std::int8_t> {};

template<>
struct ElementTraits<DirectX::PackedVector::XMBYTE4> : ElementTraitsBase<DirectX::PackedVector::XMBYTE4, AccessorType::Vec4, std::int8_t> {};

template<>
struct ElementTraits<DirectX::PackedVector::XMUBYTE2> : ElementTraitsBase<DirectX::PackedVector::XMUBYTE2, AccessorType::Vec2, std::uint8_t> {};

template<>
struct ElementTraits<DirectX::PackedVector::XMBYTE4> : ElementTraitsBase<DirectX::PackedVector::XMBYTE4, AccessorType::Vec4, std::uint8_t> {};
struct ElementTraits<DirectX::PackedVector::XMUBYTE4> : ElementTraitsBase<DirectX::PackedVector::XMUBYTE4, AccessorType::Vec4, std::uint8_t> {};

template<>
struct ElementTraits<DirectX::PackedVector::XMSHORT2> : ElementTraitsBase<DirectX::PackedVector::XMSHORT2, AccessorType::Vec2, std::uint16_t> {};
struct ElementTraits<DirectX::PackedVector::XMSHORT2> : ElementTraitsBase<DirectX::PackedVector::XMSHORT2, AccessorType::Vec2, std::int16_t> {};

template<>
struct ElementTraits<DirectX::PackedVector::XMSHORT4> : ElementTraitsBase<DirectX::PackedVector::XMSHORT4, AccessorType::Vec4, std::uint16_t> {};
struct ElementTraits<DirectX::PackedVector::XMSHORT4> : ElementTraitsBase<DirectX::PackedVector::XMSHORT4, AccessorType::Vec4, std::int16_t> {};

template<>
struct ElementTraits<DirectX::PackedVector::XMUSHORT2> : ElementTraitsBase<DirectX::PackedVector::XMUSHORT2, AccessorType::Vec2, std::uint16_t> {};
Expand Down

0 comments on commit 49fab01

Please sign in to comment.