- Cal3D 0.11 API Reference -

springsystem.h
1//****************************************************************************//
2// springsystem.h //
3// Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger //
4//****************************************************************************//
5// This library is free software; you can redistribute it and/or modify it //
6// under the terms of the GNU Lesser General Public License as published by //
7// the Free Software Foundation; either version 2.1 of the License, or (at //
8// your option) any later version. //
9//****************************************************************************//
10
11#ifndef CAL_SPRINGSYSTEM_H
12#define CAL_SPRINGSYSTEM_H
13
14//****************************************************************************//
15// Includes //
16//****************************************************************************//
17
18#include "cal3d/global.h"
19#include "cal3d/vector.h"
20
21//****************************************************************************//
22// Forward declarations //
23//****************************************************************************//
24
25class CalModel;
26class CalSubmesh;
27
28//****************************************************************************//
29// Class declaration //
30//****************************************************************************//
31
32 /*****************************************************************************/
35
36class CAL3D_API CalSpringSystem
37{
38public:
41
42// member functions
43public:
44 void calculateForces(CalSubmesh *pSubmesh, float deltaTime);
45 void calculateVertices(CalSubmesh *pSubmesh, float deltaTime);
46 void update(float deltaTime);
47
49 void setGravityVector(const CalVector & vGravity);
51 void setForceVector(const CalVector & vForce);
52 void setCollisionDetection(bool collision);
53
54
55 /* DEBUG CODE ********************
56 struct
57 {
58 float x, y, z, radius;
59 } Sphere;
60 void setSphere(float x, float y, float z, float radius) { Sphere.x = x; Sphere.y = y; Sphere.z = z; Sphere.radius = radius; };
61 *********************************/
62
63private:
64 CalModel *m_pModel;
65 CalVector m_vGravity;
66 CalVector m_vForce;
67 bool m_collision;
68};
69
70#endif
71
72//****************************************************************************//
Definition model.h:31
CalSpringSystem(CalModel *pModel)
Constructs the spring system instance.
Definition springsystem.cpp:36
CalVector & getGravityVector()
Returns the gravity vector.
Definition springsystem.cpp:349
void update(float deltaTime)
Updates all the spring systems in the attached meshes.
Definition springsystem.cpp:311
void calculateVertices(CalSubmesh *pSubmesh, float deltaTime)
Calculates the vertices influenced by the spring system instance.
Definition springsystem.cpp:99
void setGravityVector(const CalVector &vGravity)
Sets the gravity vector.
Definition springsystem.cpp:376
void setForceVector(const CalVector &vForce)
Sets the force vector.
Definition springsystem.cpp:389
void calculateForces(CalSubmesh *pSubmesh, float deltaTime)
Calculates the forces on each unbound vertex.
Definition springsystem.cpp:59
CalVector & getForceVector()
Returns the force vector.
Definition springsystem.cpp:363
void setCollisionDetection(bool collision)
Enable or disable the collision system.
Definition springsystem.cpp:400
Definition submesh.h:23
The vector class.
Definition vector.h:37

Generated by The Cal3D Team with Doxygen 1.15.0