raSystem  1.0 bata
raSceneManager.h
Go to the documentation of this file.
1 #pragma once
2 
3  class raRenderScreen;
4  class raTexturedMaterial;
5  class raSound;
6 
8  {
9  public:
11  ~raSceneManager(void);
12 
13  bool Add(raRender* Object);
14  bool Remove(raRender* Object);
15  bool RemoveAt(int i);
16 
17  void SetupEffectVariables(const raMatrix& pView, const raMatrix& pProj);
18  void SetupLights(ID3DX11Effect* pEffect, const raLight* pLight);
19  void Render(const raMatrix& pView, const raMatrix &pProj, const raLight* pLight, LPCSTR techniqueName = "");
20 
21  virtual bool Create(raSmartPointer<raDirectX> dx);
22  virtual void Destroy();
23  virtual void Render();
24  virtual void Update(float fTime, float fRunTime);
25 
26  int GetNumItems() { return (UINT)m_Visuals.size(); }
27  raRender* GetItem(int index);
28  raVector3 GetLightPosition() { return m_Light.m_Position; }
29 
30  void SetLightDirection(const raVector3& Dir) { m_Light.m_Direction = Dir; }
31  void SetLightAmbientColor(const raColor& Amb) { m_Light.m_AmbientColor = Amb; }
32  void SetLightDiffuseColor(const raColor& Dif) { m_Light.m_DiffuseColor = Dif; }
33  void SetLightPosition(const raVector3& Pos) { m_Light.m_Position = Pos; }
34  void ShowAllObjects(bool show);
35 
36  void RenderToTexture(raRenderScreen& renderScreen);
37  void RenderToTextureWithGlobalMaterial(raRenderScreen& renderScreen,LPCSTR techniqueName = "");
38  void RenderToCubeMap(raRenderScreen& renderScreen, raMatrix& worldCenter);
39  void RenderToLightMap();
40  void RenderToLightMap(raRenderScreen& renderScreen);
41 
42  void TranslateObject(LPCSTR objectName, float x, float y, float z){};
43  void RotateObjectY(LPCSTR objectName, float angle){};
44 
45  void SetLightProjParams(float fFOV, float fAspect, float fNearPlane, float fFarPlane)
46  {
47  m_Light.SetProjParams(fFOV, fAspect, fNearPlane, fFarPlane);
48  }
50  {
51  m_Camera = pCamera;
52  }
53  void SetLightPosition(int no, float x, float y, float z)
54  {
55  m_Lights[no]->m_Position = raVector3(x, y, z);
56  };
57 
58  void SetLightDirection(int no, float x, float y, float z)
59  {
60  m_Lights[no]->m_Direction = raVector3(x, y, z);
61  };
62 
63  void SetLightAmbientColor(int no, float x, float y, float z)
64  {
65  m_Lights[no]->m_AmbientColor = COLOR_XRGB(x, y, z);
66  };
67 
68  void SetLightDiffuseColor(int no, float x, float y, float z)
69  {
70  m_Lights[no]->m_DiffuseColor = COLOR_XRGB(x, y, z);
71  };
72 
73  private:
74  void CreateCubeMapMatrices();
75  void SetViewport(D3D11_VIEWPORT* pOldVP, UINT width, UINT height);
76  void RenderToTexture(ID3D11RenderTargetView* pRTView, ID3D11DepthStencilView* pDSView,
77  UINT width, UINT height);
78  void RenderToTexture(ID3D11RenderTargetView* pRTView, ID3D11DepthStencilView* pDSView = NULL);
79  void RenderToCubeMap(ID3D11RenderTargetView* pRTView, ID3D11DepthStencilView* pDSView,
80  UINT width, UINT height, raMatrix& worldCenter);
81 
82  void RenderToTextureWithGlobalMaterial( ID3D11RenderTargetView* pRTView, ID3D11DepthStencilView* pDSView,
83  UINT width, UINT height,
84  LPCSTR techniqueName = "");
85  void RenderToLightMap(ID3D11RenderTargetView* pRTView,
86  ID3D11DepthStencilView* pDSView,
87  UINT width, UINT height);
88 
89  private:
91  bool m_bCreated;
92 
93  std::vector<raRender*> m_Visuals;
94  raSmartPointer<raCamera> m_Camera;
95  static const int numLights = 5;
96  raLight* m_Lights[numLights]; //Hier können mehrere Lichtquellen eingefügt werden
97  raLight m_Light; //Standardlichtquelle
98 
99  raMatrix m_CubeMapViewAdjust[6];
100  raMatrix m_ProjCM;
101  raTexturedMaterial* m_pShadowReceiverMaterial;
102  };
Definition: raLight.h:5
void SetLightPosition(int no, float x, float y, float z)
void SetLightProjParams(float fFOV, float fAspect, float fNearPlane, float fFarPlane)
#define RAPI
Definition: raMain.h:11
void SetLightDirection(int no, float x, float y, float z)
void SetCamera(raSmartPointer< raCamera > pCamera)
void RotateObjectY(LPCSTR objectName, float angle)
Definition: raColor.h:5
#define COLOR_XRGB(r, g, b)
Definition: raMain.h:133
raVector3 GetLightPosition()
void SetLightAmbientColor(int no, float x, float y, float z)
interface ID3DX11Effect ID3DX11Effect
void TranslateObject(LPCSTR objectName, float x, float y, float z)
void SetLightAmbientColor(const raColor &Amb)
void SetLightDirection(const raVector3 &Dir)
void SetLightDiffuseColor(int no, float x, float y, float z)
void SetLightDiffuseColor(const raColor &Dif)
void SetLightPosition(const raVector3 &Pos)