~ubuntu-branches/debian/sid/ember/sid

« back to all changes in this revision

Viewing changes to src/components/ogre/OpcodeCollisionDetectorVisualizer.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2009-07-23 07:46:40 UTC
  • Revision ID: james.westby@ubuntu.com-20090723074640-wh0ukzis0kda36qv
Tags: upstream-0.5.6
ImportĀ upstreamĀ versionĀ 0.5.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// C++ Interface: OpcodeCollisionDetectorVisualizer
 
3
//
 
4
// Description: 
 
5
//
 
6
//
 
7
// Author: Erik Hjortsberg <erik.hjortsberg@gmail.com>, (C) 2007
 
8
//
 
9
// This program is free software; you can redistribute it and/or modify
 
10
// it under the terms of the GNU General Public License as published by
 
11
// the Free Software Foundation; either version 2 of the License, or
 
12
// (at your option) any later version.
 
13
// 
 
14
// This program is distributed in the hope that it will be useful,
 
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
// GNU General Public License for more details.
 
18
// 
 
19
// You should have received a copy of the GNU General Public License
 
20
// along with this program; if not, write to the Free Software
 
21
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.//
 
22
//
 
23
#ifndef EMBEROGREOPCODECOLLISIONDETECTORVISUALIZER_H
 
24
#define EMBEROGREOPCODECOLLISIONDETECTORVISUALIZER_H
 
25
 
 
26
#include "framework/Singleton.h"
 
27
#include <Ogre.h>
 
28
 
 
29
namespace OgreOpcode
 
30
{
 
31
        class CollisionObject;
 
32
        namespace Details 
 
33
        {
 
34
                class OgreOpcodeDebugger;
 
35
        }
 
36
};
 
37
 
 
38
namespace EmberOgre {
 
39
 
 
40
class OpcodeCollisionDetector;
 
41
class OpcodeCollisionDetectorVisualizerInstance;
 
42
 
 
43
/**
 
44
Helps with visualizing the collision objects. Create and register instances of OpcodeCollisionDetectorVisualizerInstance to visualize entities.
 
45
@see OpcodeCollisionDetectorVisualizerInstance
 
46
*/
 
47
class OpcodeCollisionDetectorVisualizer : public Ember::Singleton<OpcodeCollisionDetectorVisualizer>, public Ogre::FrameListener
 
48
{
 
49
public:
 
50
        friend class OpcodeCollisionDetectorVisualizerInstance;
 
51
        /**
 
52
         *    Default ctor.
 
53
         */
 
54
        OpcodeCollisionDetectorVisualizer();
 
55
        virtual ~OpcodeCollisionDetectorVisualizer();
 
56
        /**
 
57
         * Methods from Ogre::FrameListener
 
58
         */
 
59
        virtual bool frameStarted(const Ogre::FrameEvent& event);
 
60
        
 
61
        /**
 
62
         *    Registers an instance of OpcodeCollisionDetectorVisualizerInstance to be rendered each frame.
 
63
         * @param instance An instance of OpcodeCollisionDetectorVisualizerInstance which in turn points to an instance of EmberPhysicalEntity.
 
64
         */
 
65
        void addInstance(OpcodeCollisionDetectorVisualizerInstance* instance);
 
66
        /**
 
67
         *    Removes an instance of OpcodeCollisionDetectorVisualizerInstance which will no longer be rendered each frame.
 
68
         * @param instance An instance of OpcodeCollisionDetectorVisualizerInstance which in turn points to an instance of EmberPhysicalEntity.
 
69
         */
 
70
        void removeInstance(OpcodeCollisionDetectorVisualizerInstance* instance);
 
71
protected:
 
72
        typedef std::vector<OpcodeCollisionDetectorVisualizerInstance*> VisualizerInstanceStore;
 
73
        
 
74
        /**
 
75
        * The debugger object responsible for rendering.
 
76
        */
 
77
        OgreOpcode::Details::OgreOpcodeDebugger* mOpcodeDebugger;
 
78
        
 
79
        /**
 
80
        * All the registered instances which will be rendered each frame.
 
81
        */
 
82
        VisualizerInstanceStore mInstances;
 
83
};
 
84
 
 
85
class OpcodeCollisionDetectorVisualizerInstance 
 
86
{
 
87
public:
 
88
        OpcodeCollisionDetectorVisualizerInstance(OpcodeCollisionDetector& detector);
 
89
        virtual ~OpcodeCollisionDetectorVisualizerInstance();
 
90
        
 
91
        /**
 
92
         * Called each frame by OpcodeCollisionDetectorVisualizer to let the object tell the debugger how to render this instance.
 
93
         * @param debugger 
 
94
         */
 
95
        void visualize(OgreOpcode::Details::OgreOpcodeDebugger* debugger);
 
96
 
 
97
protected:
 
98
        OpcodeCollisionDetector& mDetector;
 
99
};
 
100
 
 
101
}
 
102
 
 
103
#endif