00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
#ifndef OPENCAL_CLOTH_H
00012
#define OPENCAL_CLOTH_H
00013
00014
00015
#include <OpenCAL/global.h>
00016
#include <OpenCAL/MassSpringSystem.h>
00017
00018
namespace OpenCAL
00019 {
00020
00021
namespace Utils {
class Vector3;
class Texture; }
00022
using Utils::Vector3;
00023
using Utils::Texture;
00024
00035 class OPENCAL_API Cloth:
public MassSpringSystem
00036 {
00037
protected:
00038
00039
unsigned int m_rows, m_columns;
00040
unsigned int m_structuralSprings, m_shearSprings, m_bendSprings;
00041
00042
public:
00043
00044 Cloth(
System *parent,
const Vector3 &position,
float width,
float height);
00045
00046
virtual ~Cloth();
00047
00048
00049
PointMass *getPoint(
unsigned int row,
unsigned int col)
00050 {
return (
PointMass *) m_objects[row * m_columns + col]; }
00051
const PointMass *getPoint(
unsigned int row,
unsigned int col)
const
00052
{
return (
const PointMass *) m_objects[row * m_columns + col]; }
00053
PointMass *getCorner1() {
return getPoint(0, 0); }
00054
PointMass *getCorner2() {
return getPoint(0, m_columns - 1); }
00055
PointMass *getCorner3() {
return getPoint(m_rows - 1, 0); }
00056
PointMass *getCorner4() {
return getPoint(m_rows - 1, m_columns - 1); }
00057
00059
00060
00061
00062
00063
virtual void render();
00064
00065
00066
00067
00068
00069
00070
protected:
00071
00072
void constructCloth(
const Vector3 &position,
float width,
float height);
00073 };
00074 }
00075
00076
#endif // OPENCAL_CLOTH_H