|
一个简单例子表示fixed functional VS/Assemble VS/HLSI VS的例子(2) // // Copyright (c) Microsoft Corporation. All rights reserved. // 修改者: Nigo.zhou <zzh1234567@163.com> // 目的: 原有的固定流水线程序扩展成可以使用 // 1 固定功能流水线进行顶点处理 或者使用 // 2 汇编级的可编程流水线进行顶点处理 或者使用 // 3 HLSI的可编程流水线进行顶点处理 //----------------------------------------------------------------------------- #include <Windows.h> #include <mmsystem.h> #include <d3dx9.h> #define VS_TYPE 2 // 0; for fixed VS; 1: for Assemble VS; 2: for HLSL #define SAFE_RELEASE(x) {if(x) x->Release();};
//----------------------------------------------------------------------------- // Global variables //----------------------------------------------------------------------------- LPDIRECT3D9 g_pD3D = NULL; // Used to create the D3DDevice LPDIRECT3DDEVICE9 g_pd3dDevice = NULL; // Our rendering device LPDIRECT3DVERTEXBUFFER9 g_pVB = NULL; // Buffer to hold vertices // A structure for our custom vertex type struct CUSTOMVERTEX { FLOAT x, y, z; // The untransformed, 3D position for the vertex DWord color; // The vertex color }; // 我使用dx9引入的vertex declartiaon代替FVF LPDIRECT3DVERTEXDECLARATION9 g_pVertexDeclaration; // Our custom FVF, which describes our custom vertex structure //#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZD3DFVF_DIFFUSE) // vertex declaration
|