载入中...
搜索中...
未找到
ContactShadow.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4#include <glm/mat4x4.hpp>
5#include <glm/vec3.hpp>
6#include <string>
7
8namespace eve::graphics {
9
10class Graphics;
11class Shader;
12class Texture;
13
24public:
26 explicit ContactShadow(Graphics* gfx);
29
30 ContactShadow(const ContactShadow&) = delete;
32
34 void setQuality(const std::string& quality);
36 std::string getQuality() const { return quality_; }
37
42 void setCamera(float eyeX, float eyeY, float eyeZ, float targetX, float targetY, float targetZ, float upX,
43 float upY, float upZ, float fovYDeg, float aspect, float nearZ, float farZ);
44
46 void setInvViewProj(const glm::mat4& invViewProj);
47
52 void setLightDirection(float x, float y, float z);
53
55 void setLength(float length);
57 void setThickness(float thickness);
59 void setIntensity(float intensity);
61 void setStartBias(float bias);
62
64 float getLength() const { return length_; }
66 float getThickness() const { return thickness_; }
68 float getIntensity() const { return intensity_; }
70 float getStartBias() const { return startBias_; }
72 int getStepCount() const { return stepCount_; }
73
79 void applyFromGBuffer(Graphics* gfx, Texture* hwDepth, Texture* worldNormal);
80
83 Shader* getShader() const { return shader_; }
84
85private:
86 void applyQualityDefaults();
87 void uploadCommon(int width, int height);
88
89 Graphics* gfx_ = nullptr;
90 Shader* shader_ = nullptr;
91 glm::mat4 invViewProj_{1.f};
92 glm::vec3 lightDir_{0.48f, 0.86f, 0.28f};
93 std::string quality_ = "medium";
94 float nearZ_ = 0.1f;
95 float farZ_ = 100.f;
96 float length_ = 0.35f;
97 float thickness_ = 0.12f;
98 float intensity_ = 0.65f;
99 float startBias_ = 0.01f;
100 int stepCount_ = 12;
101};
102
103} // namespace eve::graphics
double z
double y
double x
#define EVENGINE_API_BACKENDS
Definition Export.h:108
std::uint32_t height
std::uint32_t width
float length
float thickness
float bias
Definition Shadow.cpp:149
float targetX
Screen-space contact shadows for the primary directional light.
float getLength() const
Returns the ray length.
ContactShadow & operator=(const ContactShadow &)=delete
ContactShadow(const ContactShadow &)=delete
Shader * getShader() const
Returns the owned contact-shadow shader. @lifetime Returned shader is borrowed and owned by Graphics.
int getStepCount() const
Returns the step count for the active quality.
float getStartBias() const
Returns the start bias.
float getIntensity() const
Returns the intensity.
~ContactShadow()
Releases owned shaders.
float getThickness() const
Returns the thickness.
std::string getQuality() const
Returns the quality.
Custom GPU program.
Definition Shader.h:41
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:15
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
glm::mat4 invViewProj