6#include <unordered_map>
30 void update(
float dt);
33 void setGravity(
float gx,
float gy);
40 void setSmoothingRadius(
float radius);
45 void setRestDensity(
float density);
50 void setPressureStiffness(
float k);
55 void setNearPressureStiffness(
float k);
60 void setViscosity(
float viscosity);
70 void setBounds(
float x,
float y,
float w,
float h);
78 int emit(
float x,
float y,
int count,
float vx = 0.f,
float vy = 0.f);
90 void setColor(
float r,
float g,
float b,
float a = 1.f);
101 void setParticleSize(
float size);
113 float getParticleX(
int index)
const;
115 float getParticleY(
int index)
const;
117 float getParticleVx(
int index)
const;
119 float getParticleVy(
int index)
const;
126 float x = 0.f,
y = 0.f;
127 float vx = 0.f,
vy = 0.f;
132 void applyViscosity(
float dt);
133 void doubleDensityRelaxation();
134 void collideBounds();
135 bool validIndex(
int index)
const;
136 int64_t cellKey(
int cx,
int cy)
const;
139 float gravityX_ = 0.f;
140 float gravityY_ = 980.f;
142 float restDensity_ = 4.f;
143 float pressureK_ = 0.5f;
144 float nearPressureK_ = 0.5f;
145 float viscosity_ = 0.12f;
148 bool hasBounds_ =
false;
149 float boundX_ = 0.f, boundY_ = 0.f, boundW_ = 0.f, boundH_ = 0.f;
151 float interactX_ = 0.f, interactY_ = 0.f;
152 float interactRadius_ = 0.f;
153 float interactStrength_ = 0.f;
155 float colorR_ = 0.25f, colorG_ = 0.55f, colorB_ = 0.95f, colorA_ = 0.85f;
156 float particleSize_ = 5.f;
158 bool destroyed_ =
false;
160 std::vector<Particle> particles_;
161 std::unordered_map<int64_t, std::vector<int>> hash_;
#define EVENGINE_API_WORLD
Interactive 2D particle fluid (double-density relaxation) in pixel space. Script-owned; independent o...
Fluid2D(const Fluid2D &)=delete
float getNearPressureStiffness() const
Returns the near pressure stiffness.
float getGravityY() const
Returns the gravity y.
float getColorA() const
Returns the color a.
int getIterations() const
Returns the iterations.
float getRestDensity() const
Returns the rest density.
float getGravityX() const
Returns the gravity x.
int getParticleCount() const
Returns the particle count.
float getColorR() const
Returns the color r.
float getSmoothingRadius() const
Returns the smoothing radius.
float getColorG() const
Returns the color g.
Fluid2D & operator=(const Fluid2D &)=delete
int getCapacity() const
Returns the capacity.
float getColorB() const
Returns the color b.
float getParticleSize() const
Returns the particle size.
float getViscosity() const
Returns the viscosity.
float getPressureStiffness() const
Returns the pressure stiffness.
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Optional physics backend for vehicle mobility and body attach.