Cyclone Cyclone: C:/data/physeng_code/include/cyclone/pworld.h Source File

C:/data/physeng_code/include/cyclone/pworld.h

Go to the documentation of this file.
00001 /*
00002  * Interface file for the particle / mass aggregate world structure.
00003  *
00004  * Part of the Cyclone physics system.
00005  *
00006  * Copyright (c) Icosagon 2003. All Rights Reserved.
00007  *
00008  * This software is distributed under licence. Use of this software
00009  * implies agreement with all terms and conditions of the accompanying
00010  * software licence.
00011  */
00012 
00019 #ifndef CYCLONE_PWORLD_H
00020 #define CYCLONE_PWORLD_H
00021 
00022 #include "pfgen.h"
00023 #include "plinks.h"
00024 
00025 namespace cyclone {
00026 
00028 
00032         class ParticleWorld
00033         {
00034         public:
00035                 typedef std::vector<Particle*> Particles;
00036                 typedef std::vector<ParticleContactGenerator*> ContactGenerators;
00037 
00038         protected:
00042                 Particles particles;
00043 
00048         bool calculateIterations;
00049 
00053         ParticleForceRegistry registry;
00054 
00058         ParticleContactResolver resolver;
00059 
00063                 ContactGenerators contactGenerators;
00064 
00068         ParticleContact *contacts;
00069 
00074         unsigned maxContacts;
00075 
00077         public:
00079 
00087                 ParticleWorld(unsigned maxContacts, unsigned iterations=0);
00089 
00091 
00095         unsigned generateContacts();
00096 
00101         void integrate(real duration);
00102 
00106         void runPhysics(real duration);
00108 
00110 
00116         void startFrame();
00117 
00121                 Particles& getParticles();
00122 
00126                 ContactGenerators& getContactGenerators();
00127 
00131                 ParticleForceRegistry& getForceRegistry();
00132 
00133 
00134 
00135 
00137         };
00139 
00144         class GroundContacts : public cyclone::ParticleContactGenerator
00145         {
00146                 cyclone::ParticleWorld::Particles *particles;
00147 
00148         public:
00149                 void init(cyclone::ParticleWorld::Particles *particles);
00150 
00151                 virtual unsigned addContact(cyclone::ParticleContact *contact,
00152                         unsigned limit) const;
00153         };
00154 
00155 } // namespace cyclone
00156 
00157 #endif // CYCLONE_PWORLD_H