My Project
MirrorSurface.h
1 #pragma once
2 
3 namespace ParaEngine
4 {
5 
11  {
12  public:
14  virtual ~CMirrorSurface();
15 
16  ATTRIBUTE_DEFINE_CLASS(CMirrorSurface);
17 
18  public:
19 
27  void SetPosition(Vector3 vPos, bool bUseCloset=true);
28 
32  void SetPlane(const Plane& plane);
33 
37  bool IsEnabled(){return m_bEnable;};
38 
43  void SetEnabled(bool bEnabled){m_bEnable = bEnabled;};
44 
50  LPDIRECT3DTEXTURE9 GetReflectionTexture();
51  protected:
57  void SetMatrices(bool bPostPushMatrices=false, bool bPrePopMatrices=false);
58 
61  void InitDeviceObjects();
63  void RestoreDeviceObjects();
67  void DeleteDeviceObjects();
69  void Cleanup();
70 
79 
80  private:
81  // whether the mirror surface is enabled.
82  bool m_bEnable;
83  // whether device is created.
84  bool m_bInitialized;
85  // world position of the center point of the mirror, currently only y component is used.
86  Vector3 m_vPos;
87 
88  // the plane surface of the mirror.
89  Plane m_reflectionPlane;
90  float m_reflectionMapOverdraw;
91  int m_reflectionTextureWidth;
92  int m_reflectionTextureHeight;
93 
94  LPDIRECT3DSURFACE9 m_pDepthStencilSurface;
95  LPDIRECT3DTEXTURE9 m_pReflectionTexture;
96  LPDIRECT3DSURFACE9 m_pReflectionSurface;
97 
98  Matrix4 m_reflectionProjectionMatrix;
99  Matrix4 m_worldViewProjectionInverseTransposeMatrix;
100  bool m_reflectViewMatrix;
101  bool m_bDisableFogInReflection;
102 
103  friend class CSceneObject;
104  friend class COceanManager;
105  };
106 
107 }
bool IsEnabled()
Definition: MirrorSurface.h:37
void RenderReflectionTexture()
render the scene to the reflection surface if it is enabled.
Definition: MirrorSurface.cpp:179
void RestoreDeviceObjects()
restore device object
Definition: MirrorSurface.cpp:64
void InitDeviceObjects()
init device objects.
Definition: MirrorSurface.cpp:60
different physics engine has different winding order.
Definition: EventBinding.h:32
LPDIRECT3DTEXTURE9 GetReflectionTexture()
Get the reflection texture.
Definition: MirrorSurface.cpp:46
void InvalidateDeviceObjects()
Invalid device object.
Definition: MirrorSurface.cpp:88
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
void SetPlane(const Plane &plane)
a plane object usually defines the normal of the plane.
Definition: MirrorSurface.cpp:55
void DeleteDeviceObjects()
delete device objects
Definition: MirrorSurface.cpp:96
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
void SetMatrices(bool bPostPushMatrices=false, bool bPrePopMatrices=false)
set up the rendering matrices for ocean rendering.
Definition: MirrorSurface.cpp:127
Defines a plane in 3D space.
Definition: ParaPlane.h:23
void SetEnabled(bool bEnabled)
set enabled.
Definition: MirrorSurface.h:43
void SetPosition(Vector3 vPos, bool bUseCloset=true)
set the world position of the mirror.
Definition: MirrorSurface.cpp:101
A common interface for all classes implementing IAttributeFields By implementing this class's virtual...
Definition: IAttributeFields.h:59
The top level scene management class.
Definition: SceneObject.h:58
void Cleanup()
clean up all resource objects
Definition: MirrorSurface.cpp:51
a reflective plane in the scene currently it only supports horizontal surface.Vertical surface and ar...
Definition: MirrorSurface.h:10
FFT based ocean rendering class.
Definition: OceanManager.h:56