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 <array>
14 
15 #define TEXTURE_TABLE_COUNT 8
16 
17 namespace gpu {
18 
19 class TextureTable {
20 public:
21  static const size_t COUNT;
22  using Array = std::array<TexturePointer, TEXTURE_TABLE_COUNT>;
23  TextureTable();
24  TextureTable(const std::initializer_list<TexturePointer>& textures);
25  TextureTable(const Array& textures);
26 
27  // Only for gpu::Context
28  const GPUObjectPointer gpuObject{};
29 
30  void setTexture(size_t index, const TexturePointer& texturePointer);
31  void setTexture(size_t index, const TextureView& texturePointer);
32 
33  Array getTextures() const;
34  Stamp getStamp() const { return _stamp; }
35 
36 private:
37  mutable Mutex _mutex;
38  Array _textures;
39  Stamp _stamp{ 1 };
40 };
41 
42 }
43 
44 #endif