sinawear

导航

随笔分类 -  D9问题

使用D9的SetFVF无法控制数据字段在内存中的顺序,所有字段的顺序都是固定的。自能选择好用还是不用。
摘要:D3DFVF_DIFFUSE是个DWORD哦。4个字节。// Untransformed vertex for unlit, untextured, Gouraud-shaded // content with diffuse material color specified per vertex.dwFVF = ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE );不能这样:dwFVF = ( D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_NORMAL ); 阅读全文

posted @ 2012-06-07 17:59 sinawear 阅读(177) 评论(0) 推荐(0)

D9的D3DPT_TRIANGLESTRIP。
摘要://_ // \_ 逆时针 D3DXVECTOR3 Quad[4] ={ D3DXVECTOR3(-1.0f, -1.0f, 2), D3DXVECTOR3(1.0f, -1.0f, 2), D3DXVECTOR3(-1.0f, 1.0f, 2), D3DXVECTOR3(1.0f, 1.0f, 2) }; ... 阅读全文

posted @ 2012-06-07 14:22 sinawear 阅读(605) 评论(0) 推荐(0)

DrawIndexedPrimitive和D3DXIntersect。搭配使用的问题。
摘要:shader版龙书第20章,射线与三角形相交,作者为了显示相交,会对点击到的三角形进行单独Solid渲染一次,而整体用Wireframe渲染。对于D3DXIntersect函数用来检测射线和网格的相交情况。它有个参数,FaceIndex:[out] Pointer to an index value of the face closest to the ray origin(指向最靠近射线起源的面(三角形)索引值。)作者从网格得到顶点缓冲,索引缓冲,准备渲染。样式为:device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, pMesh- 阅读全文

posted @ 2012-01-19 14:29 sinawear 阅读(577) 评论(2) 推荐(0)