gamnit :: EulerCamera :: mvp_matrix_eye
diff
world unit from the center
# Get an MVP matrix for an eye at `diff` world unit from the center
private fun mvp_matrix_eye(diff: Float): Matrix
do
var view = new Matrix.identity(4)
# Translate the world away from the camera
view.translate(-position.x/2.0, -position.y/2.0, -position.z/2.0)
# Rotate the camera, first by looking left or right, then up or down
view = view * rotation_matrix
# Apply eye transformation
var translation = new Matrix.identity(4)
translation.translate(diff, 0.0, 0.0)
view = view * translation
# Use a projection matrix with a depth
var projection = new Matrix.perspective(pi*field_of_view_y/2.0,
display.aspect_ratio, near, far)
return view * projection
end
lib/gamnit/depth/stereoscopic_view.nit:33,2--54,4