载入中...
搜索中...
未找到
eve::physics::Fluid2D类 参考

Interactive 2D particle fluid (double-density relaxation) in pixel space. Script-owned; independent of Box2D World. 更多...

#include <Fluid2D.h>

Public 成员函数

 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 行定义.

构造及析构函数说明

◆ Fluid2D() [1/2]

eve::physics::Fluid2D::Fluid2D ( int  capacity = 512)
explicit

Fluid 2 d.

在文件 Fluid2D.cpp 第 15 行定义.

◆ ~Fluid2D()

eve::physics::Fluid2D::~Fluid2D ( )

Fluid 2 d.

在文件 Fluid2D.cpp 第 20 行定义.

引用了 destroy().

◆ Fluid2D() [2/2]

eve::physics::Fluid2D::Fluid2D ( const Fluid2D &  )
delete

成员函数说明

◆ clear()

void eve::physics::Fluid2D::clear ( )

Clear all particles.

在文件 Fluid2D.cpp 第 84 行定义.

◆ clearBounds()

void eve::physics::Fluid2D::clearBounds ( )

Clears bounds.

在文件 Fluid2D.cpp 第 63 行定义.

被这些函数引用 setBounds().

◆ destroy()

void eve::physics::Fluid2D::destroy ( )

Destroys .

在文件 Fluid2D.cpp 第 22 行定义.

被这些函数引用 ~Fluid2D().

◆ draw()

void eve::physics::Fluid2D::draw ( graphics::Graphics *  gfx)

Draws .

在文件 Fluid2D.cpp 第 329 行定义.

引用了 eve::graphics::Graphics::drawSolidRect(), p, s , 以及 t.

◆ emit()

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.

◆ getCapacity()

int eve::physics::Fluid2D::getCapacity ( ) const
inline

Returns the capacity.

在文件 Fluid2D.h 第 109 行定义.

◆ getColorA()

float eve::physics::Fluid2D::getColorA ( ) const
inline

Returns the color a.

在文件 Fluid2D.h 第 98 行定义.

◆ getColorB()

float eve::physics::Fluid2D::getColorB ( ) const
inline

Returns the color b.

在文件 Fluid2D.h 第 96 行定义.

◆ getColorG()

float eve::physics::Fluid2D::getColorG ( ) const
inline

Returns the color g.

在文件 Fluid2D.h 第 94 行定义.

◆ getColorR()

float eve::physics::Fluid2D::getColorR ( ) const
inline

Returns the color r.

在文件 Fluid2D.h 第 92 行定义.

◆ getGravityX()

float eve::physics::Fluid2D::getGravityX ( ) const
inline

Returns the gravity x.

在文件 Fluid2D.h 第 35 行定义.

◆ getGravityY()

float eve::physics::Fluid2D::getGravityY ( ) const
inline

Returns the gravity y.

在文件 Fluid2D.h 第 37 行定义.

◆ getIterations()

int eve::physics::Fluid2D::getIterations ( ) const
inline

Returns the iterations.

在文件 Fluid2D.h 第 67 行定义.

◆ getNearPressureStiffness()

float eve::physics::Fluid2D::getNearPressureStiffness ( ) const
inline

Returns the near pressure stiffness.

在文件 Fluid2D.h 第 57 行定义.

◆ getParticleCount()

int eve::physics::Fluid2D::getParticleCount ( ) const
inline

Returns the particle count.

在文件 Fluid2D.h 第 111 行定义.

被这些函数引用 emit() , 以及 update().

◆ getParticleSize()

float eve::physics::Fluid2D::getParticleSize ( ) const
inline

Returns the particle size.

在文件 Fluid2D.h 第 103 行定义.

◆ getParticleVx()

float eve::physics::Fluid2D::getParticleVx ( int  index) const

Returns the particle vx.

在文件 Fluid2D.cpp 第 119 行定义.

引用了 index , 以及 vx.

◆ getParticleVy()

float eve::physics::Fluid2D::getParticleVy ( int  index) const

Returns the particle vy.

在文件 Fluid2D.cpp 第 124 行定义.

引用了 index , 以及 vy.

◆ getParticleX()

