载入中...
搜索中...
未找到
ScreenSpaceReflection.h
浏览该文件的文档.
1#pragma once
2
3#include <string>
4
5#include <glm/mat4x4.hpp>
6#include <glm/vec3.hpp>
7
8namespace eve::graphics {
9
10class Canvas;
11class Graphics;
12class Shader;
13class Texture;
14
27public:
28 explicit ScreenSpaceReflection(Graphics *gfx);
30
33
35 void setCamera(float eyeX, float eyeY, float eyeZ, float targetX, float targetY, float targetZ,
36 float upX, float upY, float upZ, float fovYDeg, float aspect, float nearZ,
37 float farZ);
38 void setInvViewProj(const glm::mat4 &invViewProj);
39
41 void setEnabled(bool enabled);
42 bool getEnabled() const { return enabled_; }
43
44 void setMaxDistance(float meters);
45 void setStepLength(float meters);
46 void setMaxSteps(int steps);
47 void setThickness(float meters);
48 void setStrength(float strength);
49 float getStrength() const { return strength_; }
50
51 bool hasParam(const std::string &name) const;
52 void setFloat(const std::string &name, float value);
53 float getFloat(const std::string &name) const;
54
56 void applyFromSceneTo(Graphics *gfx, Texture *sceneColor, Texture *hwDepth,
57 Texture *worldNormal, Canvas *dest);
59 void applyFromScene(Graphics *gfx, Texture *sceneColor, Texture *hwDepth,
60 Texture *worldNormal);
61
66
67 Shader *getShader() const { return ssr_; }
68
69private:
70 void uploadUniforms(int width, int height);
71
72 Graphics *gfx_ = nullptr;
73 Shader *ssr_ = nullptr;
74 Canvas *reflection_ = nullptr;
75 glm::mat4 invViewProj_{1.f};
76 float nearZ_ = 0.1f;
77 float farZ_ = 100.f;
78 bool enabled_ = true;
79 float maxDist_ = 60.f;
80 float stepLen_ = 0.4f;
81 float maxSteps_ = 96.f;
82 float thickness_ = 0.5f;
83 float strength_ = 0.9f;
84 float bias_ = 0.0005f;
85};
86
87} // namespace eve::graphics
std::string value
float height
Definition Grass.cpp:235
int width
const char * name
Definition RockMesh.cpp:21
bool enabled
Screen-space reflections (SSR) as a fullscreen post pass.
void applyFromSceneTo(Graphics *gfx, Texture *sceneColor, Texture *hwDepth, Texture *worldNormal, Canvas *dest)
Write the SSR result into the currently bound canvas / dest.
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) + near/far.
Texture * getReflectionTexture()
The reflection texture from the owned canvas, or nullptr before first apply.
ScreenSpaceReflection(const ScreenSpaceReflection &)=delete
void setEnabled(bool enabled)
Enable/disable the pass. When disabled it emits transparent (0 hit).
Canvas * getReflectionCanvas()
Owned reflection canvas (created on first use at the current target size).
void setInvViewProj(const glm::mat4 &invViewProj)
float getFloat(const std::string &name) const
void setFloat(const std::string &name, float value)
ScreenSpaceReflection & operator=(const ScreenSpaceReflection &)=delete
void applyFromScene(Graphics *gfx, Texture *sceneColor, Texture *hwDepth, Texture *worldNormal)
Write SSR into the currently bound canvas / screen.
bool hasParam(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