Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogreode/demos/SimpleScenes/include/SimpleScenes.h @ 21

Last change on this file since 21 was 21, checked in by nicolasc, 16 years ago

added ogreode and Colladaplugin

File size: 2.9 KB
Line 
1/*
2SimpleScenes.h
3-------------
4A basic framework class off which the specific scenes will be built.
5Does some housekeeping of objects and so on, eventually functionality
6similar to this will be built into OgreOde.
7*/
8#ifndef _SIMPLESCENES_H_
9#define _SIMPLESCENES_H_
10
11// We'll need the OgreOde definitions
12#include "OgreOde_Core.h"
13#include "OgreOde_Prefab.h"
14#include "OgreOde_Loader.h"
15
16#if !(OGRE_VERSION <  ((1 << 16) | (3 << 8) | 0))
17#include "OIS/OIS.h"
18namespace OIS
19{
20        class Keyboard;
21        class Mouse;
22};
23#endif //OGRE_VERSION not heihort
24
25enum QueryFlags
26{
27        ANY_QUERY_MASK                                  = 1<<0,
28        ZOMBIE_QUERY_MASK                               = 1<<1,
29        GEOMETRY_QUERY_MASK                             = 1<<2,
30        VEHICLE_QUERY_MASK                              = 1<<3,
31        STATIC_GEOMETRY_QUERY_MASK              = 1<<4
32};
33/*
34The base Test class, is also able to listen for collisions and thus change the contact properties
35*/
36class SimpleScenes:public OgreOde::CollisionListener,public OgreOde::StepListener
37{
38public:
39        static const Ogre::Real KEY_DELAY;
40        static const Ogre::Real STEP_RATE;
41
42        // Constructor/destructor
43        SimpleScenes(OgreOde::World *world);
44        virtual ~SimpleScenes();
45
46        // Useful methods that will be handy for all tests
47    void createRagDoll();
48    OgreOde::Body* createRandomObject(OgreOde::Geometry::Class objectClass);
49        void updateScene();
50    const Ogre::SceneNode* getLastNode(){return _last_node;}
51    void setInfoText(const Ogre::String& text);
52
53        // The things we'll have to override in derived classes
54        // Actual tests must provide a name but everything else can default
55        virtual bool collision(OgreOde::Contact* contact);
56    virtual const Ogre::String& getKeys(){return Ogre::StringUtil::BLANK;}
57        virtual const Ogre::String& getName() = 0;
58        virtual void addForcesAndTorques(){}
59
60#if (OGRE_VERSION_MINOR <  4)
61    virtual void frameStarted(Ogre::Real time, Ogre::InputReader* input){};
62    virtual void frameEnded(Ogre::Real time, Ogre::InputReader* input);
63
64#else
65    virtual void frameStarted(Ogre::Real time, OIS::Keyboard* input, OIS::Mouse* mouse){};
66    virtual void frameEnded(Ogre::Real time, OIS::Keyboard* input, OIS::Mouse* mouse);
67
68#endif //OGRE_VERSION not heihort
69
70
71        // If we register this with a stepper it'll get told every time the world's about to be stepped
72        bool preStep(Ogre::Real time)
73        {
74                addForcesAndTorques();
75                return true;
76        }
77
78protected:
79        // Keep track of what created us
80        Ogre::SceneManager*     _mgr;
81        OgreOde::World*         _world;
82        OgreOde::Space*         _space;
83        OgreOde_Prefab::RagdollFactory*   _ragdollFactory; 
84
85        // Whatever the derived class sets this to will be what's looked at by the camera
86        Ogre::SceneNode*                        _last_node;
87
88        // Keep track of the things we create so we can
89        // delete them automatically when we switch scenes
90        std::vector<OgreOde::Body*>             _bodies;
91        std::vector<OgreOde::Geometry*> _geoms;
92    std::vector<OgreOde::Joint*>        _joints;
93
94    std::vector<Ogre::MovableObject*> clearList;
95    std::vector<OgreOde_Prefab::Ragdoll *> RagdollList;
96
97    Ogre::Real _key_delay;
98    OgreOde_Loader::DotLoader *dotOgreOdeLoader;
99};
100
101#endif
Note: See TracBrowser for help on using the repository browser.