现在的位置: 首页 > 综合 > 正文

读书笔记 – Direct93D游戏程序设计入门

2018年05月04日 ⁄ 综合 ⁄ 共 1631字 ⁄ 字号 评论关闭

这本书是directx入门很好的教材,门槛低,可以了解directx很多基本的东西,可以作为跳板,看完以后去学习更高级的东西,比如directx自带的sample

以前看过这本书,现在再看一遍,主要目的是熟悉dx基本绘制知识,书中主要包含到这本书中所有的内容:

灯光、材质

device->SetRenderState(D3DRS_SPECULARENABLE, true);

D3DLIGHT9 light

device->SetLight(0, &light);

device->LightEnable(0, true);

D3DMATERIAL9 blueMaterial;

device->SetMaterial(&blueMaterial);

纹理、混合

D3DXCreateTextureFromFile()

IDirect3Dtexture9 *pTex;

device->SetTexture(0, pTex);

device->SetSamplerState(0, D3DSAMP-MAGFILTER, D3DTEXF_LINEAR);

device->SetSamplerState(0, D3DSAMP-MINFILTER, D3DTEXF_LINEAR);

device->SetSamplerState(0, D3DSAMP-MIPFILTER, D3DTEXF_LINEAR);

device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);

device->SetRenderState(D3DRS_DSTBLEND, D3DBLEND_INVSRCALPHA);

影子、镜子

device->SetRenderState(D3DRS_STENCILENABLE, true);

device->Clear(0, 0, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, 0xff000000, 1.0f, 0)

device->SetRenderState(D3DRS_STENCILREF, 0X1)

device->SetRenderState(D3DRS_STENCILMASK, 0x0000ffff);

device->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP);

device->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP);

device->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_KEEP);

device->SetRenderState(D3DRS_STENCILWRITEMASK, 0x0000ffff);

模型、.x文件

ID3DXMesh

D3DXLoadMeshFromX

加载tiny.x这样的动画模型需要D3DXLoadMeshHirarchyFromX等相关函数

摄像机、地形

拾取、粒子系统

vertex shader pixel shader  effect framework

D3DXCreateEffectFromFile

D3DXHANDLE pHandle = pEffect->GetTechniqueByName("tName");

pEffect->SetTechnique(pHandle);

UINT numPasses=0;

pEffect->Begin(&numPasses, 0);

for(i=0; i<numPasses; i++)

{

pEffect->BeginPass(i)

...// render calls

pEffect->EndPass();

}

pEffect->End()

写了一个程序作为总结,当然,学习单项内容的话,书中配套光盘是首选

地址http://download.csdn.net/detail/buck84/5518067

抱歉!评论已关闭.