class which creates a cloth. It contains all themethods to work with masses and springs, which combined together in a mass-spring system represent a cloth
More...
Public Member Functions |
| Cloth (float clothSize, int _massesNum, float _damping, float _springDamping, float _timeStep, float _gravity, float _stiffeness, float _criticalDistance, float _friction, float _bumpiness, ngl::TransformStack *_transform) |
| the constractor of the cloth class. set-up the default parameters to the cloth [in] clothSize the size of the cloth [in] _massesNum amount of masses to be used to generate the cloth [in] _damping the damping of the cloth, this parameter effects masses of the cloth [in] _springDamping damping of the cloth, this parameter effects springs of the cloth [in] _timeStep time step for integration [in] _gravity gravity force acting on each mass of the cloth [in] _stiffeness stiffness of the cloth [in] _criticalDistance the distance which should be maintained between the cloth and other objects of the scene [in] _friction fricition of the cloth [in] _bumpiness bumpiness of the cloth [in] _transform transformation stack
|
void | createCloth (std::vector< ngl::Vector > vertexList, std::vector< ngl::Face > facesList, std::vector< ngl::Vector > normalsList) |
| creates a cloth base on list of vertices, list of faces and list of normals
|
void | DrawLine (ngl::Vector *points) |
| draws a line based on set of input points
|
void | setClothSize (float _clothSize) |
| set the size of the cloth
|
void | updateSprings () |
| update springs of the cloth
|
void | setActiveMass (bool _isActive, int constraintNumber) |
| sets the mass, which user interacts with at the moment
|
void | moveActiveMass (ngl::Vector _displaysment) |
| changes the position of the active mass in response to the user action
|
void | setConstraintPoint1 (int massNum, bool _activated) |
| set the position of the constraint point1 on cloth
|
void | setConstraintPoint2 (int massNum, bool _activated) |
| set the position of the constraint point1 on cloth
|
void | setConstraintPoint3 (int massNum, bool _activated) |
| set the position of the constraint point1 on cloth
|
void | setConstraintPoint4 (int massNum, bool _activated) |
| set the position of the constraint point1 on cloth
|
float | getClothSize () |
| get the size of the cloth
|
void | setMassesNum (int _massesNum) |
| set the number of masses in a line of the cloth
|
float | getMassesNum () |
| get the number of masses in a line of the cloth
|
std::string | getIntegrationMethod () |
| get the string variant of integration na,e
|
void | calculateClothNormals () |
| method to calculate cloth normals
|
void | setDumping (float _dumping) |
| set the DAMPING [in] _dumping the value to set
|
void | setTimeStep (float _timeStep) |
| set the TIME_STEPSIZE [in] _timeStep the value to set
|
void | setSpringDumping (float _dumping) |
| set the spring DAMPING [in] _d
|
void | setGravity (float _gravity) |
| set the GRAVITY [in] _gravity the value to set
|
void | setCriticalDistance (float _criticalDistance) |
| set the CRITICAL_DISTANCE [in] _criticalDistance the value to set
|
void | setFricition (float _friction) |
| set the FRICITION [in] _friction the value to set
|
void | setBumpiness (float _bumpiness) |
| set the BUMPINESS [in] _bumpiness the value to set
|
void | setStiffness (float _stifness) |
| set the STIFFENESS [in] _stifness the value to set
|
float | getSpringDamping () |
| get the springDAMPING
|
float | getDamping () |
| get the DAMPING
|
float | getStiffeness () |
| get the STIFFENESS
|
float | getTimeStep () |
| get the TIME_STEPSIZE
|
float | getGravity () |
| get the GRAVITY
|
float | getCriticalDistance () |
| get the CRITICAL_DISTANCE
|
float | getFriction () |
| get the FRICITION
|
float | getBumpiness () |
| get the BUMPINESS
|
void | setIntegrationMethod (bool isEuler) |
| sets Integration method. If isEuler is truth - Euler method, otherwise - Verlet method
|
Mass * | getMass (int massNumber) |
| returns the mass by its number in a vertex list [in] massNumber the vertex number of the mass, the reference to which should be returned
|
void | makeSpring (Mass *_mass1, Mass *_mass2, ngl::TransformStack *_transform) |
| the method creates a spring between two masses [in] _mass1 one of the masses the spring contains [in] _mass2 one of the masses the spring contains [in] _transform transformation stack
|
void | update () |
| the method to update the current state of the cloth
|
void | draw () |
| the method to draw the cloth
|
void | addForce (const ngl::Vector direction) |
| the method to add external force acting on the cloth [in] direction the vector of force to be added to the cloth
|
Public Attributes |
ConstraintPoint * | activeConstraint |
| reference to one of the 4 constraints,
|
std::vector< ngl::Vector > | m_vertexList |
| list of verteces of the cloth mesh
|
std::vector< ngl::Face > | m_facesList |
| list of faces of cloth mesh
|
std::vector< ngl::Vector > | m_normalsList |
| list of normals of the cloth mesh
|
ConstraintPoint * | constraintPoint1 |
| the position of constraint point1
|
ConstraintPoint * | constraintPoint2 |
| the position of constraint point2
|
ConstraintPoint * | constraintPoint3 |
| the position of constraint point3
|
ConstraintPoint * | constraintPoint4 |
| the position of constraint point4
|
bool | isWind |
| existance of wind
|
IntegrationMethod | m_integrationMethod |
| edefines the integration method for a cloth
|
std::vector< Mass * > | masses |
| masses list of masses which create cloth
|
std::vector< Face > | faces |
| faces list of faces which create cloth
|
int | m_activeConstraintNumber |
Protected Attributes |
ngl::TransformStack * | m_transform |
| a pointer to the global transform stack
|
class which creates a cloth. It contains all themethods to work with masses and springs, which combined together in a mass-spring system represent a cloth