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 
25 class CalModel;
26 class CalSubmesh;
27 
28 //****************************************************************************//
29 // Class declaration                                                          //
30 //****************************************************************************//
31 
32  /*****************************************************************************/
33 /** The spring system class.
34   *****************************************************************************/
35 
36 class CAL3D_API CalSpringSystem
37 {
38 public:
39   CalSpringSystem(CalModel* pModel);
~CalSpringSystem()40   ~CalSpringSystem() { }
41 
42 // member functions
43 public:
44   void calculateForces(CalSubmesh *pSubmesh, float deltaTime);
45   void calculateVertices(CalSubmesh *pSubmesh, float deltaTime);
46   void update(float deltaTime);
47 
48   CalVector & getGravityVector();
49   void setGravityVector(const CalVector & vGravity);
50   CalVector & getForceVector();
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 
63 private:
64   CalModel *m_pModel;
65   CalVector m_vGravity;
66   CalVector m_vForce;
67   bool m_collision;
68 };
69 
70 #endif
71 
72 //****************************************************************************//
73