00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ANIMAL_OCTREEOCTREEPARTICLESYSTEMENGINE_H
00013 #define ANIMAL_OCTREEOCTREEPARTICLESYSTEMENGINE_H
00014
00015
00016 #include "Octree.h"
00017 #include <examples/X3DTK/particles/ParticleSystemEngine.h>
00018 #include <examples/X3DTK/particles/SpringForceField.cpp>
00019
00020
00021 #include <hash_map.h>
00022
00023 namespace animal {
00024
00025 namespace octree {
00026
00034 template<typename t_Vector, typename t_Real, typename t_Masses>
00035 class OctreeParticleSystemEngine
00036 : public Octree
00037 , public ParticleSystemEngine<t_Vector,t_Real,t_Masses>
00038 {
00039 public:
00040
00041 OctreeParticleSystemEngine(Vec3d bboxMin, Vec3d bboxMax, MFVec3f *points, MFVec3f normals, unsigned int nMaxPointsPerCell);
00042
00043 ~OctreeParticleSystemEngine();
00044
00045 virtual void move(double dt);
00046 void draw();
00047
00048
00049
00050
00051
00052
00053
00054 typedef hash_map<int, int> VerticesMap;
00055 VerticesMap _verticesMap;
00056 int preUpdateVerticesPositions(Cell * tmpCell, int *indice=new int());
00057 int preUpdateVerticesPositions2(Cell * );
00058 int postUpdateVerticesPositions();
00059
00060
00061 typedef t_Real Real;
00062 typedef t_Masses VecReal;
00063 typedef t_Vector Vector;
00064 typedef typename t_Vector::value_type Vec;
00065 typedef t_Masses Masses;
00066
00067 typedef animal::SpringForceField<Vector,VecReal,animal::vector<int> > SpringForceField;
00068
00069
00070
00071 int allLevelsPreUpdateVerticesPositions(Cell * tmpCell, int *indice=new int());
00072
00073
00074
00075 Vector _particlesPositions;
00076 Vector _particlesVelocities;
00077 Masses _particlesInvMasses;
00078
00079 typedef typename SpringForceField::VecEdges VecEdges;
00080
00081 VecEdges _springs;
00082 SpringForceField _springfield;
00083 VecReal _stiffnesses;
00084 VecReal _restLengths;
00085
00086 animal::vector<VecEdges> _allLevelsSprings;
00087 animal::vector<VecReal> _allLevelsStiffnesses;
00088 animal::vector<VecReal> _allLevelsRestLengths;
00089 };
00090
00091
00092
00093 };
00094
00095 };
00096
00097
00098 #endif