# Class: l3dcamera

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-+ l3dnode
        o-+ l3dcamera

## Methods:

### Method overview:

- aspect
- backplane
- clipplane
- cwfront
- default
- forceupdate
- fov
- frontplane
- getrect
- nearpercentage
- new
- projmatrix
- projmatrixinv
- reflectplane
- toscreen
- toview
- toworld
- useclipping
- useinfinitebackplane
- usemanualprojection
- usereflection
- viewmatrix
- viewprojmatrix
- visflagid

new (string name,[l3dlayerid], int id 1-31)
  returns: ([l3dcamera])
  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 (l3dcamera,[float])
  returns: ([float])
  returns or sets aspect ratio = width/height, if negative then current window aspect will be used.
backplane (l3dcamera,[float])
  returns: ([float])
  returns or sets backplane
clipplane (l3dcamera,[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 (l3dcamera,[boolean])
  returns: ([boolean])
  returns or sets if front faces are clockwise, default off. Is needed when reflection plane creates artefacts
default ([l3dcamera])
  returns: ([l3dcamera])
  returns or sets current global default camera
forceupdate (l3dcamera)
  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 (l3dcamera,[float])
  returns: ([float])
  returns or sets fov horizontal angle. Negative values are used for orthographic projection and their absolute value will become width of view.
frontplane (l3dcamera,[float])
  returns: ([float])
  returns or sets frontplane
getrect (l3dcamera,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
nearpercentage (l3dcamera,[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.
projmatrix (l3dcamera,[matrix4x4])
  returns: ([matrix4x4])
  returns or sets current projection matrix.
projmatrixinv (l3dcamera)
  returns: ([matrix4x4])
  returns current inverse of projection matrix.
reflectplane (l3dcamera,[float x,y,z,w])
  returns: ([float x,y,z,w])
  returns or sets reflection plane (worldspace).
toscreen (l3dcamera,float x,y,z,[width,height])
  returns: (float x,y,z)
  computes screen pixel position. Uses reference width/height or custom.
toview (l3dcamera,float x,y,z,[w])
  returns: (float x,y,z,w)
  computes position in modelview matrix. (w=1.0 default)
toworld (l3dcamera,float x,y,z,[l3dview])
  returns: (float x,y,z)
  computes screen pixel position (reference coordinates) 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 window.refsize.
useclipping (l3dcamera,[boolean])
  returns: ([boolean])
  returns or sets if clipping plane should be used
useinfinitebackplane (l3dcamera,[boolean])
  returns: ([boolean])
  returns or sets if this camera needs shadow projection and therefore infinite backplane should be used. (only works for perspective projection)
usemanualprojection (l3dcamera,[boolean])
  returns: ([boolean])
  returns or sets if manual projection matrix is used. That means aspect/frontplane.. will not modify projection matrix (settable via projmatrix).
usereflection (l3dcamera,[boolean])
  returns: ([boolean])
  returns or sets if camera is reflected on the reflectplane. Useful for reflection rendering
viewmatrix (l3dcamera)
  returns: ([matrix4x4])
  returns viewmatrix, viewmatrixinv is worldmatrix of l3dnode.
viewprojmatrix (l3dcamera)
  returns: ([matrix4x4])
  returns viewprojmatrix. Can be used to transform vectors into clipspace
visflagid (l3dcamera)
  returns: (int)
  returns the id the camera was intialized with

## Inherited Methods:

### From l3dnode

cambox, camsphere, camvolumedelete, color, delete, isanimateable, lastframe, lightmap, lightmaptexmatrix, linkinterface, localmatrix, localpos, localrotaxis, localrotdeg, localrotquat, localrotrad, name, novistest, parent, parentbone, renderscale, rotationlock, setlayer, unlink, unparentbone, uselocal, uselookat, usemanualworld, visflag, worldmatrix, worldpos, worldrotaxis, worldrotdeg, worldrotquat, worldrotrad

### From l3dlist