Lugdunum  0.1.0
Sampler.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 
6 
7 namespace lug {
8 namespace Graphics {
9 namespace Vulkan {
10 namespace API {
11 
12 class Device;
13 
14 namespace Builder {
15 
16 class Sampler {
17 public:
18  Sampler(const API::Device& device);
19 
20  Sampler(const Sampler&) = delete;
21  Sampler(Sampler&&) = delete;
22 
23  Sampler& operator=(const Sampler&) = delete;
24  Sampler& operator=(Sampler&&) = delete;
25 
26  ~Sampler() = default;
27 
28  // Setters
29  void setMagFilter(VkFilter magFilter);
30  void setMinFilter(VkFilter minFilter);
31  void setMipmapMode(VkSamplerMipmapMode mipmapMode);
32  void setAddressModeU(VkSamplerAddressMode addressModeU);
33  void setAddressModeV(VkSamplerAddressMode addressModeV);
34  void setAddressModeW(VkSamplerAddressMode addressModeW);
35  void setMipLodBias(float mipLodBias);
36  void enableAnisotropy(float maxAnisotropy);
37  void disableAnisotropy();
38  void setCompareOp(VkCompareOp compareOp);
39  void setMinLod(float minLod);
40  void setMaxLod(float maxLod);
41  void setBorderColor(VkBorderColor borderColor);
42  void setUnnormalizedCoordinates(VkBool32 unnormalizedCoordinates);
43 
44  // Build methods
45  bool build(API::Sampler& instance, VkResult* returnResult = nullptr);
46  std::unique_ptr<API::Sampler> build(VkResult* returnResult = nullptr);
47 
48 private:
50 
51  VkFilter _magFilter{VK_FILTER_LINEAR};
52  VkFilter _minFilter{VK_FILTER_LINEAR};
53  VkSamplerMipmapMode _mipmapMode{VK_SAMPLER_MIPMAP_MODE_LINEAR};
54  VkSamplerAddressMode _addressModeU{VK_SAMPLER_ADDRESS_MODE_REPEAT};
55  VkSamplerAddressMode _addressModeV{VK_SAMPLER_ADDRESS_MODE_REPEAT};
56  VkSamplerAddressMode _addressModeW{VK_SAMPLER_ADDRESS_MODE_REPEAT};
57  float _mipLodBias{0.0f};
58  VkBool32 _anisotropyEnable{VK_FALSE};
59  float _maxAnisotropy{1.0f};
60  VkBool32 _compareEnable{VK_FALSE};
61  VkCompareOp _compareOp{VK_COMPARE_OP_NEVER};
62  float _minLod{0.0f};
63  float _maxLod{1.0f};
64  VkBorderColor _borderColor{VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE};
65  VkBool32 _unnormalizedCoordinates{VK_FALSE};
66 };
67 
69 
70 } // Builder
71 } // API
72 } // Vulkan
73 } // Graphics
74 } // lug
void setMipmapMode(VkSamplerMipmapMode mipmapMode)
Definition: Sampler.inl:9
bool build(API::Sampler &instance, VkResult *returnResult=nullptr)
Definition: Sampler.cpp:13
void setAddressModeU(VkSamplerAddressMode addressModeU)
Definition: Sampler.inl:13
Sampler & operator=(const Sampler &)=delete
void setMagFilter(VkFilter magFilter)
Definition: Sampler.inl:1
void setCompareOp(VkCompareOp compareOp)
Definition: Sampler.inl:39
void setAddressModeW(VkSamplerAddressMode addressModeW)
Definition: Sampler.inl:21
void setAddressModeV(VkSamplerAddressMode addressModeV)
Definition: Sampler.inl:17
void enableAnisotropy(float maxAnisotropy)
Definition: Sampler.inl:29
Sampler(const API::Device &device)
Definition: Sampler.cpp:11
void setMinFilter(VkFilter minFilter)
Definition: Sampler.inl:5
void setUnnormalizedCoordinates(VkBool32 unnormalizedCoordinates)
Definition: Sampler.inl:55
void setBorderColor(VkBorderColor borderColor)
Definition: Sampler.inl:51