| - Cal3D 0.11 API Reference - |
00001 //****************************************************************************// 00002 // springsystem.h // 00003 // Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger // 00004 //****************************************************************************// 00005 // This library is free software; you can redistribute it and/or modify it // 00006 // under the terms of the GNU Lesser General Public License as published by // 00007 // the Free Software Foundation; either version 2.1 of the License, or (at // 00008 // your option) any later version. // 00009 //****************************************************************************// 00010 00011 #ifndef CAL_SPRINGSYSTEM_H 00012 #define CAL_SPRINGSYSTEM_H 00013 00014 //****************************************************************************// 00015 // Includes // 00016 //****************************************************************************// 00017 00018 #include "cal3d/global.h" 00019 #include "cal3d/vector.h" 00020 00021 //****************************************************************************// 00022 // Forward declarations // 00023 //****************************************************************************// 00024 00025 class CalModel; 00026 class CalSubmesh; 00027 00028 //****************************************************************************// 00029 // Class declaration // 00030 //****************************************************************************// 00031 00032 /*****************************************************************************/ 00036 class CAL3D_API CalSpringSystem 00037 { 00038 public: 00039 CalSpringSystem(CalModel *pModel); 00040 ~CalSpringSystem() { } 00041 00042 // member functions 00043 public: 00044 void calculateForces(CalSubmesh *pSubmesh, float deltaTime); 00045 void calculateVertices(CalSubmesh *pSubmesh, float deltaTime); 00046 void update(float deltaTime); 00047 void resetPositions(); 00048 00049 const CalVector & getGravityVector() const; 00050 void setGravityVector(const CalVector & vGravity); 00051 const CalVector & getForceVector() const; 00052 void setForceVector(const CalVector & vForce); 00053 void setCollisionDetection(bool collision); 00054 00055 00056 /* DEBUG CODE ******************** 00057 struct 00058 { 00059 float x, y, z, radius; 00060 } Sphere; 00061 void setSphere(float x, float y, float z, float radius) { Sphere.x = x; Sphere.y = y; Sphere.z = z; Sphere.radius = radius; }; 00062 *********************************/ 00063 00064 private: 00065 CalModel *m_pModel; 00066 CalVector m_vGravity; 00067 CalVector m_vForce; 00068 bool m_collision; 00069 }; 00070 00071 #endif 00072 00073 //****************************************************************************//