All pastes #9870 Raw Edit

Untitled

public text v1 · immutable
#9870 ·published 2005-04-20 04:51 UTC
rendered paste body
			float *m = (float*)&m_matProj;
			float fFovTg = tanf(m_fFov);

			float fW = m_fScrW / (GUARDBAND_SIZE * fFovTg);
			float fH = m_fScrH / (GUARDBAND_SIZE * fFovTg * m_fAspect);
			
			const float fZMin =  1.f;
			const float fZMax = -1.f;

			float fZScale  = (-fZMax * m_fNearPlane + fZMin * m_fFarPlane) / (-m_fNearPlane + m_fFarPlane);
			float fZOffset = m_fFarPlane * m_fNearPlane * (-fZMin + fZMax) / (-m_fNearPlane + m_fFarPlane);

			*m++ = fW;		*m++ = 0.f;		*m++ = 0.f;		*m++ = 0.f;
			*m++ = 0.f;		*m++ = fH;		*m++ = 0.f;		*m++ = 0.f;
			*m++ = 0.f;		*m++ = 0.f;		*m++ = fZScale;	*m++ = 1.f;
			*m++ = 0.f;		*m++ = 0.f;		*m++ = fZOffset;*m++ = 0.f;

			m_vOffset.x =  2048.f;
			m_vOffset.y =  2048.f;
			m_vOffset.z = -0.5f * (float)(fZBufDepth);
			m_vOffset.w =  0.f;

			m_vScale.x =  0.5f * GUARDBAND_SIZE;
			m_vScale.y = -0.5f * GUARDBAND_SIZE;
			m_vScale.z = -0.5f * (float)(fZBufDepth);
			m_vScale.w =  1.f;