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 namespace std {
25  template<> struct 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 
34 struct TextureMeta {
35  static bool deserialize(const QByteArray& data, TextureMeta* meta);
36  QByteArray serialize();
37 
38  QUrl original;
39  QUrl uncompressed;
40  std::unordered_map<khronos::gl::texture::InternalFormat, QUrl> availableTextureTypes;
41  uint16_t version { 0 };
42 };
43 
44 
45 #endif // hifi_TextureMeta_h