3DWindow.h
资源名称:estereo2.zip [点击查看]
上传用户:fengshi120
上传日期:2014-07-17
资源大小:6155k
文件大小:4k
源码类别:
3D图形编程
开发平台:
C/C++
- #if !defined(AFX_3DWINDOWSMALL_H__147F5773_11F0_11D4_90C3_00AA00597E76__INCLUDED_)
- #define AFX_3DWINDOWSMALL_H__147F5773_11F0_11D4_90C3_00AA00597E76__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- // 3DWindow.h : header file
- #include <d3d9.h>
- #include <Dxerr9.h>
- #include "d3dutil.h"
- #include "FrameTimer.h"
- #include "D3DFont.h"
- #include "D3DFile.h"
- #define GUI_UPDATE_TIMER 70
- #define NUM_OF(ary_) (sizeof(ary_)/sizeof(ary_[0]))
- /////////////////////////////////////////////////////////////////////////////
- // C3DWindow window
- class C3DWindow : public CWnd
- {
- // Construction
- public:
- C3DWindow();
- // Attributes
- public:
- bool m_bOrthographic;
- LPDIRECT3D9 m_pD3D; // Used to create the D3DDevice
- LPDIRECT3DDEVICE9 m_pD3DDevice; // Our rendering device
- D3DXMATRIX m_matProj;
- D3DXMATRIX m_matProjT;
- D3DLIGHT9 m_light;// Description of the D3D light
- ID3DXMesh* m_pConeMesh[3];
- IDirect3DTexture9* m_pTextureAxisLabelX;
- IDirect3DTexture9* m_pTextureAxisLabelY;
- IDirect3DTexture9* m_pTextureAxisLabelZ;
- LPDIRECT3DVERTEXBUFFER9 m_pPixelVB;
- float* m_pX;
- float* m_pY;
- float* m_pZ;
- Color* m_pC;
- int m_nPoints;
- float m_fScale;
- void RemovePixelVB(void);
- HRESULT ExportPixelVB(CString strFilename);
- bool m_bUsePoints;
- void ResetArcBall(void);
- void SetUpdateTimer(bool bState);
- int Start(bool bOrthographic);
- CRect m_rcClientRect;
- bool m_bRenderZAxis;
- CString m_strRegistry;
- D3DPRESENT_PARAMETERS m_d3dpp;
- LPDIRECT3DVERTEXBUFFER9 m_pArcLineVB;
- void SetRegistryKey(CString strRegistry);
- CD3DFont* m_pFont; // Font for drawing text
- CD3DFont* m_pFontLarge; // Font for drawing big text
- HRESULT Render3DEnvironment(void);
- HRESULT RestoreDeviceObjects(void);
- D3DSURFACE_DESC m_D3DsdBackBuffer; // Surface desc of the backbuffer
- CD3DArcBall m_ArcBall; // mouse rotation utility
- D3DXVECTOR3 m_vObjectCenter; // Center of bounding sphere of object
- FLOAT m_fObjectRadius; // Radius of bounding sphere of object
- D3DXMATRIX m_matWorld;
- HRESULT ReleaseD3DX();
- HRESULT InitD3DX();
- HRESULT Render(void);
- INT_PTR m_GUITimerID;
- private:
- public:
- HRESULT CreateVB(int nPoints,float* pX,float* pY,float* pZ,Color* pC,float* pS);
- LPDIRECT3DVERTEXBUFFER9 m_pAxesVB[3];
- // Operations
- public:
- void InterpretError(HRESULT hr) const;
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(C3DWindow)
- public:
- //}}AFX_VIRTUAL
- // Implementation
- public:
- HRESULT InitDeviceObjects(void);
- HRESULT DeleteDeviceObjects(void);
- HRESULT RenderText(void);
- CString m_strTopRightTextLine1;
- CString m_strTopLeftTextLine1;
- CString m_strBottomLeftTextLine1;
- static BOOL m_Registered;
- static BOOL m_bInhibitUpdate;
- static LRESULT CALLBACK Window3DWndProc(HWND, UINT, WPARAM, LPARAM);
- static BOOL Register();
- virtual ~C3DWindow();
- void ShowMenu(UINT idrMenu);
- void SetLightOutput(float fDiffuse,float fAmbient);
- HRESULT MakeConeMeshes(float fConeShiftX,float fConeShiftY, float fConeShiftZ);
- // Generated message map functions
- protected:
- //{{AFX_MSG(C3DWindow)
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg void OnDestroy();
- afx_msg void OnNcDestroy();
- afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
- afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
- public:
- afx_msg void OnPaint();
- virtual BOOL PreTranslateMessage(MSG* pMsg);
- afx_msg void OnTimer(UINT nIDEvent);
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
- afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
- afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
- };
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_3DWINDOWSMALL_H__147F5773_11F0_11D4_90C3_00AA00597E76__INCLUDED_)