载入中...
搜索中...
未找到
Outline.h
浏览该文件的文档.
1#pragma once
2
3#include <string>
4
5namespace eve::graphics {
6
7class Canvas;
8class Graphics;
9class Shader;
10class Texture;
11
31class Outline {
32public:
33 explicit Outline(Graphics *gfx);
35
36 Outline(const Outline &) = delete;
37 Outline &operator=(const Outline &) = delete;
38
39 void setColor(float r, float g, float b);
40 float getColorR() const;
41 float getColorG() const;
42 float getColorB() const;
43
45 void setWidth(float width);
46 float getWidth() const;
47
49 void setDepthThreshold(float threshold);
50 float getDepthThreshold() const;
51
53 void setDepthSensitivity(float sensitivity);
54 float getDepthSensitivity() const;
55
57 void setNormalThreshold(float threshold);
58 float getNormalThreshold() const;
59
61 void setSoftness(float softness);
62 float getSoftness() const;
63
65 void setClip(float nearZ, float farZ);
66
67 bool hasParam(const std::string &name) const;
68 void setFloat(const std::string &name, float value);
69 float getFloat(const std::string &name) const;
70
77 bool apply(Graphics *gfx, Texture *hwDepth, Texture *worldNormal);
78 bool applyTo(Graphics *gfx, Texture *hwDepth, Texture *worldNormal, Canvas *dest);
79
80 Shader *getShader() const { return shader_; }
81
82private:
83 void uploadCommon(Graphics *gfx, Texture *hwDepth);
84
85 Graphics *gfx_ = nullptr;
86 Shader *shader_ = nullptr;
87 float nearZ_ = 0.1f;
88 float farZ_ = 100.f;
89 float colorR_ = 0.05f;
90 float colorG_ = 0.04f;
91 float colorB_ = 0.07f;
92 float width_ = 1.f;
93 float depthThreshold_ = 0.3f;
94 float depthSensitivity_ = 0.f;
95 float normalThreshold_ = 0.35f;
96 float softness_ = 0.15f;
97};
98
99} // namespace eve::graphics
std::string value
uint32_t b
int width
const char * name
Definition RockMesh.cpp:21
Screen-space model outline (t3ssel8r-style), computed from the GBuffer hardware depth + world-normal ...
Definition Outline.h:31
float getColorG() const
Definition Outline.cpp:68
void setWidth(float width)
Outline thickness in screen pixels (>= 0.5).
Definition Outline.cpp:71
float getDepthSensitivity() const
Definition Outline.cpp:90
void setDepthThreshold(float threshold)
View-space depth discontinuity that starts a depth edge.
Definition Outline.cpp:78
float getDepthThreshold() const
Definition Outline.cpp:83
float getWidth() const
Definition Outline.cpp:76
float getSoftness() const
Definition Outline.cpp:104
void setFloat(const std::string &name, float value)
Definition Outline.cpp:119
void setNormalThreshold(float threshold)
Normal discontinuity (1 - dot(n, nN)) that starts a crease edge.
Definition Outline.cpp:92
void setColor(float r, float g, float b)
Definition Outline.cpp:56
void setSoftness(float softness)
Smoothstep band used to fade edges (0 = hard, 1 = soft).
Definition Outline.cpp:99
float getColorB() const
Definition Outline.cpp:69
bool hasParam(const std::string &name) const
Definition Outline.cpp:115
void setDepthSensitivity(float sensitivity)
Extra per-unit-distance depth tolerance (keeps outlines distance-consistent).
Definition Outline.cpp:85
float getFloat(const std::string &name) const
Definition Outline.cpp:124
Outline(const Outline &)=delete
void setClip(float nearZ, float farZ)
Near/far used to linearize the hardware depth.
Definition Outline.cpp:106
bool apply(Graphics *gfx, Texture *hwDepth, Texture *worldNormal)
Draw the outline over the currently bound canvas / screen. hwDepth is the D32 GBuffer (Vulkan NDC z),...
Definition Outline.cpp:143
Shader * getShader() const
Definition Outline.h:80
float getNormalThreshold() const
Definition Outline.cpp:97
float getColorR() const
Definition Outline.cpp:67
bool applyTo(Graphics *gfx, Texture *hwDepth, Texture *worldNormal, Canvas *dest)
Definition Outline.cpp:159
Outline & operator=(const Outline &)=delete
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