|
@ -33,6 +33,13 @@ export default class Ray { |
|
|
// TODO: on the image plane. In addition to the coordinates (x, y), you will need the
|
|
|
// TODO: on the image plane. In addition to the coordinates (x, y), you will need the
|
|
|
// TODO: width and height of the camera (i.e. the width and height of the camera's
|
|
|
// TODO: width and height of the camera (i.e. the width and height of the camera's
|
|
|
// TODO: image plane), and the angle alpha specifying the camera's field of view.
|
|
|
// TODO: image plane), and the angle alpha specifying the camera's field of view.
|
|
|
return null; |
|
|
|
|
|
|
|
|
var temp = new Vector(0,0,0,0); |
|
|
|
|
|
temp.x = x - ((camera.width-1) / 2); |
|
|
|
|
|
temp.y = ((camera.height-1) / 2) - y; |
|
|
|
|
|
temp.z = - ((camera.width/2) / (Math.tan(camera.alpha/2))); |
|
|
|
|
|
|
|
|
|
|
|
temp = temp.normalize(); |
|
|
|
|
|
|
|
|
|
|
|
return new Ray(camera.origin, temp); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |