载入中...
搜索中...
未找到
GlobalIllumination.h
浏览该文件的文档.
1#pragma once
2
3#include <string>
4#include <glm/mat4x4.hpp>
5#include <glm/vec3.hpp>
6
7namespace eve::graphics {
8
9class Canvas;
10class Graphics;
11class Shader;
12class Texture;
13
28public:
29 explicit GlobalIllumination(Graphics *gfx);
31
34
36 void setQuality(const std::string &quality);
37 std::string getQuality() const { return quality_; }
38
43 void setCamera(float eyeX, float eyeY, float eyeZ, float targetX, float targetY, float targetZ,
44 float upX, float upY, float upZ, float fovYDeg, float aspect, float nearZ,
45 float farZ);
46
47 void setInvViewProj(const glm::mat4 &invViewProj);
48
49 void setRadius(float radius);
50 void setIntensity(float intensity);
51 void setLightDirection(float dx, float dy, float dz);
52 void setLightColor(float r, float g, float b);
53
54 float getRadius() const { return radius_; }
55 float getIntensity() const { return intensity_; }
56
57 bool hasParam(const std::string &name) const;
58 void setFloat(const std::string &name, float value);
59 float getFloat(const std::string &name) const;
60
61 int getSampleCount() const;
62
68 void applyFromDepth(Graphics *gfx, Texture *packedAlbedo);
69 void applyFromDepthTo(Graphics *gfx, Texture *packedAlbedo, Canvas *dest);
70 void applyFromScene(Graphics *gfx, Texture *color, Texture *hwDepth);
71
72 Shader *getShader() const { return ssgi_; }
73
74private:
75 void applyQualityDefaults();
76 void uploadUniforms(int width, int height);
77 void drawFullscreen(Graphics *gfx, Texture *source, Shader *shader, Texture *hwDepth = nullptr);
78
79 Graphics *gfx_ = nullptr;
80 Shader *ssgi_ = nullptr;
81 std::string quality_ = "medium";
82 glm::mat4 invViewProj_{1.f};
83 float nearZ_ = 0.1f;
84 float farZ_ = 100.f;
85 float radius_ = 1.25f;
86 float intensity_ = 0.45f;
87 glm::vec3 lightDir_{0.4f, 1.f, 0.3f};
88 glm::vec3 lightColor_{1.f, 1.f, 1.f};
89};
90
91} // namespace eve::graphics
std::string value
float height
Definition Grass.cpp:235
uint32_t b
int width
Shader * shader
const char * name
Definition RockMesh.cpp:21
image::ImageData::Colorf color
Screen-space single-bounce GI (SSGI).
void applyFromDepth(Graphics *gfx, Texture *packedAlbedo)
Overlay bounced light onto the currently bound canvas / screen. Packed path (tests): RGB=albedo/lit,...
void applyFromScene(Graphics *gfx, Texture *color, Texture *hwDepth)
bool hasParam(const std::string &name) const
void setLightDirection(float dx, float dy, float dz)
void setQuality(const std::string &quality)
"low" | "medium" | "high" (unknown → medium).
void setCamera(float eyeX, float eyeY, float eyeZ, float targetX, float targetY, float targetZ, float upX, float upY, float upZ, float fovYDeg, float aspect, float nearZ, float farZ)
Camera for depth reconstruction (RH + ZO). Builds inv(viewProj) and near/far used by applyFromDepth.
void setFloat(const std::string &name, float value)
GlobalIllumination & operator=(const GlobalIllumination &)=delete
GlobalIllumination(const GlobalIllumination &)=delete
void setInvViewProj(const glm::mat4 &invViewProj)
void setLightColor(float r, float g, float b)
void applyFromDepthTo(Graphics *gfx, Texture *packedAlbedo, Canvas *dest)
float getFloat(const std::string &name) const
Custom GPU program.
Definition Shader.h:30
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:17
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition AnimTrail.h:6