Overte C++ Documentation
TextureMap.h
1 //
2 // TextureMap.h
3 // libraries/graphics/src/graphics
4 //
5 // Created by Sam Gateau on 5/6/2015.
6 // Copyright 2014 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 #ifndef hifi_model_TextureMap_h
12 #define hifi_model_TextureMap_h
13 
14 #include "gpu/Texture.h"
15 
16 #include "Transform.h"
17 #include "MaterialMappingMode.h"
18 
19 namespace graphics {
20 
21 class TextureMap {
22 public:
23  TextureMap() {}
24 
25  void setTextureSource(gpu::TextureSourcePointer& textureSource);
26  gpu::TextureSourcePointer getTextureSource() const { return _textureSource; }
27 
28  bool isDefined() const;
29  gpu::TextureView getTextureView() const;
30 
31  void setTextureTransform(const Transform& texcoordTransform);
32  const Transform& getTextureTransform() const { return _texcoordTransform; }
33 
34  void setMappingMode(MaterialMappingMode mode) { _mappingMode = mode; }
35  MaterialMappingMode getMappingMode() const { return _mappingMode; }
36 
37  void setRepeat(bool repeat) { _repeat = repeat; }
38  bool getRepeat() const { return _repeat; }
39 
40  void setUseAlphaChannel(bool useAlpha) { _useAlphaChannel = useAlpha; }
41  bool useAlphaChannel() const { return _useAlphaChannel; }
42 
43  void setLightmapOffsetScale(float offset, float scale);
44  const glm::vec2& getLightmapOffsetScale() const { return _lightmapOffsetScale; }
45 
46 protected:
47  gpu::TextureSourcePointer _textureSource;
48 
49  Transform _texcoordTransform;
50  glm::vec2 _lightmapOffsetScale{ 0.0f, 1.0f };
51  MaterialMappingMode _mappingMode { MaterialMappingMode::UV };
52  bool _repeat { true };
53 
54  bool _useAlphaChannel{ false };
55 };
56 typedef std::shared_ptr< TextureMap > TextureMapPointer;
57 
58 };
59 
60 #endif // hifi_model_TextureMap_h
61