ovassvepCApplication.h 2.65 KB
Newer Older
OpenViBE Posse's avatar
OpenViBE Posse committed
1 2 3 4 5
#ifndef __OpenViBEApplication_CApplication_H__
#define __OpenViBEApplication_CApplication_H__

#include "ovassvep_defines.h"

OpenViBE Posse's avatar
OpenViBE Posse committed
6
#include <openvibe/ov_all.h>
OpenViBE Posse's avatar
OpenViBE Posse committed
7
#include <toolkit/ovtk_all.h>
OpenViBE Posse's avatar
OpenViBE Posse committed
8 9 10 11

#include <Ogre.h>
#include <vector>
#include <CEGUI.h>
12
#if (CEGUI_VERSION_MAJOR > 0) || (CEGUI_VERSION_MINOR >= 8)
13 14
#include <CEGUI/RendererModules/Ogre/Renderer.h>
#else
OpenViBE Posse's avatar
OpenViBE Posse committed
15
#include <RendererModules/Ogre/CEGUIOgreRenderer.h>
16
#endif
OpenViBE Posse's avatar
OpenViBE Posse committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

#include "ovassvepICommand.h"
#include "ovassvepCBasicPainter.h"

namespace OpenViBESSVEP
{
	class CApplication : public Ogre::FrameListener, public Ogre::WindowEventListener
	{
		public:
			CApplication();
			virtual ~CApplication();

			void addCommand(ICommand* pCommand);
			virtual bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext);
			void go();

			virtual void startExperiment();
			virtual void stopExperiment();
			virtual void startFlickering() {}
			virtual void stopFlickering() {}

			Ogre::RenderWindow* getWindow()
			{
				return m_poWindow;
			}

			Ogre::SceneManager* getSceneManager()
			{
				return m_poSceneManager;
			}

			Ogre::SceneNode* getSceneNode()
			{
				return m_poSceneNode;
			}

			CBasicPainter* getPainter()
			{
				return m_poPainter;
			}

			void exit()
			{
				m_bContinueRendering = false;
			}

			OpenViBE::Kernel::ILogManager& getLogManager()
			{
				return (*m_poLogManager);
			}

			OpenViBE::Kernel::IConfigurationManager* getConfigurationManager()
			{
				return &(m_poKernelContext->getConfigurationManager());
			}

73
			std::vector<std::pair<uint32_t, uint32_t> >* getFrequencies()
OpenViBE Posse's avatar
OpenViBE Posse committed
74 75 76 77 78 79 80 81 82 83 84
			{
				return &m_oFrequencies;
			}

			void resizeViewport();


		protected:
			OpenViBE::Kernel::IKernelContext* m_poKernelContext;
			OpenViBE::Kernel::ILogManager* m_poLogManager;

85
			double m_f64ScreenRefreshRate;
OpenViBE Posse's avatar
OpenViBE Posse committed
86 87 88
			CBasicPainter* m_poPainter;

			bool m_bContinueRendering;
89
			uint32_t m_ui32CurrentFrame;
OpenViBE Posse's avatar
OpenViBE Posse committed
90 91 92 93 94 95 96 97 98 99 100 101

			Ogre::Root* m_poRoot;
			Ogre::SceneManager* m_poSceneManager;
			Ogre::Camera* m_poCamera;
			Ogre::RenderWindow* m_poWindow;
			Ogre::Viewport* m_poViewport;
			Ogre::SceneNode* m_poSceneNode;

			CEGUI::OgreRenderer* m_roGUIRenderer;
			CEGUI::WindowManager* m_poGUIWindowManager;
			CEGUI::Window* m_poSheet;

102
			std::vector<std::pair<uint32_t, uint32_t> > m_oFrequencies;
OpenViBE Posse's avatar
OpenViBE Posse committed
103 104 105

			std::vector<ICommand*> m_oCommands;

106
			virtual void processFrame(uint32_t ui32CurrentFrame);
OpenViBE Posse's avatar
OpenViBE Posse committed
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127

			bool frameRenderingQueued(const Ogre::FrameEvent &evt);
			bool frameStarted(const Ogre::FrameEvent &evt);

			bool configure();
			void setupResources();


		private:
			void initCEGUI(const char *logFileName);
			Ogre::uint32 m_ui32WindowWidth;
			Ogre::uint32 m_ui32WindowHeight;


	};



}

#endif // __OpenViBEApplication_CApplication_H__