Microsoft DirectX 8.0 (C++) |
Vertices in the camera space are computed by multiplying the object vertices by Mwv matrix.
v = Vobject * Mwv
Normals in the camera space are computed by multiplying the object normals by inverse transposed Mwv matrix and normalizing the result.
N = Nobject * (Mwv-1)T
If D3DRENDERSTATE_NORMALIZENORMALS is set to TRUE, normals are normalized after transformation to the camera space:
N = norm(N)
Light position in the camera space (Lpi) is computed by multiplying the light source position by Mv.
Lpi = Lporiginal * Mv
Direction to light in the camera space for D3DLIGHT_DIRECTIONAL lights is computed by multiplying the light source position by Mv matrix, normalizing and negating the result.
Ldi = -norm(Ldi original * Mv)
For the D3DLIGHT_POINT and D3DLIGHT_SPOT the direction to light is computed as:
Ldi = norm(VLpi)