Overte C++ Documentation
TextureMeta.h
1 //
2 // TextureMeta.h
3 // libraries/shared/src
4 //
5 // Created by Ryan Huffman on 04/10/18.
6 // Copyright 2018 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_TextureMeta_h
13 #define hifi_TextureMeta_h
14 
15 #include <type_traits>
16 #include <unordered_map>
17 #include <QUrl>
18 
19 #include "khronos/KHR.h"
20 
21 extern const QString TEXTURE_META_EXTENSION;
22 extern const uint16_t KTX_VERSION;
23 
24 template<>
25 struct std::hash<khronos::gl::texture::InternalFormat> {
26  using enum_type = std::underlying_type<khronos::gl::texture::InternalFormat>::type;
27  typedef std::size_t result_type;
28  result_type operator()(khronos::gl::texture::InternalFormat const& v) const noexcept {
29  return std::hash<enum_type>()(static_cast<enum_type>(v));
30  }
31 };
32 
33 struct TextureMeta {
34  static bool deserialize(const QByteArray& data, TextureMeta* meta);
35  QByteArray serialize();
36 
37  QUrl original;
38  QUrl uncompressed;
39  std::unordered_map<khronos::gl::texture::InternalFormat, QUrl> availableTextureTypes;
40  uint16_t version { 0 };
41 };
42 
43 
44 #endif // hifi_TextureMeta_h