Interactive 2D particle fluid (double-density relaxation) in pixel space. Script-owned; independent of Box2D World.
更多...
|
| | Fluid (int capacity=512) |
| |
| | ~Fluid () |
| |
| | Fluid (const Fluid &)=delete |
| |
| Fluid & | operator= (const Fluid &)=delete |
| |
| void | update (float dt) |
| |
| void | setGravity (float gx, float gy) |
| |
| float | getGravityX () const |
| |
| float | getGravityY () const |
| |
| void | setSmoothingRadius (float radius) |
| | Interaction / neighbor radius in pixels (default 18).
|
| |
| float | getSmoothingRadius () const |
| |
| void | setRestDensity (float density) |
| | Target rest density for the relaxation solver (default 4).
|
| |
| float | getRestDensity () const |
| |
| void | setPressureStiffness (float k) |
| | Pressure stiffness (default 0.5).
|
| |
| float | getPressureStiffness () const |
| |
| void | setNearPressureStiffness (float k) |
| | Near-pressure (anti-clustering) stiffness (default 0.5).
|
| |
| float | getNearPressureStiffness () const |
| |
| void | setViscosity (float viscosity) |
| |
| float | getViscosity () const |
| |
| void | setIterations (int iterations) |
| | Solver iterations per frame (default 3).
|
| |
| int | getIterations () const |
| |
| void | setBounds (float x, float y, float w, float h) |
| | Axis-aligned container; particles bounce inside.
|
| |
| void | clearBounds () |
| |
| 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) |
| |
| float | getColorR () const |
| |
| float | getColorG () const |
| |
| float | getColorB () const |
| |
| float | getColorA () const |
| |
| void | setParticleSize (float size) |
| | Particle draw size in pixels (default 5).
|
| |
| float | getParticleSize () const |
| |
| void | draw (graphics::Graphics *gfx) |
| |
| int | getCapacity () const |
| |
| int | getParticleCount () const |
| |
| float | getParticleX (int index) const |
| |
| float | getParticleY (int index) const |
| |
| float | getParticleVx (int index) const |
| |
| float | getParticleVy (int index) const |
| |
| void | destroy () |
| |
Interactive 2D particle fluid (double-density relaxation) in pixel space. Script-owned; independent of Box2D World.
在文件 Fluid.h 第 17 行定义.