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

Interactive 2D cloth — Verlet particles + distance constraints. Pixel space (same convention as Box2D World). Script-owned. 更多...

#include <Cloth.h>

Public 成员函数

 Cloth (int cols, int rows, float spacing, float originX, float originY)
 
 ~Cloth ()
 
 Cloth (const Cloth &)=delete
 
Clothoperator= (const Cloth &)=delete
 
void update (float dt)
 
void setGravity (float gx, float gy)
 
float getGravityX () const
 
float getGravityY () const
 
void setStiffness (float stiffness)
 Constraint relaxation strength in [0,1] (default 0.85).
 
float getStiffness () const
 
void setIterations (int iterations)
 Constraint solver iterations per substep (default 4).
 
int getIterations () const
 
void setDamping (float damping)
 Damping applied to Verlet velocity [0,1] (default 0.01).
 
float getDamping () const
 
void setBounds (float x, float y, float w, float h)
 Axis-aligned walls; particles bounce inside. Disabled if w/h <= 0.
 
void clearBounds ()
 
void pin (int index)
 
void unpin (int index)
 
void pinTopRow ()
 
bool isPinned (int index) const
 
int grabAt (float x, float y, float radius=24.f)
 Grab nearest free particle within radius (pixels). Returns particle index, or -1 if none.
 
void moveGrab (float x, float y)
 
void releaseGrab ()
 
bool isGrabbing () const
 
int getGrabIndex () const
 
void applyForce (float fx, float fy)
 
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 draw (graphics::Graphics *gfx)
 
int getCols () const
 
int getRows () const
 
int getParticleCount () const
 
float getParticleX (int index) const
 
float getParticleY (int index) const
 
void setParticlePosition (int index, float x, float y)
 
float getSpacing () const
 
float getOriginX () const
 
float getOriginY () const
 
void destroy ()
 

详细描述

Interactive 2D cloth — Verlet particles + distance constraints. Pixel space (same convention as Box2D World). Script-owned.

在文件 Cloth.h17 行定义.

构造及析构函数说明

◆ Cloth() [1/2]

eve::physics::Cloth::Cloth ( int  cols,
int  rows,
float  spacing,
float  originX,
float  originY 
)
参数
colsgrid columns (>= 2)
rowsgrid rows (>= 2)
spacingparticle spacing in pixels
originXtop-left particle X (pixels)
originYtop-left particle Y (pixels)

在文件 Cloth.cpp15 行定义.

引用了 c, p , 以及 pinTopRow().

◆ ~Cloth()

eve::physics::Cloth::~Cloth ( )

在文件 Cloth.cpp35 行定义.

引用了 destroy().

◆ Cloth() [2/2]

eve::physics::Cloth::Cloth ( const Cloth )
delete

成员函数说明

◆ applyForce()

void eve::physics::Cloth::applyForce ( float  fx,
float  fy 
)

Uniform wind / force impulse applied this frame (pixels/s² * mass).

在文件 Cloth.cpp156 行定义.

◆ clearBounds()

void eve::physics::Cloth::clearBounds ( )

在文件 Cloth.cpp103 行定义.

被这些函数引用 setBounds().

◆ destroy()

void eve::physics::Cloth::destroy ( )

在文件 Cloth.cpp37 行定义.

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

◆ draw()

void eve::physics::Cloth::draw ( graphics::Graphics gfx)

在文件 Cloth.cpp296 行定义.

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

◆ getColorA()

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

在文件 Cloth.h76 行定义.

◆ getColorB()

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

在文件 Cloth.h75 行定义.

◆ getColorG()

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

在文件 Cloth.h74 行定义.

◆ getColorR()

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

在文件 Cloth.h73 行定义.

◆ getCols()

int eve::physics::Cloth::getCols ( ) const
inline

在文件 Cloth.h80 行定义.

◆ getDamping()

float eve::physics::Cloth::getDamping ( ) const
inline

在文件 Cloth.h48 行定义.

