taoGroup.h

Go to the documentation of this file.
00001 /* Copyright (c) 2005 Arachi, Inc. and Stanford University.
00002  *
00003  * Permission is hereby granted, free of charge, to any person obtaining
00004  * a copy of this software and associated documentation files (the
00005  * "Software"), to deal in the Software without restriction, including
00006  * without limitation the rights to use, copy, modify, merge, publish,
00007  * distribute, sublicense, and/or sell copies of the Software, and to
00008  * permit persons to whom the Software is furnished to do so, subject
00009  * to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included
00012  * in all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00016  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00017  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00018  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00019  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00020  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00021  */
00022 
00023 #ifndef _taoGroup_h
00024 #define _taoGroup_h
00025 
00026 #include "taoTypes.h"
00027 #include "deMath.h"
00028 
00029 class taoDNode;
00030 class taoNode;
00031 class taoNodeRoot;
00032 
00042 class taoGroup
00043 {
00044 public:
00045         taoGroup() : _id(-1), _isFixed(0), _rootList(NULL), _next(NULL) { _gravity.zero(); }
00046         ~taoGroup();
00047 
00048         void setID(deInt i) { _id = i; }
00049         const deInt getID() const { return _id; }
00050 
00051         void setIsFixed(int f) { _isFixed = f; }
00052         deInt getIsFixed() { return _isFixed; }
00053 
00054         deVector3* gravity() { return &_gravity; }
00055 
00056         void setNext(taoGroup* g) { _next = g; }
00057         taoGroup* getNext() { return _next; }
00058 
00059         taoNodeRoot* getRootList() { return _rootList; }
00060         void addRoot(taoNodeRoot* r, const deInt id);
00061         taoNodeRoot* removeRoot(const deInt id);
00062         taoNodeRoot* findRoot(const deInt id);
00063 
00064         void update(const deFloat time, const deFloat dt, const deInt n);
00065         void control(const deFloat time);
00066         void simulate(const deFloat dt);
00067         void updateTransformation();
00068 
00069         taoNodeRoot* unlinkFixed(taoNodeRoot* root, taoNode* node);
00070         taoNodeRoot* unlinkFree(taoNodeRoot* root, taoNode* node, deFloat inertia, deFloat damping);
00071 
00072         void sync(taoNodeRoot* root, deFloat time);
00073 
00074 private:
00075         deInt _id;
00076         deInt _isFixed;
00077         deVector3 _gravity;
00078         taoNodeRoot* _rootList;
00079         taoGroup* _next;
00080 };
00081 
00082 #endif // _taoGroup_h

Generated on Sun Apr 9 22:12:43 2006 for TAO by  doxygen 1.4.6-NO