tailieunhanh - 3d game engine programming phần 5

Thật thú vị, bạn cũng có thể tính toán xem hai máy bay bị va chạm. Như bạn đã biết, máy bay mở rộng bản thân đến vô cùng, vì vậy chỉ có một trường hợp trong đó hai chiếc máy bay không giao nhau với nhau nếu cả hai chiếc máy bay song song. | Rendering Point Lists 325 break case VID_UL nStride sizeof LVERTEX dwFVF FVF_LVERTEX break default return ZFX_INVALIDID switch shader or FVF if m_pZFXD3D- UsesShaders m_pZFXD3D- ActivateVShader 0 VID m_pZFXD3D- ActivatePShader 0 else m_pDevice- SetFVF dwFVF finally render list of points if FAILED m_pDevice- DrawPrimitiveUP D3DPT_POINTLIST nVerts pVerts nStride return ZFX_FAIL return ZFX_OK RenderPoints Rendering Line Lists Just as with rendering points a function now exists in the engine for rendering lines. This function is not used in performance-critical applications but it can and will be used to render the grid in a level editor tool. Here is the function declaration from the render device interface virtual HRESULT RenderLines ZFXVERTEXID VertexID UINT nVerts const void pVerts const ZFXCOLOR pClrl bool bStrip 0 The implementation of this function is 99 percent the same as the one for lists of points. You need only to change the primitive type on the Direct3D drawing call. However this function can render lists of lines and line strips. In lists each pair of vertices forms a line. In a strip on the other hand a vertex from the list is used for a line together with its succeeding vertex thus a strip of lines exists that has no gap in between HRESULT ZFXD3DVCManager RenderLines ZFXVERTEXID VID UINT nVerts TEAM LinG - Live Informative Non-cost and Genuine 326 Chapter 6 The Render Device of the Engine const void pVerts const ZFXCOLOR pClr bool bStrip D3DMATERIAL9 mtrl DWORD dwFVF int nStride mark all current states as invalid InvalidateStates if pClr memset mtrl 0 sizeof D3DMATERIAL9 pClr- fR pClr- fG pClr- fB pClr- fA m_pDevice- SetMaterial mtrl m_pDevice- SetTexture 0 NULL switch VID case VID_UU nStride sizeof VERTEX dwFVF FVF_VERTEX break case VID_UL nStride sizeof LVERTEX dwFVF FVF_LVERTEX break default return ZFX_INVALIDID switch if .

TỪ KHÓA LIÊN QUAN