载入中...
搜索中...
未找到
TextureSampler.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Export.h"
4
5namespace eve::graphics {
6
8enum class FilterMode {
10 Linear,
11};
12
14enum class MipmapMode {
16 Nearest,
17 Linear,
18};
19
28 bool repeatU = false;
29 bool repeatV = false;
30 bool repeatW = false;
32 float maxAnisotropy = 1.f;
33 float lodBias = 0.f;
34 float minLod = 0.f;
36 float maxLod = 1000.f;
37
39 bool operator==(const TextureSampler&) const = default;
40
46 s.mipmap = MipmapMode::Disabled;
47 return s;
48 }
49
55 s.mipmap = MipmapMode::Disabled;
56 return s;
57 }
58
64 s.mipmap = MipmapMode::Linear;
65 return s;
66 }
67
69 static TextureSampler anisotropic(float maxAniso = 16.f) {
71 s.maxAnisotropy = maxAniso;
72 return s;
73 }
74
89
96 static const char* filterName(FilterMode m) { return m == FilterMode::Nearest ? "nearest" : "linear"; }
97
104 static const char* mipmapName(MipmapMode m) {
105 switch (m) {
106 case MipmapMode::Disabled: return "none";
107 case MipmapMode::Nearest: return "nearest";
108 default: return "linear";
109 }
110 }
111};
112
119 bool generateMipmaps = false;
120
122 static TextureCreateInfo defaults() { return {}; }
123
125 static TextureCreateInfo withMipmaps(bool aniso = true, float maxAniso = 16.f) {
127 info.generateMipmaps = true;
128 info.sampler = aniso ? TextureSampler::anisotropic(maxAniso) : TextureSampler::linearMipmap();
129 return info;
130 }
131};
132
138
139} // namespace eve::graphics
double m[16]
const std::string & s
std::string name
Definition ECS.cpp:154
#define EVENGINE_API_BACKENDS
Definition Export.h:108
std::uint32_t height
std::uint32_t width
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
FilterMode
Mag/min filter for texture sampling.
int mipmapCountForSize(int width, int height)
Full mip chain count for a 2D image (including base level). @cost O(1); uses integer log2 of the larg...
MipmapMode
Mipmap filter; Disabled turns off mip sampling (maxLod clamped to 0).
Options for Graphics::newTexture / newCubemap. When generateMipmaps is true and sampler....
static TextureCreateInfo defaults()
Defaults.
static TextureCreateInfo withMipmaps(bool aniso=true, float maxAniso=16.f)
With mipmaps.
Sampler state for a Texture (filter, wrap, mip LOD, anisotropy). Defaults match historical engine beh...
static TextureSampler anisotropic(float maxAniso=16.f)
Trilinear + anisotropic filtering (capped by device limits at bind time).
static TextureSampler nearest()
Nearest.
bool operator==(const TextureSampler &) const =default
Compare requested state without creating a backend sampler.
static TextureSampler linear()
Linear.
static const char * mipmapName(MipmapMode m)
Stable mipmap-mode spelling for logs and script bindings.
float maxAnisotropy
1 = off; values >1 enable anisotropic filtering when the device supports it.
static const char * filterName(FilterMode m)
Stable filter spelling for logs and script bindings.
static TextureSampler linearMipmap()
Trilinear (linear + linear mips). Caller should create the texture with generateMipmaps.
static EVENGINE_API_BACKENDS MipmapMode parseMipmap(const char *name)
Parse a mipmap name (none / nearest / linear, case-insensitive).
static EVENGINE_API_BACKENDS FilterMode parseFilter(const char *name)
Parse a filter name (nearest / linear, case-insensitive).
float maxLod
Inclusive upper LOD clamp. Large values mean "use all available mips".
glm::uvec4 info