载入中...
搜索中...
未找到
Texture.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include <cstdint>
6#include <string>
7#include "graphics/Drawable.h"
9
10namespace eve::graphics {
11
12class Graphics;
13
19public:
23 ~Texture() override;
24
26 void draw(Graphics *gfx, const glm::mat4 &matrix) const override;
28 void drawOcclusion(Graphics *gfx, const glm::mat4 &matrix) const override;
29
31 int getWidth() const;
33 int getHeight() const;
35 int getPixelWidth() const;
37 int getPixelHeight() const;
39 int getMipmapCount() const;
41 const TextureSampler &getSampler() const { return sampler; }
43 void setAlphaConvention(const std::string &value) {
44 premultipliedAlpha_ = value == "premultiplied";
45 }
47 std::string getAlphaConvention() const {
48 return premultipliedAlpha_ ? "premultiplied" : "straight";
49 }
51 bool hasPremultipliedAlpha() const { return premultipliedAlpha_; }
52
54 void *gpuHandle = nullptr;
55
56 int width = 0;
57 int height = 0;
58 int depth = 1;
59 int layers = 1;
60 int mipmapCount = 1;
61 int pixelWidth = 0;
62 int pixelHeight = 0;
64
66 void markDeferredFilePixels(Graphics *graphics);
68 void clearDeferredFilePixels();
70 bool hasDeferredFilePixels() const { return filePixelsPending_; }
71
72private:
73 void realizeFilePixelsIfNeeded() const;
74 Graphics *graphics_ = nullptr;
75 bool filePixelsPending_ = false;
76 bool premultipliedAlpha_ = false;
77};
78
79} // namespace eve::graphics
double value
#define EVENGINE_API_BACKENDS
Definition Export.h:108
vk::UniqueSampler sampler
std::uint32_t height
std::uint32_t width
MeshVfxBatchedDraw draw
std::uint32_t depth
Drawable base (textures, meshes, canvases).
Definition Drawable.h:17
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:18
bool hasDeferredFilePixels() const
True when deferred file pixels.
Definition Texture.h:70
const TextureSampler & getSampler() const
Returns the sampler.
Definition Texture.h:41
bool hasPremultipliedAlpha() const
True when premultiplied alpha.
Definition Texture.h:51
std::string getAlphaConvention() const
Returns the alpha convention.
Definition Texture.h:47
void setAlphaConvention(const std::string &value)
Declare whether RGB is straight or already multiplied by alpha.
Definition Texture.h:43
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
Sampler state for a Texture (filter, wrap, mip LOD, anisotropy). Defaults match historical engine beh...