My Project
3DCanvas.h
1 #pragma once
2 #include "BaseObject.h"
3 #include "CanvasCamera.h"
4 #include "TextureEntity.h"
5 
6 namespace ParaEngine
7 {
11  class C3DCanvas :public CBaseObject
12  {
13  public:
14  C3DCanvas(void);
15  virtual ~C3DCanvas(void);
16 
17  public:
20  void InitDeviceObjects();
22  void RestoreDeviceObjects();
26  void DeleteDeviceObjects();
28  void Cleanup();
29 
30 
36 
42  void GetTextureSize(int& nWidth, int& nHeight){
43  nWidth = m_nTextureWidth;
44  nHeight = m_nTextureHeight;
45  };
49  void Draw(float fDeltaTime);
50 
57  void SaveToFile(const char* sFileName, int nImageSize = 0);
58 
63  void Zoom(float fAmount);
65  void ZoomAll();
66 
67  //rotate the 3d object, in radius
74  void Rotate(float dx, float dy, float dz);
75 
81  void Pan(float dx, float dy);
82 
85 
91  void SetSize(int nWidth, int nHeight);
92 
98  void SetBindingGroupID(int nGroupID){m_nBindedGroupID = nGroupID;};
99 
103  void SetEnabled(bool bEnable){ m_bEnabled = bEnable; };
108  bool IsEnabled(){ return m_bEnabled; };
109 
113  void SetMaskTexture(TextureEntity* pTexture);
114 
115  private:
120  void SetActor(CBaseObject * pActor);
121 
123  CBaseObject * m_pActor;
124 
128  int m_nBindedGroupID;
129 
131  DVector3 m_vActorPosition;
132 
134  float m_fActorFacing;
135 
136  CCanvasCamera m_camera;
137  bool m_bAutoRotate;
138  // whether device is created.
139  bool m_bInitialized;
140 
141  // whether the canvas need to be updated.
142  bool m_bNeedUpdate;
143  int m_nTextureWidth;
144  int m_nTextureHeight;
145  bool m_bEnabled;
146 
147  LPDIRECT3DSURFACE9 m_pDepthStencilSurface;
148 
150  asset_ptr<TextureEntity> m_canvasTexture;
151  LPDIRECT3DSURFACE9 m_pCanvasSurface;
152 
154  asset_ptr<TextureEntity> m_pMask;
155  };
156 
157 }
void Draw(float fDeltaTime)
render the object to the canvas texture surface if it is enabled.
Definition: 3DCanvas.cpp:307
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
void Pan(float dx, float dy)
pan the camera
Definition: 3DCanvas.cpp:153
Used for viewing objects on 3D canvas.
Definition: CanvasCamera.h:9
CBaseObject * GetActor()
get the current actor
Definition: 3DCanvas.cpp:164
we can put a mesh or character object on canvas.
Definition: 3DCanvas.h:11
void SetSize(int nWidth, int nHeight)
set the canvas size in pixels
Definition: 3DCanvas.cpp:209
3-dimensional vector with double precision.
Definition: ParaDVector3.h:17
different physics engine has different winding order.
Definition: EventBinding.h:32
void InvalidateDeviceObjects()
Invalid device object.
Definition: 3DCanvas.cpp:111
void SaveToFile(const char *sFileName, int nImageSize=0)
save to file.
Definition: 3DCanvas.cpp:224
void Zoom(float fAmount)
Zoom the camera.
Definition: 3DCanvas.cpp:134
TextureEntity * GetTexture()
the canvas texture, which can be used as any other ordinary texture on 3D or 2D object.
Definition: 3DCanvas.cpp:72
void SetEnabled(bool bEnable)
Definition: 3DCanvas.h:103
void ZoomAll()
zoom to show all objects
Definition: 3DCanvas.cpp:140
void DeleteDeviceObjects()
delete device objects
Definition: 3DCanvas.cpp:120
void Rotate(float dx, float dy, float dz)
rotate the camera round the object on canvas
Definition: 3DCanvas.cpp:127
void InitDeviceObjects()
init device objects.
Definition: 3DCanvas.cpp:78
bool IsEnabled()
Definition: 3DCanvas.h:108
void RestoreDeviceObjects()
restore device object
Definition: 3DCanvas.cpp:82
Defines the base class of all scene elements:CBaseObject for Parallel World Engine.
Definition: BaseObject.h:230
void SetBindingGroupID(int nGroupID)
a canvas can be bound to a certain selection group, so that it will always display the first object i...
Definition: 3DCanvas.h:98
void SetMaskTexture(TextureEntity *pTexture)
this is an optional 2D mask, which is drawn over the entire canvas after scene is rendered in to it...
Definition: 3DCanvas.cpp:302
void Cleanup()
clean up all resource objects
Definition: 3DCanvas.cpp:66
void GetTextureSize(int &nWidth, int &nHeight)
Get the canvas texture size.
Definition: 3DCanvas.h:42