Interactive 2D particle fluid (double-density relaxation) in pixel space. Script-owned; independent of Box2D World.
更多...
|
| | Fluid2D (int capacity=512) |
| | Fluid 2 d.
|
| |
| | ~Fluid2D () |
| | Fluid 2 d.
|
| |
| | Fluid2D (const Fluid2D &)=delete |
| |
| Fluid2D & | operator= (const Fluid2D &)=delete |
| |
| void | update (float dt) |
| | Updates .
|
| |
| void | setGravity (float gx, float gy) |
| | Sets the gravity.
|
| |
| float | getGravityX () const |
| | Returns the gravity x.
|
| |
| float | getGravityY () const |
| | Returns the gravity y.
|
| |
| void | setSmoothingRadius (float radius) |
| | Interaction / neighbor radius in pixels (default 18).
|
| |
| float | getSmoothingRadius () const |
| | Returns the smoothing radius.
|
| |
| void | setRestDensity (float density) |
| | Target rest density for the relaxation solver (default 4).
|
| |
| float | getRestDensity () const |
| | Returns the rest density.
|
| |
| void | setPressureStiffness (float k) |
| | Pressure stiffness (default 0.5).
|
| |
| float | getPressureStiffness () const |
| | Returns the pressure stiffness.
|
| |
| void | setNearPressureStiffness (float k) |
| | Near-pressure (anti-clustering) stiffness (default 0.5).
|
| |
| float | getNearPressureStiffness () const |
| | Returns the near pressure stiffness.
|
| |
| void | setViscosity (float viscosity) |
| | Sets the viscosity.
|
| |
| float | getViscosity () const |
| | Returns the viscosity.
|
| |
| void | setIterations (int iterations) |
| | Solver iterations per frame (default 3).
|
| |
| int | getIterations () const |
| | Returns the iterations.
|
| |
| void | setBounds (float x, float y, float w, float h) |
| | Axis-aligned container; particles bounce inside.
|
| |
| void | clearBounds () |
| | Clears bounds.
|
| |
| int | emit (float x, float y, int count, float vx=0.f, float vy=0.f) |
| | Spawn up to count particles at (x,y) with initial velocity. Returns number actually added.
|
| |
| void | clear () |
| | Clear all particles.
|
| |
| void | interactAt (float x, float y, float radius, float strength) |
| | Mouse / pointer interaction: positive strength attracts, negative repels. Applied as acceleration within radius (pixels).
|
| |
| void | setColor (float r, float g, float b, float a=1.f) |
| | Sets the color.
|
| |
| float | getColorR () const |
| | Returns the color r.
|
| |
| float | getColorG () const |
| | Returns the color g.
|
| |
| float | getColorB () const |
| | Returns the color b.
|
| |
| float | getColorA () const |
| | Returns the color a.
|
| |
| void | setParticleSize (float size) |
| | Particle draw size in pixels (default 5).
|
| |
| float | getParticleSize () const |
| | Returns the particle size.
|
| |
| void | draw (graphics::Graphics *gfx) |
| | Draws .
|
| |
| int | getCapacity () const |
| | Returns the capacity.
|
| |
| int | getParticleCount () const |
| | Returns the particle count.
|
| |
| float | getParticleX (int index) const |
| | Returns the particle x.
|
| |
| float | getParticleY (int index) const |
| | Returns the particle y.
|
| |
| float | getParticleVx (int index) const |
| | Returns the particle vx.
|
| |
| float | getParticleVy (int index) const |
| | Returns the particle vy.
|
| |
| void | destroy () |
| | Destroys .
|
| |
Interactive 2D particle fluid (double-density relaxation) in pixel space. Script-owned; independent of Box2D World.
在文件 Fluid2D.h 第 19 行定义.
| int eve::physics::Fluid2D::emit |
( |
float |
x, |
|
|
float |
y, |
|
|
int |
count, |
|
|
float |
vx = 0.f, |
|
|
float |
vy = 0.f |
|
) |
| |
Spawn up to count particles at (x,y) with initial velocity. Returns number actually added.
在文件 Fluid2D.cpp 第 65 行定义.
引用了 count, cx, cy, getParticleCount(), p, side, step, vx, vy, x , 以及 y.