00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00034 #ifndef __SO3WINDOW_H__
00035 #define __SO3WINDOW_H__
00036
00037 #include "../SCOLBasic/SO3Std.h"
00038 #include "../SCOLBasic/SO3DataScol.h"
00039 #include "StereoManager.h"
00040 #include "../SO3Utils/SO3RayCast.h"
00041
00042 namespace SO3
00043 {
00044
00045 class SWindow : public Ogre::WindowEventListener, public Ogre::RenderTargetListener, public SData
00046 {
00047 public:
00048
00049 enum StereoMode
00050 {
00051 SO3_NONE_STEREO = 0,
00052 SO3_ANAGLYPH_RC_STEREO = 1,
00053 SO3_ANAGLYPH_YB_STEREO = 2,
00054 SO3_DUALOUTPUT_STEREO = 3,
00055 SO3_INTERLACED_V_STEREO = 4,
00056 SO3_INTERLACED_H_STEREO = 5,
00057 SO3_INTERLACED_CB_STEREO = 6
00058 };
00059
00060
00061 protected:
00062 private:
00063 SRoot* scolRoot;
00064 SViewPortList listOfViewPort;
00065 Ogre::RenderWindow* O3Window;
00066 WindowHandle hwnd;
00067 LONG_PTR hwndFullscreenOgre;
00068 LONG_PTR styleFullscreenOgre;
00069 LONG_PTR exstyleFullscreenOgre;
00070 WINDOWPLACEMENT mLastPos;
00071 Ogre::StereoManager* O3StereoManager;
00072 StereoMode currentStereoMode;
00073 SSubEntitySelectorBuffer* subEntitySelector;
00074 SRaycastResult lastRaycast;
00075 bool bBeginFrame;
00076
00077 public:
00081 SWindow(SRoot* parent, WindowHandle windowHandle, std::string windowName, int width, int height, std::string fsaa);
00082
00085 const Ogre::RenderWindow* GetOgreRenderWindowPointer();
00086
00090 ~SWindow();
00091
00094 SRoot* GetParentRoot();
00095
00098 WindowHandle GetWindowHandle();
00099
00102 void RefreshSelector();
00103
00107 SViewPort* CreateViewport(SCamera* camera, int priority, float x, float y, float w, float h);
00108
00112 void DeleteViewport(SViewPort* existingViewport);
00113
00117 const SViewPortList& GetViewportList() const;
00118
00122 SViewPort* GetViewport(int priority) const;
00123
00127 SViewPort* GetViewport(int x, int y);
00128
00131 void windowMoved(Ogre::RenderWindow* rw);
00132
00135 void windowResized(Ogre::RenderWindow* rw);
00136
00139 void windowClosed(Ogre::RenderWindow* rw);
00140
00143 void windowFocusChange(Ogre::RenderWindow* rw);
00144
00147 int Size(int x, int y, int w, int h, int ext);
00148
00151 void WindowMovedOrResized();
00152
00155 unsigned int GetWidth() const;
00156
00159 unsigned int GetHeight() const;
00160
00163 int GetLeft();
00164
00167 int GetTop();
00168
00171 bool GetFullScreen();
00172
00176 bool SetFullScreen(bool fullscreen, int width, int height);
00177
00180 bool CheckVideoMode(int width, int height);
00181
00184 unsigned int GetColorDepth();
00185
00189 void Update();
00190
00194 unsigned int GetBatchCount() const;
00195
00199 unsigned int GetTriangleCount() const;
00200
00204 float GetBestFrameTime() const;
00205
00209 float GetWorstFrameTime() const;
00210
00214 float GetBestFPS() const;
00215
00216
00217
00218
00219 float GetWorstFPS() const;
00220
00224 float GetAverageFPS() const;
00225
00229 unsigned int GetFSAA() const;
00230
00234 void SetStereoMode(StereoMode stereoMode, float eyesSpacing, float focalLength=-1.0f);
00235
00238 StereoMode GetStereoMode();
00239
00242 float GetStereoEyesSpacing();
00243
00246 void SetStereoEyesSpacing(float eyesSpacing);
00247
00251 float GetStereoFocalLength();
00252
00256 void SetStereoFocalLength(float focalLength);
00257
00260 SRaycastResult RayCast(int pixelsX, int pixelsY);
00261
00264 SRaycastResult& GetLastRayCast();
00265
00268 void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
00269
00272 void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
00273 protected:
00277 void AddViewport(SViewPort* existingViewport);
00278
00282 void RemoveViewport(SViewPort* existingViewport);
00283 private:
00287 SWindow();
00288 };
00289
00290 }
00291
00292 #endif