CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
GPUSampler.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Common.hpp"
11#include "Forward.hpp"
12
14
17
21
22#include <cstdint>
23#include <iosfwd>
24
25namespace CeresEngine {
26
31 Repeat,
32
34 Mirror,
35
37 Clamp,
38
41 Border,
42
46 };
47
51 Nearest,
52
54 Linear,
55
57 Cubic
58 };
59
66
71
76
79 GPUSamplerFilter minFilter = GPUSamplerFilter::Nearest;
80
83 GPUSamplerFilter magFilter = GPUSamplerFilter::Nearest;
84
87 GPUSamplerFilter mipMapFilter = GPUSamplerFilter::Nearest;
88
91 bool mipMapping = false;
92
96 float mipMapLODBias = 0.0f;
97
100 float minLOD = 0.0f;
101
105 float maxLOD = 1000.0f;
106
109 UInt32 maxAnisotropy = 1;
110
114 bool compareEnabled = false;
115
118 GPUCompareOp compareOp = GPUCompareOp::Less;
119
122 Vector4f borderColor = {0.0f, 0.0f, 0.0f, 0.0f};
123
127 String name;
128
129 public:
134 friend bool operator==(const GPUSamplerDescriptor& lhs, const GPUSamplerDescriptor& rhs);
135
140 friend bool operator!=(const GPUSamplerDescriptor& lhs, const GPUSamplerDescriptor& rhs);
141
145 friend String toString(const GPUSamplerDescriptor& descriptor);
146
151 friend std::ostream& operator<<(std::ostream& os, const GPUSamplerDescriptor& descriptor);
152
153 public: // Reflection
156 template<typename Processor> static constexpr void reflect(Processor&& RTTI) {
157 CE_REFL_DATA(addressModeU);
158 CE_REFL_DATA(addressModeV);
159 CE_REFL_DATA(addressModeW);
160 CE_REFL_DATA(minFilter);
161 CE_REFL_DATA(magFilter);
162 CE_REFL_DATA(mipMapFilter);
163 CE_REFL_DATA(mipMapping);
164 CE_REFL_DATA(mipMapLODBias);
165 CE_REFL_DATA(minLOD);
166 CE_REFL_DATA(maxLOD);
167 CE_REFL_DATA(maxAnisotropy);
168 CE_REFL_DATA(compareEnabled);
169 CE_REFL_DATA(compareOp);
170 CE_REFL_DATA(borderColor);
171 CE_REFL_DATA(name);
172 }
173 };
174
175 class CE_SCRIPT_EXPORT() GPUSampler : public TDeviceObject<GPUSamplerDescriptor> {
176 public:
178 using TDeviceObject::TDeviceObject;
179
181 GPUSampler(const GPUSampler&) = delete;
182 GPUSampler& operator=(const GPUSampler&) = delete;
183
187 };
188
193 std::ostream& operator<<(std::ostream& os, const GPUSamplerAddressMode& mode);
194
199 std::ostream& operator<<(std::ostream& os, const GPUSamplerFilter& filter);
200
201} // namespace CeresEngine
202
#define CE_REFLECT_HASH(T)
Definition Hash.hpp:89
#define CE_REFL_DATA(N)
Definition Macros.hpp:541
#define CE_SCRIPT_EXPORT(...)
The CE_SCRIPT_EXPORT macro marks a class or method as exportable and available in scripting environme...
Definition Macros.hpp:247
Definition GPUSampler.hpp:175
GPUSampler & operator=(const GPUSampler &)=delete
GPUSampler(GPUSampler &&)=delete
Deleted move constructor.
GPUSampler & operator=(GPUSampler &&)=delete
GPUSampler(const GPUSampler &)=delete
Deleted copy constructor.
Definition Common.hpp:62
Definition Application.hpp:19
constexpr Byte operator<<(const Byte arg, const _IntType shift) noexcept
Definition DataTypes.hpp:44
GPUSamplerAddressMode
Technique for resolving image coordinates that are outside of the range [0, 1].
Definition GPUSampler.hpp:29
@ Border
Sample border color for image coordinates that are outside the interval [0, 1].
@ Clamp
Clamp image coordinates to the interval [0, 1].
@ Mirror
Flip image coordinates at each integer junction.
@ Repeat
Repeat image coordinates within the interval [0, 1).
@ MirrorOnce
Takes the absolute value of the image coordinates and then clamps it to the interval [0,...
GPUCompareOp
Compare operations enumeration.
Definition GPUGraphicsPipeline.hpp:37
GPUSamplerFilter
Sampling filter enumeration.
Definition GPUSampler.hpp:49
@ Linear
Interpolate between multiple image samples.
@ Nearest
Take the nearest image sample.
@ Cubic
Interpolate between multiple image samples using cubic interpolation.
std::uint32_t UInt32
Definition DataTypes.hpp:23
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
auto filter(Container &container, Predicate &&predicate)
Returns an iterable object that iterates over the values of the container and applies transform to ev...
Definition Iterator.hpp:451
Definition Span.hpp:668
Image sampler descriptor structure.
Definition GPUSampler.hpp:61