载入中...
搜索中...
未找到
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 | |
| Cloth & | operator= (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() [1/2]
| eve::physics::Cloth::Cloth | ( | int | cols, |
| int | rows, | ||
| float | spacing, | ||
| float | originX, | ||
| float | originY | ||
| ) |
- 参数
-
cols grid columns (>= 2) rows grid rows (>= 2) spacing particle spacing in pixels originX top-left particle X (pixels) originY top-left particle Y (pixels)
引用了 c, p , 以及 pinTopRow().
◆ ~Cloth()
◆ Cloth() [2/2]
|
delete |
成员函数说明
◆ applyForce()
| void eve::physics::Cloth::applyForce | ( | float | fx, |
| float | fy | ||
| ) |
◆ clearBounds()
| void eve::physics::Cloth::clearBounds | ( | ) |
被这些函数引用 setBounds().
◆ destroy()
◆ draw()
| void eve::physics::Cloth::draw | ( | graphics::Graphics * | gfx | ) |
◆ getColorA()
◆ getColorB()
◆ getColorG()
◆ getColorR()
◆ getCols()
◆ getDamping()
◆ getGrabIndex()
◆ getGravityX()
◆ getGravityY()
◆ getIterations()
◆ getOriginX()
◆ getOriginY()
◆ getParticleCount()
◆ getParticleX()
◆ getParticleY()
◆ getRows()
◆ getSpacing()
◆ getStiffness()
◆ 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.
引用了 getParticleCount(), moveGrab(), p, x , 以及 y.
◆ isGrabbing()
◆ isPinned()
◆ moveGrab()
| void eve::physics::Cloth::moveGrab | ( | float | x, |
| float | y | ||
| ) |
◆ operator=()
◆ pin()
◆ pinTopRow()
◆ releaseGrab()
◆ setBounds()
| void eve::physics::Cloth::setBounds | ( | float | x, |
| float | y, | ||
| float | w, | ||
| float | h | ||
| ) |
◆ setColor()
| void eve::physics::Cloth::setColor | ( | float | r, |
| float | g, | ||
| float | b, | ||
| float | a = 1.f |
||
| ) |
◆ setDamping()
| void eve::physics::Cloth::setDamping | ( | float | damping | ) |
◆ setGravity()
◆ setIterations()
| void eve::physics::Cloth::setIterations | ( | int | iterations | ) |
◆ setParticlePosition()
| void eve::physics::Cloth::setParticlePosition | ( | int | index, |
| float | x, | ||
| float | y | ||
| ) |
◆ setStiffness()
| void eve::physics::Cloth::setStiffness | ( | float | stiffness | ) |
◆ unpin()
◆ update()
该类的文档由以下文件生成: