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  TextureTable(size_t tableSize);
25  TextureTable(const std::initializer_list<TexturePointer>& textures, size_t tableSize);
26  TextureTable(const Vector& textures, size_t tableSize);
27 
28  // Only for gpu::Context
29  const GPUObjectPointer gpuObject{};
30 
31  void setTexture(size_t index, const TexturePointer& texturePointer);
32  void setTexture(size_t index, const TextureView& texturePointer);
33 
34  Vector getTextures() const;
35  Stamp getStamp() const { return _stamp; }
36 
37  void resize(size_t tableSize) { _textures.resize(tableSize); };
38 
39 private:
40  mutable Mutex _mutex;
41  Vector _textures;
42  Stamp _stamp{ 1 };
43 };
44 
45 }
46 
47 #endif