00001 //=========================================================================== 00002 /* 00003 This file is part of the GEL dynamics engine. 00004 Copyright (C) 2003-2009 by Francois Conti, Stanford University. 00005 All rights reserved. 00006 00007 \author <http://www.chai3d.org> 00008 \author Francois Conti 00009 \version 2.0.0 $Rev: 251 $ 00010 */ 00011 //=========================================================================== 00012 00013 //--------------------------------------------------------------------------- 00014 #ifndef CGELMeshH 00015 #define CGELMeshH 00016 //--------------------------------------------------------------------------- 00017 #include "CGELSkeletonNode.h" 00018 #include "CGELSkeletonLink.h" 00019 #include "CGELLinearSpring.h" 00020 #include "CGELVertex.h" 00021 #include "chai3d.h" 00022 #include <typeinfo> 00023 #include <vector> 00024 #include <list> 00025 //--------------------------------------------------------------------------- 00026 using std::vector; 00027 //--------------------------------------------------------------------------- 00028 00029 //=========================================================================== 00037 //=========================================================================== 00038 00039 //=========================================================================== 00048 //=========================================================================== 00049 class cGELMesh : public cMesh 00050 { 00051 00052 public: 00053 00054 //----------------------------------------------------------------------- 00055 // CONSTRUCTOR & DESTRUCTOR: 00056 //----------------------------------------------------------------------- 00057 00059 cGELMesh(cWorld* a_world):cMesh(a_world){ initialise(); }; 00060 00062 virtual ~cGELMesh() {}; 00063 00064 00065 //----------------------------------------------------------------------- 00066 // METHODS: 00067 //----------------------------------------------------------------------- 00068 00070 void buildVertices(); 00071 00073 void connectVerticesToSkeleton(bool a_connectToNodesOnly); 00074 00076 void updateVertexPosition(); 00077 00079 void clearForces(); 00080 00082 void clearExternalForces(); 00083 00085 void computeForces(); 00086 00088 void computeNextPose(double iTimeInterval); 00089 00091 void applyNextPose(); 00092 00094 virtual void render(const int a_renderMode=CHAI_RENDER_MODE_RENDER_ALL); 00095 00096 00097 //----------------------------------------------------------------------- 00098 // MEMBERS: 00099 //----------------------------------------------------------------------- 00100 00102 list<cGELSkeletonNode*> m_nodes; 00103 00105 list<cGELSkeletonLink*> m_links; 00106 00108 list<cGELLinearSpring*> m_linearSprings; 00109 00111 vector<cGELVertex> m_gelVertices; 00112 00114 bool m_showSkeletonModel; 00115 00117 bool m_showMassParticleModel; 00118 00120 bool m_useSkeletonModel; 00121 00123 bool m_useMassParticleModel; 00124 00125 00126 private: 00127 00128 //----------------------------------------------------------------------- 00129 // METHODS: 00130 //----------------------------------------------------------------------- 00131 00133 void initialise(); 00134 }; 00135 00136 //--------------------------------------------------------------------------- 00137 #endif 00138 //---------------------------------------------------------------------------