Overte C++ Documentation
TextureTable.h
1 //
2 // Created by Bradley Austin Davis on 2017/01/25
3 // Copyright 2013-2017 High Fidelity, Inc.
4 //
5 // Distributed under the Apache License, Version 2.0.
6 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7 //
8 #ifndef hifi_gpu_TextureTable_h
9 #define hifi_gpu_TextureTable_h
10 
11 #include "Forward.h"
12 
13 #include <vector>
14 
15 #define TEXTURE_TABLE_COUNT_1_LAYER_MATERIAL 8
16 #define TEXTURE_TABLE_COUNT_2_LAYER_MATERIAL 6
17 #define TEXTURE_TABLE_COUNT_3_LAYER_MATERIAL 4
18 
19 namespace gpu {
20 
21 class TextureTable {
22 public:
23  using Vector = std::vector<TexturePointer>;
24 
28  TextureTable(size_t tableSize);
29 
34  TextureTable(const std::initializer_list<TexturePointer>& textures, size_t tableSize);
35 
40  TextureTable(const Vector& textures, size_t tableSize);
41 
42  // Only for gpu::Context
43  const GPUObjectPointer gpuObject{};
44 
53  void setTexture(size_t index, const TexturePointer& texturePointer);
54 
63  void setTexture(size_t index, const TextureView& texturePointer);
64 
69  Vector getTextures() const;
70 
75  Stamp getStamp() const { return _stamp; }
76 
83  void resize(size_t tableSize) { _textures.resize(tableSize); };
84 
85 private:
86  mutable Mutex _mutex;
87  Vector _textures;
88  Stamp _stamp{ 1 };
89 };
90 
91 }
92 
93 #endif