float eve::physics::Fluid2D::getParticleX ( int  index) const

Returns the particle x.

在文件 Fluid2D.cpp 第 109 行定义.

引用了 index , 以及 x.

◆ getParticleY()

float eve::physics::Fluid2D::getParticleY ( int  index) const

Returns the particle y.

在文件 Fluid2D.cpp 第 114 行定义.

引用了 index , 以及 y.

◆ getPressureStiffness()

float eve::physics::Fluid2D::getPressureStiffness ( ) const
inline

Returns the pressure stiffness.

在文件 Fluid2D.h 第 52 行定义.

◆ getRestDensity()

float eve::physics::Fluid2D::getRestDensity ( ) const
inline

Returns the rest density.

在文件 Fluid2D.h 第 47 行定义.

◆ getSmoothingRadius()

float eve::physics::Fluid2D::getSmoothingRadius ( ) const
inline

Returns the smoothing radius.

在文件 Fluid2D.h 第 42 行定义.

◆ getViscosity()

float eve::physics::Fluid2D::getViscosity ( ) const
inline

Returns the viscosity.

在文件 Fluid2D.h 第 62 行定义.

◆ interactAt()

void eve::physics::Fluid2D::interactAt ( float  x,
float  y,
float  radius,
float  strength 
)

Mouse / pointer interaction: positive strength attracts, negative repels. Applied as acceleration within radius (pixels).

在文件 Fluid2D.cpp 第 89 行定义.

引用了 radius, strength, x , 以及 y.

◆ operator=()

Fluid2D & eve::physics::Fluid2D::operator= ( const Fluid2D &  )
delete

◆ setBounds()

void eve::physics::Fluid2D::setBounds ( float  x,
float  y,
float  w,
float  h 
)

Axis-aligned container; particles bounce inside.

在文件 Fluid2D.cpp 第 51 行定义.

引用了 clearBounds(), h, w, x , 以及 y.

◆ setColor()

void eve::physics::Fluid2D::setColor ( float  r,
float  g,
float  b,
float  a = 1.f 
)

Sets the color.

在文件 Fluid2D.cpp 第 96 行定义.

引用了 a, b, g , 以及 r.

◆ setGravity()

void eve::physics::Fluid2D::setGravity ( float  gx,
float  gy 
)

Sets the gravity.

在文件 Fluid2D.cpp 第 28 行定义.

◆ setIterations()

void eve::physics::Fluid2D::setIterations ( int  iterations)

Solver iterations per frame (default 3).

在文件 Fluid2D.cpp 第 49 行定义.

引用了 iterations.

◆ setNearPressureStiffness()

void eve::physics::Fluid2D::setNearPressureStiffness ( float  k)

Near-pressure (anti-clustering) stiffness (default 0.5).

在文件 Fluid2D.cpp 第 45 行定义.

◆ setParticleSize()

void eve::physics::Fluid2D::setParticleSize ( float  size)

Particle draw size in pixels (default 5).

在文件 Fluid2D.cpp 第 103 行定义.

引用了 size.

◆ setPressureStiffness()

void eve::physics::Fluid2D::setPressureStiffness ( float  k)

Pressure stiffness (default 0.5).

在文件 Fluid2D.cpp 第 43 行定义.

◆ setRestDensity()

void eve::physics::Fluid2D::setRestDensity ( float  density)

Target rest density for the relaxation solver (default 4).

在文件 Fluid2D.cpp 第 38 行定义.

◆ setSmoothingRadius()

void eve::physics::Fluid2D::setSmoothingRadius ( float  radius)

Interaction / neighbor radius in pixels (default 18).

在文件 Fluid2D.cpp 第 33 行定义.

引用了 radius.

◆ setViscosity()

void eve::physics::Fluid2D::setViscosity ( float  viscosity)

Sets the viscosity.

在文件 Fluid2D.cpp 第 47 行定义.

◆ update()

void eve::physics::Fluid2D::update ( float  dt)

Updates .

在文件 Fluid2D.cpp 第 266 行定义.

引用了 dx, dy, getParticleCount(), p, r, s , 以及 w.


该类的文档由以下文件生成: