// Create view and projection matrices, based on the current camera and // using the imposter quad as the viewing plane. void ImposterSystem::CreateMatrices( const D3DXVECTOR3& curCameraPos, const D3DXVECTOR3& curCameraUp, D3DXMATRIX& imposterViewMatrix, D3DXMATRIX& imposterProjMatrix, Imposter* pImposter, float imposterNearPlane, float imposterFarPlane) { D3DXMatrixLookAtLH(&imposterViewMatrix, &curCameraPos, &pImposter->centre, &curCameraUp); D3DXVECTOR3 widthVec = pImposter->verts[1].pos - pImposter->verts[0].pos; D3DXVECTOR3 heightVec = pImposter->verts[5].pos - pImposter->verts[0].pos; float viewWidth = D3DXVec3Length(&widthVec); float viewHeight = D3DXVec3Length(&heightVec); D3DXMatrixPerspectiveLH(&imposterProjMatrix, viewWidth, viewHeight, imposterNearPlane, imposterFarPlane); }