Added perspective matrix calculations.