new Camera( width, height ) → {Camera}

Description
Creates an instance of the base Camera
Parameters
Name Type Description
width number width of canvas
height number height of canvas
Returns

Members


fov :number

Description
Field Of View in Y

width :number

Description
Width of the view in pixels

width :number

Description
height of the view in pixels

aspect :number

Description
Aspect Ratio of view

zNear :number

Description
z-depth of near plane in viewing volume.

zFar :number

Description
z-depth of far plane in viewing volume.

projection :Array

Description
projection matrix

eye :Array

Description
World coordinates of eye

target

Description
World coordinates of what the eye is looking at

up :Array

Description
Vector in world space pointing up

view :Array

Description
View matrix (world -> cameraspace)

viewProjection :Array

Description
ViewProjection matrix (world -> ndc)

world :Array

Description
World matrix for any transformation applied to world

Methods


resize( width, height )

Description
Resizes camera matrices
Parameters
Name Type Description
width number new width of canvas
height number new height of canvas

update( time )

Description
Update camera prior to draw calls
Parameters
Name Type Description
time number frametime

setPosition( pos )

Description
Set new eye position
Parameters
Name Type Description
pos Array Worldspace coordinates for new eye position.

getUniforms( time )

Description
Compute new matrices and return a uniform object
Parameters
Name Type Description
time number frametime

getRayFromScreen( xNormalized, yNormalized )

Description
Gets a ray defined in worldspace from screenspace coord
Parameters
Name Type Description
xNormalized number normalized x position of screen coord [0,1]
yNormalized number normalized y position of screen coord [0,1]

unproject( position )

Description
Converts a screenspace coordinate into a worldspace coordinate
Parameters
Name Type Description
position Array screen space coords, z [-1, 1] where -1 = zNear, 1 = zFar

project( position )

Description
Converts a worldspace coordinate into a screen space coordinate ~> [0,1] [0,0] is lower-left
Parameters
Name Type Description
position Array world space coordinates [x,y,z]