Skip to content
k10forgotten edited this page Nov 30, 2012 · 4 revisions

Defines all the information needed to the camera.

Struct

typedef struct {
	Point lookFrom;
	Point lookAt;
	Point up;

	GLdouble near;
	GLdouble far;
	GLdouble fovY;
} Camera;
  • lookFrom: The Point where the camera is.
  • lookAt: The Point where the camera is looking.
  • up: The Point defining the camera's up vector.

Methods

newCamera

Camera myCamera = newCamera(0,0,2, 0,0,0, 0,1,0, 1,300,30);

This method fills the struct. You need to pass each Point (x,y,z) value (lookFrom, lookAt and up, respectively), near, far and vertical field of view angle, in this order.

newRayCaster

RayCaster myRayCaster = newRayCaster(myCamera);

This method fills all fields of the RayCaster. It needs a Camera as parameter since it uses gluLookAt and gluPerspective to get the correct ModelView and Projection matrices.

Clone this wiki locally