- Cal3D 0.9 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 // member variables 00039 protected: 00040 CalVector m_vGravity; 00041 CalVector m_vForce; 00042 00043 public: 00044 CalModel *m_pModel; 00045 00046 // constructors/destructor 00047 public: 00048 CalSpringSystem(); 00049 virtual ~CalSpringSystem(); 00050 00051 // member functions 00052 public: 00053 void calculateForces(CalSubmesh *pSubmesh, float deltaTime); 00054 void calculateVertices(CalSubmesh *pSubmesh, float deltaTime); 00055 bool create(CalModel *pModel); 00056 void destroy(); 00057 void update(float deltaTime); 00058 00059 CalVector & getGravityVector(); 00060 void setGravityVector(const CalVector & vGravity); 00061 CalVector & getForceVector(); 00062 void setForceVector(const CalVector & vForce); 00063 00064 00065 /* DEBUG CODE ******************** 00066 struct 00067 { 00068 float x, y, z, radius; 00069 } Sphere; 00070 void setSphere(float x, float y, float z, float radius) { Sphere.x = x; Sphere.y = y; Sphere.z = z; Sphere.radius = radius; }; 00071 *********************************/ 00072 }; 00073 00074 #endif 00075 00076 //****************************************************************************//