- 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 00048 CalVector & getGravityVector(); 00049 void setGravityVector(const CalVector & vGravity); 00050 CalVector & getForceVector(); 00051 void setForceVector(const CalVector & vForce); 00052 void setCollisionDetection(bool collision); 00053 00054 00055 /* DEBUG CODE ******************** 00056 struct 00057 { 00058 float x, y, z, radius; 00059 } Sphere; 00060 void setSphere(float x, float y, float z, float radius) { Sphere.x = x; Sphere.y = y; Sphere.z = z; Sphere.radius = radius; }; 00061 *********************************/ 00062 00063 private: 00064 CalModel *m_pModel; 00065 CalVector m_vGravity; 00066 CalVector m_vForce; 00067 bool m_collision; 00068 }; 00069 00070 #endif 00071 00072 //****************************************************************************//