Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 14, 2008, 7:08:36 PM (15 years ago)
Author:
rgrieder
Message:
  • orxonox::Scene should work properly with XMLPort and network synchronisation, no matter what input. No guarantee of course ;)
  • If you disable physics completely and then reactivate it, all rigid bodies that were removed will be added again.
  • new XML attributes: gravity, negativeWorldRange and positiveWorldRange
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics_merge/src/orxonox/objects/Scene.h

    r2442 r2446  
    2222 *   Author:
    2323 *      Fabian 'x3n' Landau
     24 *      Reto Grieder (physics)
    2425 *   Co-authors:
    2526 *      ...
     
    5354                { return this->rootSceneNode_; }
    5455
    55             inline btDiscreteDynamicsWorld* getPhysicalWorld() const
    56                 { return this->physicalWorld_; }
    57 
    5856            void setSkybox(const std::string& skybox);
    5957            inline const std::string& getSkybox() const
     
    6866                { return this->bShadows_; }
    6967
    70             inline bool hasPhysics()
    71                 { return this->physicalWorld_ != 0; }
    72             void setPhysicalWorld(bool wantsPhysics);//, const Vector3& worldAabbMin, const Vector3& worldAabbMax);
    73 
    74             void addRigidBody(btRigidBody* body);
    75             void removeRigidBody(btRigidBody* body);
    76 
    7768            virtual void tick(float dt);
    7869
     
    8576            void networkcallback_applyAmbientLight()
    8677                { this->setAmbientLight(this->ambientLight_); }
    87             void networkcallback_hasPhysics()
    88                 { this->setPhysicalWorld(this->bHasPhysics_); }
    8978
    9079            Ogre::SceneManager*      sceneManager_;
    9180            Ogre::SceneNode*         rootSceneNode_;
    92 
    93             btDiscreteDynamicsWorld* physicalWorld_;
    94             std::set<btRigidBody*>   physicsQueue_;
    95             bool                     bHasPhysics_;
    9681
    9782            std::string              skybox_;
     
    9984            std::list<BaseObject*>   objects_;
    10085            bool                     bShadows_;
     86
     87
     88        /////////////
     89        // Physics //
     90        /////////////
     91
     92        public:
     93            inline bool hasPhysics()
     94                { return this->physicalWorld_ != 0; }
     95            void setPhysicalWorld(bool wantsPhysics);
     96
     97            void setNegativeWorldRange(const Vector3& range);
     98            inline const Vector3& getNegativeWorldRange() const
     99                { return this->negativeWorldRange_; }
     100
     101            void setPositiveWorldRange(const Vector3& range);
     102            inline const Vector3& getPositiveWorldRange() const
     103                { return this->positiveWorldRange_; }
     104
     105            void setGravity(const Vector3& gravity);
     106            inline const Vector3& getGravity() const
     107                { return this->gravity_; }
     108
     109            void addPhysicalObject(WorldEntity* object);
     110            void removePhysicalObject(WorldEntity* object);
     111
     112        private:
     113            inline void networkcallback_hasPhysics()
     114                { this->setPhysicalWorld(this->bHasPhysics_); }
     115            inline void networkcallback_negativeWorldRange()
     116                { this->setNegativeWorldRange(this->negativeWorldRange_); }
     117            inline void networkcallback_positiveWorldRange()
     118                { this->setPositiveWorldRange(this->positiveWorldRange_); }
     119            inline void networkcallback_gravity()
     120                { this->setGravity(this->gravity_); }
     121
     122            // Bullet objects
     123            btDiscreteDynamicsWorld*             physicalWorld_;
     124            bt32BitAxisSweep3*                   broadphase_;
     125            btDefaultCollisionConfiguration*     collisionConfig_;
     126            btCollisionDispatcher*               dispatcher_;
     127            btSequentialImpulseConstraintSolver* solver_;
     128
     129            std::set<WorldEntity*>               physicalObjectQueue_;
     130            std::set<WorldEntity*>               physicalObjects_;
     131            bool                                 bHasPhysics_;
     132            Vector3                              negativeWorldRange_;
     133            Vector3                              positiveWorldRange_;
     134            Vector3                              gravity_;
    101135    };
    102136}
Note: See TracChangeset for help on using the changeset viewer.