◆ getGrabIndex()

int eve::physics::Cloth::getGrabIndex ( ) const
inline

在文件 Cloth.h67 行定义.

◆ getGravityX()

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

在文件 Cloth.h35 行定义.

◆ getGravityY()

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

在文件 Cloth.h36 行定义.

◆ getIterations()

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

在文件 Cloth.h44 行定义.

◆ getOriginX()

float eve::physics::Cloth::getOriginX ( ) const
inline

在文件 Cloth.h88 行定义.

◆ getOriginY()

float eve::physics::Cloth::getOriginY ( ) const
inline

在文件 Cloth.h89 行定义.

◆ getParticleCount()

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

在文件 Cloth.h82 行定义.

被这些函数引用 grabAt().

◆ getParticleX()

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

在文件 Cloth.cpp168 行定义.

引用了 x.

◆ getParticleY()

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

在文件 Cloth.cpp173 行定义.

引用了 y.

◆ getRows()

int eve::physics::Cloth::getRows ( ) const
inline

在文件 Cloth.h81 行定义.

◆ getSpacing()

float eve::physics::Cloth::getSpacing ( ) const
inline

在文件 Cloth.h87 行定义.

◆ getStiffness()

float eve::physics::Cloth::getStiffness ( ) const
inline

在文件 Cloth.h40 行定义.

◆ grabAt()

int eve::physics::Cloth::grabAt ( float  x,
float  y,
float  radius = 24.f 
)

Grab nearest free particle within radius (pixels). Returns particle index, or -1 if none.

在文件 Cloth.cpp125 行定义.

引用了 getParticleCount(), moveGrab(), p, x , 以及 y.

◆ isGrabbing()

bool eve::physics::Cloth::isGrabbing ( ) const
inline

在文件 Cloth.h66 行定义.

◆ isPinned()

bool eve::physics::Cloth::isPinned ( int  index) const

在文件 Cloth.cpp120 行定义.

◆ moveGrab()

void eve::physics::Cloth::moveGrab ( float  x,
float  y 
)

在文件 Cloth.cpp143 行定义.

引用了 p, x , 以及 y.

被这些函数引用 grabAt().

◆ operator=()

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

◆ pin()

void eve::physics::Cloth::pin ( int  index)

在文件 Cloth.cpp105 行定义.

◆ pinTopRow()

void eve::physics::Cloth::pinTopRow ( )

在文件 Cloth.cpp115 行定义.

引用了 c.

被这些函数引用 Cloth().

◆ releaseGrab()

void eve::physics::Cloth::releaseGrab ( )

在文件 Cloth.cpp154 行定义.

◆ setBounds()

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

Axis-aligned walls; particles bounce inside. Disabled if w/h <= 0.

在文件 Cloth.cpp91 行定义.

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

◆ setColor()

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

在文件 Cloth.cpp161 行定义.

引用了 a , 以及 b.

◆ setDamping()

void eve::physics::Cloth::setDamping ( float  damping)

Damping applied to Verlet velocity [0,1] (default 0.01).

在文件 Cloth.cpp87 行定义.

◆ setGravity()

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

在文件 Cloth.cpp74 行定义.

◆ setIterations()

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

Constraint solver iterations per substep (default 4).

在文件 Cloth.cpp83 行定义.

引用了 iterations.

◆ setParticlePosition()

void eve::physics::Cloth::setParticlePosition ( int  index,
float  x,
float  y 
)

在文件 Cloth.cpp178 行定义.

引用了 p, x , 以及 y.

◆ setStiffness()

void eve::physics::Cloth::setStiffness ( float  stiffness)

Constraint relaxation strength in [0,1] (default 0.85).

在文件 Cloth.cpp79 行定义.

◆ unpin()

void eve::physics::Cloth::unpin ( int  index)

在文件 Cloth.cpp110 行定义.

◆ update()

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

在文件 Cloth.cpp273 行定义.

引用了 h, p , 以及 s.


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