
1. DirectX 9.0 3D游戏开发编程基础 学习笔记
文章平均质量分 60
梦幻DUO
游戏开发爱好者
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
DirectX9 表面
we have provided the following code block that locks a surface and colors each pixel red:// Assume _surface is a pointer to an IDirect3DSurface9 interface.// Assumes a 32-bit pixel format fo原创 2015-04-17 20:37:18 · 624 阅读 · 0 评论 -
DirectX9 深度缓存
In general, most applications work fine with a 24-bit depth buffer, although Direct3D also exposes a 32-bit depth buffer.D3DFMT_D32—Specifies a 32-bit depth bufferD3DFMT_D24S8—Specifies a 24原创 2015-04-17 21:59:25 · 1069 阅读 · 0 评论 -
DirectX9 平面
D3DXPLANEThe D3DX library uses the followingstructure for a plane:typedef struct D3DXPLANE{#ifdef __cpluspluspublic:D3DXPLANE() {}D3DXPLANE( CONST FLOAT* );D3DXPLANE( CONST D3DXFLOAT原创 2015-04-16 23:52:03 · 1053 阅读 · 0 评论 -
DirectX9 示例:绘制三角形
//////////////////////////////////////////////////////////////////////////////////////////////////// // File: triangle.cpp// // Author: Frank Luna (C) All Rights Reserved//// System: AMD Athlon原创 2015-05-02 22:32:30 · 1595 阅读 · 0 评论 -
DirectX9 示例:演示D3DXCreate*函数
//////////////////////////////////////////////////////////////////////////////////////////////////// // File: d3dxcreate.cpp// // Author: Frank D. Luna (C) All Rights Reserved//// System: AMD At原创 2015-05-02 22:35:28 · 2025 阅读 · 0 评论 -
DirectX9 示例:绘制茶壶
//////////////////////////////////////////////////////////////////////////////////////////////////// // File: teapot.cpp// // Author: Frank Luna (C) All Rights Reserved//// System: AMD Athlon 18原创 2015-05-02 22:34:49 · 1405 阅读 · 0 评论 -
DirectX9 绘画准备
绘画准备Once we have created a vertex buffer and, optionally, an index buffer, we are almost ready to render its contents, but there are three steps that must be taken first.1. Set the stream source原创 2015-04-28 17:31:26 · 532 阅读 · 0 评论 -
DirectX9 检索关于顶点和索引的信息
检索关于顶点和索引的信息The following example demonstrates the methods used to obtain such information:D3DVERTEXBUFFER_DESC vbDescription;_vertexBuffer->GetDesc(&vbDescription); // get vb infoD3DINDEXBU原创 2015-04-28 17:22:47 · 597 阅读 · 0 评论 -
DirectX9 进入缓存内存
C++ 进入缓存内存We obtain a pointer to its contents by using theLockmethod. It is important to unlock the buffer when we are done accessing it.HRESULT IDirect3DVertexBuffer9::Lock(UINT OffsetToLock,原创 2015-04-28 17:08:27 · 550 阅读 · 0 评论 -
DirectX9 创建顶点和索引缓存
C++ 创建顶点和索引缓存We can create a vertex and index buffer with the following two methods:HRESULT IDirect3DDevice9::CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL PoolIDirect3D原创 2015-04-28 16:55:33 · 1236 阅读 · 0 评论 -
DirectX9 IDirect3DDevice9::DrawPrimitive
IDirect3DDevice9::DrawPrimitiveThis method is used to draw primitives that do not use index info.HRESULT IDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UIN原创 2015-05-02 10:33:16 · 1278 阅读 · 0 评论 -
DirectX9 IDirect3DDevice9::DrawIndexedPrimitive
IDirect3DDevice9::DrawIndexedPrimitiveThis method is used to draw primitives using index info.HRESULT IDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT原创 2015-05-02 10:38:04 · 957 阅读 · 0 评论 -
DirectX9 Begin/End Scene
Begin/End SceneThe last bit of information to mention is that all drawing methods must be called inside an IDirect3DDevice9::BeginSceneand IDirect3DDevice9::EndScenepair. For example, we would wri原创 2015-05-02 10:41:19 · 739 阅读 · 0 评论 -
DirectX9 像素格式
The format of a pixel is defined byspecifying a member of theD3DFORMATenumerated type. Some formats are:D3DFMT_R8G8B8—Specifies a 24-bitpixel format where, startingfrom the leftmost bit, 8 bits原创 2015-04-17 21:04:50 · 911 阅读 · 0 评论 -
DirectX9 多重采样
MultisamplingD3DMULTISAMPLE_NONE—Specifies nomultisamplingD3DMULTISAMPLE_1_SAMPLE…D3DMULTISAMPLE_16_SAMPLE—Specifiesmultisampling levels from 1 to 16 If you wish to include it, remember touse原创 2015-04-17 20:51:53 · 983 阅读 · 0 评论 -
DirectX9 内存池
The memory pool is specified by one of the members of theD3DPOOLenumerated type. The memory pools available are:D3DPOOL_DEFAULT—The default memory pool instructs Direct3D to place the resource in th原创 2015-04-17 21:14:09 · 700 阅读 · 0 评论 -
DirectX9 顶点格式
顶点格式To create a customvertex format, we first create a structure that holds the vertex data that wechoose.struct ColorVertex{float _x, _y, _z; //positionDWORD _color;};structNormalTexVer原创 2015-04-18 19:42:22 · 946 阅读 · 0 评论 -
DirectX9 三角形单元
三角形单元A triangle list contains the data for each individual triangle that we wish to draw. Vertex rect[6] = {v0, v1, v2, // triangle0v0, v2, v3}; // triangle1原创 2015-04-18 19:51:29 · 524 阅读 · 0 评论 -
DirectX9 世界坐标系
世界坐标The world transformation is represented with a matrix and set with Direct3D using theIDirect3DDevice9::SetTransformmethod withD3DTS_WORLDas the transform type. For example, suppose we want to po原创 2015-04-18 20:24:22 · 693 阅读 · 0 评论 -
DirectX9 观察坐标系
观察坐标系The view space transformation matrix can be computed using the following D3DX function:D3DXMATRIX*D3DXMatrixLookAtLH(D3DXMATRIX* pOut, //pointer to receive resulting view matrixCONST D3DX原创 2015-04-18 20:54:40 · 587 阅读 · 0 评论 -
DirectX9 投影
投影D3DXMATRIX *D3DXMatrixPerspectiveFovLH(D3DXMATRIX* pOut, // returns projection matrixFLOAT fovY, // vertical field of view angle in radiansFLOAT Aspect, // aspect ratio = width / heightFLO原创 2015-04-18 21:56:15 · 815 阅读 · 0 评论 -
DirerctX9 初始化Direct3D
Acquiring anIDirect3D9 InterfaceThis is easily doneusing a special Direct3D function, as the following lines of code show:IDirect3D9*_d3d9;_d3d9 =Direct3DCreate9(D3D_SDK_VERSION); Checking f原创 2015-04-17 23:32:49 · 934 阅读 · 0 评论 -
DirectX9 初始化Direct3D通用框架
初始化Direct3D通用框架The declaration of IDirect3DDevice9::Clearis:HRESULTIDirect3DDevice9::Clear(DWORD Count,const D3DRECT*pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil);Coun原创 2015-04-18 18:49:58 · 1516 阅读 · 0 评论 -
DirectX9 背面消隐
背面消隐If for some reason we are not happy with the default culling behavior, we can change it by changing theD3DRS_CULLMODErender state. Device->SetRenderState(D3DRS_CULLMODE, Value); whereValueca原创 2015-04-18 21:12:06 · 1447 阅读 · 0 评论 -
DirectX9 向量
In the D3DX library, we can use theD3DXVECTOR3class to represent a vectorin 3-space. Its class definition is:typedef struct D3DXVECTOR3 : public D3DVECTOR {public:D3DXVECTOR3() {};D3DXVECTOR3(原创 2015-04-16 14:27:15 · 664 阅读 · 0 评论 -
DirectX9 矩阵
D3DXMatricesTo represent 4×4 matrices in D3DX, weusethe D3DXMATRIX class, defined as follows:typedef struct D3DXMATRIX : publicD3DMATRIX{public:D3DXMATRIX() {};D3DXMATRIX(CONST FLOAT*);原创 2015-04-16 23:49:01 · 766 阅读 · 0 评论 -
DirectX9 设备能力
Supposewe wish to check if a hardware device is capable of doing vertex processing inhardware (or in other words, whether the device supports transformation andlighting calculations in hardware). By原创 2015-04-17 22:14:27 · 457 阅读 · 0 评论 -
DirectX9 D3DX几何体对象
D3DX几何体对象The D3DX library provides the following six mesh creation functions: D3DXCreateBox D3DXCreateSphere D3DXCreateCylinder D3DXCreateTeapot D3DXCreatePolygon D3DXCreateTor原创 2015-05-02 10:42:57 · 1467 阅读 · 0 评论