# Class: camera

Cameras are used to render the frame.You can link them with actornodes or scenenodes. And activate them in specific l3dviews,or globally by making it the default camera. However there is always a default camera at startup.

## Hierarchy

    o-+ l3dlist
      o-+ camera

## Interfaces:

- hashid

## Methods:

### Method overview:

- aspect
- backplane
- clipplane
- cwfront
- default
- delete
- deleteall
- forceupdate
- fov
- frontplane
- getrect
- linkinterface
- localmatrix
- localpos
- localrotaxis
- localrotdeg
- localrotrad
- matrix
- nearpercentage
- new
- pos
- reflectplane
- rotationlock
- rotaxis
- toscreen
- toworld
- up
- useclipping
- useinfinitebackplane
- uselocal
- usereflection

new (int id 1-31)
  returns: ([camera])
  creates new camera. The id must be unique and a l3dnode must get an update to its visflag, if it should be visible to it.
aspect (camera,[float])
  returns: ([float])
  returns or sets aspect ratio, if negative then current window aspect will be used.
backplane (camera,[float])
  returns: ([float])
  returns or sets backplane
clipplane (camera,[float x,y,z,w])
  returns: ([float x,y,z,w])
  returns or sets clipping plane (worldspace). To make clipping useful the camera must be on the negative side of the plane.
cwfront (camera,[boolean])
  returns: ([boolean])
  returns or sets if front faces are clockwise, default off. Is needed when reflection plane creates artefacts
default ([camera])
  returns: ([camera])
  returns or sets current global default camera
delete (camera)
  returns: ()
  deletes camera
deleteall ()
  returns: ()
  deletes all existing cameras
forceupdate (camera)
  returns: ()
  forces the camera matrix to be updated (synchronized with its linked interface). This is neccessary if you use the toscreen and toworld functions and changed the position of the camera.
fov (camera,[float])
  returns: ([float])
  returns or sets fov
frontplane (camera,[float])
  returns: ([float])
  returns or sets frontplane
getrect (camera,int axis,float distance)
  returns: (4 float x,y,z)
  computes viewable rectangle on the given plane. axis is the plane normal 0 = X, 1 = Y, 2 = Z. Method returns 4 Vectors that lie on the plane, or nothing if plane wasnt intersected by frustum limiting rays. hitpoint order is, top left, top right, right bottom, left bottom
linkinterface (camera,[scenenode/actornode])
  returns: ()
  links camera to node
localmatrix (camera ,[matrix16])
  returns: ([matrix16])
  updates node's local matrix or returns it
localpos (camera ,[float x,y,z])
  returns: ([float x,y,z])
  updates node's local position or returns it. by defaul local transformations are off
localrotaxis (scenenode s3d,[float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz])
  returns: ([float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz])
  returns or sets local rotation axis, make sure they make a orthogonal basis.
localrotdeg (camera ,[float x,y,z])
  returns: ([float x,y,z])
  updates node's local rotation or returns it in degrees
localrotrad (camera ,[float x,y,z])
  returns: ([float x,y,z])
  updates node's local rotation or returns it in radians
matrix (camera])
  returns: ([matrix16])
  gets last frame's matrix
nearpercentage (camera,[float])
  returns: ([float])
  returns or sets percentage of what is considered near. range = backplane * nearpercentage. If a drawnode is closer than its drawn first. This helps making use of zbuffer better.
pos (camera,[float x,y,z])
  returns: (float x,y,z)
  returns the position of the camera in last frame. Setting only makes sense if camera is unlinked.
reflectplane (camera,[float x,y,z,w])
  returns: ([float x,y,z,w])
  returns or sets reflection plane (worldspace).
rotationlock (camera,int axis,[boolean state])
  returns: ([boolean])
  returns or sets rotation lock. axis 0=X 1=Y 2=Z 3=All. Rotation lock is applied before local transforms.
rotaxis (camera)
  returns: (float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz)
  gets rotaxis of the camera of last frame
toscreen (camera,float x,y,z)
  returns: (float x,y,z)
  computes screen position
toworld (camera,float x,y,z,[l3dview])
  returns: (float x,y,z)
  computes screen position to world coordinates. The camera returns the coordinates seen from 0,0,0. You will need to transform the coordinate with a matrix, if you link the camera against an actornode/scenenode. If l3dview is not passed, we will use reference coordinates
up (camera)
  returns: (float x,y,z)
  gets upvector of the camera of last frame
useclipping (camera,[boolean])
  returns: ([boolean])
  returns or sets if clipping plane should be used
useinfinitebackplane (camera,[boolean])
  returns: ([boolean])
  returns or sets if this camera needs shadow projection and therefore infinite backplane should be used. (only works for perspective projection)
uselocal (camera,[boolean])
  returns: ([boolean])
  returns or sets if local transforms should be used.
usereflection (camera,[boolean])
  returns: ([boolean])
  returns or sets if camera is reflected on the reflectplane. Useful for reflection rendering

## Inherited Methods:

### From l3dlist

reinit