⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d3d9cartoon.h

📁 现在市面上流行的3D游戏画面越来越炫目
💻 H
字号:
//-----------------------------------------------------------------------------
// File: D3D9Cartoon.h
//
// Desc: Header file D3D9Cartoon sample app
//-----------------------------------------------------------------------------
#pragma once

#define FVF D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_NORMAL

//-----------------------------------------------------------------------------
// Defines, and constants
//-----------------------------------------------------------------------------
// TODO: change "DirectX AppWizard Apps" to your name or the company name
#define DXAPP_KEY        TEXT("Software\\DirectX AppWizard Apps\\D3D9Cartoon")

// Struct to store the current input state
struct UserInput
{
    // TODO: change as needed
    BOOL bRotateUp;
    BOOL bRotateDown;
    BOOL bRotateLeft;
    BOOL bRotateRight;
};

//-----------------------------------------------------------------------------
// Name: class CMyD3DApplication
// Desc: Application class. The base class (CD3DApplication) provides the 
//       generic functionality needed in all Direct3D samples. CMyD3DApplication 
//       adds functionality specific to this sample program.
//-----------------------------------------------------------------------------
class CMyD3DApplication : public CD3DApplication
{
    BOOL                    m_bLoadingApp;          // TRUE, if the app is loading
    CD3DFont*               m_pFont;                // Font for drawing text
    ID3DXMesh*              m_pD3DXMesh;            // D3DX mesh to store teapot
    UserInput               m_UserInput;            // Struct for storing user input 

    FLOAT                   m_fWorldRotX;           // World rotation state X-axis
    FLOAT                   m_fWorldRotY;           // World rotation state Y-axis

	///////////////////////////////////////////////////////////////
	LPDIRECT3DVERTEXDECLARATION9 m_pSilhouetteVertexDecl,m_pSurfaceVertexDecl,m_pFloorVertexDecl;
	LPDIRECT3DVERTEXSHADER9 m_pSilhouetteVertexShader,m_pSurfaceVertexShader,m_pFloorVertexShader;
	D3DXMATRIX m_matWorld,m_matView,m_matProj;
	CD3DArcBall m_ArcBall;
	D3DXVECTOR3 m_vCenter;
	FLOAT m_ObjRadius;

	CD3DMesh* m_pObject;
	CD3DMesh* m_pFloor;

	HRESULT BuildShaders();
	HRESULT	ModifyTextures();

protected:
    virtual HRESULT OneTimeSceneInit();
    virtual HRESULT InitDeviceObjects();
    virtual HRESULT RestoreDeviceObjects();
    virtual HRESULT InvalidateDeviceObjects();
    virtual HRESULT DeleteDeviceObjects();
    virtual HRESULT Render();
    virtual HRESULT FrameMove();
    virtual HRESULT FinalCleanup();
    virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT );

    HRESULT RenderText();

    void    UpdateInput( UserInput* pUserInput );
public:
    LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
    CMyD3DApplication();
    virtual ~CMyD3DApplication();
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -