My Project
ViewportManager.h
1 #pragma once
2 #include "IAttributeFields.h"
3 #include "ViewportManager.h"
4 #include "Viewport.h"
5 
6 namespace ParaEngine
7 {
8  enum VIEWPORT_LAYOUT {
9  VIEW_LAYOUT_DEFAULT,
10  VIEW_LAYOUT_STEREO_LEFT_RIGHT,
11  VIEW_LAYOUT_STEREO_UP_DOWN,
12  VIEW_LAYOUT_STEREO_RED_BLUE,
13  VIEW_LAYOUT_INVALID,
14  };
15 
19  {
20  public:
22  virtual ~CViewportManager(void);
23 
24  ATTRIBUTE_DEFINE_CLASS(CViewportManager);
26  virtual int InstallFields(CAttributeClass* pClass, bool bOverride);
27 
29  virtual IAttributeFields* GetChildAttributeObject(const std::string& sName);
30 
32  virtual int GetChildAttributeObjectCount(int nColumnIndex = 0);
33  virtual IAttributeFields* GetChildAttributeObject(int nRowIndex, int nColumnIndex = 0);
34 
35  public:
37  void UpdateViewport(int nBackbufferWidth, int nBackbufferHeight);
38 
40  HRESULT Render(double dTimeDelta, int nPipelineOrder);
41 
46  void GetPointOnViewport(int& x, int& y, int* pWidth, int* pHeight);
47 
48  CViewport* GetViewportByPoint(int x, int y);
49 
51  void SetLayout(VIEWPORT_LAYOUT nLayout, CSceneObject* pMainScene = NULL, CGUIRoot* pGUIRoot = NULL);
52  VIEWPORT_LAYOUT GetLayout();
53 
55  void UpdateLayout();
56 
57  int GetViewportCount();
58  void SetViewportCount(int nCount);
59 
62  public:
66  CViewport* CreateGetViewPort(int nIndex = 1);
67 
68  CViewport* GetActiveViewPort();
69  void SetActiveViewPortIndex(int val);
70  void SetActiveViewPort(CViewport* pViewport);
71 
72  void DeleteViewPort(int nIndex=0);
73 
74  void Cleanup();
75 
76  int GetWidth() const;
77  int GetHeight() const;
78 
79  void ApplyViewport();
80 
81  int getCurrentFrameNumber()const
82  {
83  return m_nCurrentFrameNumber;
84  }
85  private:
86  void SortViewport();
87  private:
89  std::vector<CViewport*> m_viewportList;
90  std::vector<CViewport*> m_viewportSorted;
91 
92  ParaViewport m_viewport;
93  int m_nWidth;
94  int m_nHeight;
95  int m_nActiveViewPortIndex;
96  VIEWPORT_LAYOUT m_nLayout;
97  int m_nCurrentFrameNumber;
98  };
99 
100 }
101 
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
CViewport * CreateGetViewPort(int nIndex=1)
add view port
Definition: ViewportManager.cpp:54
virtual IAttributeFields * GetChildAttributeObject(const std::string &sName)
get attribute by child object.
Definition: ViewportManager.cpp:333
different physics engine has different winding order.
Definition: EventBinding.h:32
virtual int GetChildAttributeObjectCount(int nColumnIndex=0)
get the number of child objects (row count) in the given column.
Definition: ViewportManager.cpp:328
void SetLayout(VIEWPORT_LAYOUT nLayout, CSceneObject *pMainScene=NULL, CGUIRoot *pGUIRoot=NULL)
set default view layout
Definition: ViewportManager.cpp:205
Definition: ParaViewport.h:5
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: ViewportManager.cpp:348
a region of view port to render into.
Definition: Viewport.h:21
void GetPointOnViewport(int &x, int &y, int *pWidth, int *pHeight)
Definition: ViewportManager.cpp:128
A common interface for all classes implementing IAttributeFields By implementing this class&#39;s virtual...
Definition: IAttributeFields.h:59
The top level scene management class.
Definition: SceneObject.h:58
HRESULT Render(double dTimeDelta, int nPipelineOrder)
render all view ports
Definition: ViewportManager.cpp:103
manager multiple viewport
Definition: ViewportManager.h:18
void UpdateLayout()
just in case the size changed.
Definition: ViewportManager.cpp:183
void GetCurrentViewport(ParaViewport &out)
get current viewport
Definition: ViewportManager.cpp:323
void UpdateViewport(int nBackbufferWidth, int nBackbufferHeight)
call this function when the window size and screen back buffer size is changed
Definition: ViewportManager.cpp:32
When rendering scene, root scene and the root GUI are rendered in sequence.
Definition: GUIRoot.h:48