载入中...
搜索中...
未找到
Waterfall.h
浏览该文件的文档.
1#pragma once
2
3#include "graphics/Shader.h"
4
5#include <cstdint>
6#include <string>
7#include <vector>
8
9#include <glm/glm.hpp>
10
11namespace eve::graphics {
12
13class Graphics;
14class Mesh;
15class Texture;
16
34class Waterfall {
35public:
36 explicit Waterfall(Graphics *gfx);
37 ~Waterfall() = default;
38
39 Waterfall(const Waterfall &) = delete;
40 Waterfall &operator=(const Waterfall &) = delete;
41
43 void createSheet(float width, float height, int segX, int segY);
44
46 void update(float dt);
47 void setTime(float seconds);
48 float getTime() const { return time_; }
49
50 // --- Animation / material knobs ---
52 void setFlowSpeed(float speed);
53 float getFlowSpeed() const { return flowSpeed_; }
54
56 void setTurbulence(float t);
57 float getTurbulence() const { return turbulence_; }
58
60 void setStreakCount(int count);
61 int getStreakCount() const { return streakCount_; }
62
64 void setStreakScale(float scale);
65 float getStreakScale() const { return streakScale_; }
66
68 void setTopFoam(float v);
69 float getTopFoam() const { return topFoam_; }
70 void setBottomFoam(float v);
71 float getBottomFoam() const { return bottomFoam_; }
72 void setFoamAmount(float v);
73 float getFoamAmount() const { return foamAmount_; }
74
75 void setWaterColor(float r, float g, float b);
76 void setReflectionIntensity(float intensity);
77 float getReflectionIntensity() const { return reflectionIntensity_; }
78 void setSunIntensity(float intensity);
79 float getSunIntensity() const { return sunIntensity_; }
80
82 void bindParams();
83
85 void draw();
86
87 Shader *getShader() const { return shader_; }
88 Mesh *getMesh() const { return mesh_; }
89
91 static int paramCount();
92 static std::string paramName(int index);
93
94private:
95 Graphics *gfx_ = nullptr;
96 Shader *shader_ = nullptr;
97 Mesh *mesh_ = nullptr;
98
99 float time_ = 0.f;
100 float flowSpeed_ = 1.4f;
101 float turbulence_ = 0.6f;
102 int streakCount_ = 4;
103 float streakScale_ = 5.f;
104 float topFoam_ = 0.06f;
105 float bottomFoam_ = 0.12f;
106 float foamAmount_ = 0.85f;
107 float waterColor_[3] = {0.05f, 0.22f, 0.30f};
108 float reflectionIntensity_ = 0.55f;
109 float sunIntensity_ = 0.8f;
110};
111
113Shader *newWaterfallShader(Graphics *gfx);
114
115} // namespace eve::graphics
float height
Definition Grass.cpp:235
uint32_t b
int width
int v
float scale
Definition TreeMesh.cpp:122
GPU mesh handle (+ optional CPU morph targets).
Definition Mesh.h:18
Custom GPU program.
Definition Shader.h:30
Flowing waterfall (falling water sheet) rendered on a vertical plane.
Definition Waterfall.h:34
float getStreakScale() const
Definition Waterfall.h:65
void setSunIntensity(float intensity)
void setReflectionIntensity(float intensity)
Shader * getShader() const
Definition Waterfall.h:87
static int paramCount()
Names of the push-constant parameters (for UI / inspection).
Definition Waterfall.cpp:44
void createSheet(float width, float height, int segX, int segY)
Build a vertical XY plane (facing +Z, Y-up world) sized w×h, UVs [0,1]².
Definition Waterfall.cpp:56
float getSunIntensity() const
Definition Waterfall.h:79
void setStreakCount(int count)
How many layered falling streaks are drawn.
void setFoamAmount(float v)
int getStreakCount() const
Definition Waterfall.h:61
float getFoamAmount() const
Definition Waterfall.h:73
float getTime() const
Definition Waterfall.h:48
void draw()
Draw the waterfall sheet (uses default mesh3d camera / lighting state).
void setWaterColor(float r, float g, float b)
Mesh * getMesh() const
Definition Waterfall.h:88
float getTurbulence() const
Definition Waterfall.h:57
float getBottomFoam() const
Definition Waterfall.h:71
void setTurbulence(float t)
Amount of turbulence / white-water streak in the body.
float getReflectionIntensity() const
Definition Waterfall.h:77
void bindParams()
Upload current params to the shader push constants.
void setBottomFoam(float v)
Waterfall(const Waterfall &)=delete
void setStreakScale(float scale)
Horizontal stretch of the falling streaks (1 = circular, >1 elongated).
float getTopFoam() const
Definition Waterfall.h:69
void update(float dt)
Advance the animation clock by dt seconds.
Definition Waterfall.cpp:91
void setTopFoam(float v)
Relative height (0..1) of the top foam lip and bottom splash bands.
void setFlowSpeed(float speed)
Fall speed of the water (scales the downward scroll).
void setTime(float seconds)
Definition Waterfall.cpp:96
float getFlowSpeed() const
Definition Waterfall.h:53
Waterfall & operator=(const Waterfall &)=delete
static std::string paramName(int index)
Definition Waterfall.cpp:46
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition AnimTrail.h:6
Shader * newWaterfallShader(Graphics *gfx)
Create the embedded waterfall fragment shader (owned by Graphics).
Definition Waterfall.cpp:31