载入中...
搜索中...
未找到
Texture.cpp
浏览该文件的文档.
1#include "graphics/Texture.h"
2
3#include "graphics/Graphics.h"
4
5#include <cmath>
6#include <glm/glm.hpp>
7
8namespace eve::graphics {
9
10Texture::Texture() = default;
11
13 // GPU lifetime is owned by Graphics backend for now (tracked until Graphics destroy).
14 gpuHandle = nullptr;
15}
16
17void Texture::draw(Graphics *, const glm::mat4 &) const {
18 // Declarative path uses RenderSystem; immediate draw left for later.
19}
20
21void Texture::drawOcclusion(Graphics *gfx, const glm::mat4 &matrix) const {
22 if (!gfx || !getCastOcclusion()) return;
23 // Treat matrix as 2D affine: translation in column 3, scale from basis lengths.
24 const float x = matrix[3][0];
25 const float y = matrix[3][1];
26 const float w = std::sqrt(matrix[0][0] * matrix[0][0] + matrix[0][1] * matrix[0][1]);
27 const float h = std::sqrt(matrix[1][0] * matrix[1][0] + matrix[1][1] * matrix[1][1]);
28 if (w <= 0.f || h <= 0.f) return;
29 gfx->drawOcclusionTexture(const_cast<Texture *>(this), x, y, w, h);
30}
31
32} // namespace eve::graphics
int y
Definition Grass.cpp:135
int x
Definition Grass.cpp:135
int h
int w
bool getCastOcclusion() const
When false, skipped by Graphics::drawOcclusion / volumetric occluder passes.
Definition Drawable.h:27
virtual void drawOcclusionTexture(Texture *texture, float x, float y, float w, float h)
Definition Graphics.cpp:860
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:17
void draw(Graphics *gfx, const glm::mat4 &matrix) const override
Draws the object with the specified transformation matrix.
Definition Texture.cpp:17
void drawOcclusion(Graphics *gfx, const glm::mat4 &matrix) const override
Black silhouette using texture alpha (volumetric occlusion map).
Definition Texture.cpp:21
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition AnimTrail.h:6