# Class: l3dview

l3dview is used to render a l3dset. You can specify camera, background and fog for each l3dview.Every l3dset has one default l3dview, which cannot be deleted. Additionally you can register more l3dviews which are processed before/after the default views.The l3dnodes can be made visible only to certain cameras. By default they are visible to the default camera and windowsized.
Another special purpose of l3dviews is rendering to a texture.

## Hierarchy

    o-+ l3dlist
      o-+ l3dview

## Interfaces:

- matobject

## Methods:

### Method overview:

- activate
- bgmatsurface
- bgskybox
- bgskyl3dnode
- camera
- deactivate
- defaultcamvisflag
- delete
- depthonly
- drawcamaxis
- drawnow
- filldrawlayers
- fogcolor
- fogdensity
- fogend
- fogstart
- fogstate
- new
- polygonoffset
- rcmdadd
- rcmdempty
- rcmdflag
- rcmdget
- rcmdremove
- usepolygonoffset
- viewpos
- viewrefbounds
- viewsize
- windowsized

new ([int rcmdbias])
  returns: (l3dview)
  returns a new l3dview. rcmdbias (default 0) allows you to allow more (>0) or less (<0) than 255 rcmds in this view.
activate (l3dview,l3dset,[l3dview ref,boolean after])
  returns: ()
  activates the l3dview in the given set. Activate inserts the l3dview before (or after if set) reference view (or listhead if none given) in the list. Has no effect on defaultviews
bgmatsurface (l3dview,[matsurface])
  returns: ([matsurface])
  returns or sets matsurface, disabled when 2nd arg is not a matsurface
bgskybox (l3dview,[skybox])
  returns: ([skybox])
  returns or sets skybox, disabled when 2nd arg is not a skybox
bgskyl3dnode (l3dview,[l3dnode],[float x,y,z])
  returns: ([l3dnode])
  returns or sets l3dnode to be used as background, disabled when 2nd arg is not a l3dnode. Be aware that the l3dnode must not be used anywhere else. It will automatically set the manual world matrix mode. Camera position is scaled using the 3 floats, that way you can 'fix' the model position around camera. Be aware that background models write into max depth, which means that overlapping geometry might create issues.
camera (l3dview,[l3dcamera])
  returns: (l3dcamera)
  returns or sets camera, disabled when 2nd arg is not a camera. If disabled we will use default camera.
deactivate (l3dview)
  returns: ()
  deactivates the l3dview. Has no effect on defaultviews
defaultcamvisflag (l3dview,int id,[boolean])
  returns: ([boolean])
  sets camera visibility bit flag if a default camera is used for this view. It overrides the visflag of the camera itself, however culling is done before and based on the original camera bitid.
delete (l3dview)
  returns: ()
  deletes the l3dview. Has no effect on defaultviews
depthonly (l3dview,[boolean])
  returns: ([boolean])
  returns or sets if a pure Z write should be done.
drawcamaxis (l3dview,[boolean])
  returns: ([boolean])
  draws camera orientation
drawnow (l3dview,[l3dlight sun])
  returns: ()
  if the l3dview is not active, it can be drawn directly, ie unrelated of the l3dset. This is mostly meant for immediate/one-time modifications of textures via renderfbo useage. Due to lack of an l3dset layer and particle drawing will show no effect.
filldrawlayers (l3dview,[boolean])
  returns: ([boolean])
  enable/disable filling of drawlayers (l3dtrails, l3dmodels, l3dprimitives, l3dtbterrain, l3dlevelmodel, l3dtext, l3dshadowmodel), particlelayers remain active. Default is true. Useful when a pure fx/l2dnode/particle view is being rendered, or layers are organized to be spread over different l3dviews. When set to false the layerstate of previous l3dview remains active (first l3dview of each l3dset always does a clear). That way you can reuse the data, but it only makes sense if camera visibility stays identical. The layer filling is a rather costly operation, so avoid it when possible.
fogcolor (l3dview,[float r,g,b,a])
  returns: ([float r,g,b,a])
  returns or sets
fogdensity (l3dview,[float])
  returns: ([float])
  returns or sets
fogend (l3dview,[float])
  returns: ([float])
  returns or sets
fogstart (l3dview,[float])
  returns: ([float])
  returns or sets
fogstate (l3dview,[boolean])
  returns: ([boolean])
  returns or sets
polygonoffset (l3dview,[float scale,bias])
  returns: ([float scale,bias])
  returns or sets the polygonoffset values..
rcmdadd (l3dview,rcmd,|rcmd ref,int occurance|,[boolean before])
  returns: (boolean success)
  adds the rcmd to the rcmd queue list of this l3dview. You can add a maximum of 255 rcmds to default views, and for custom views you can modify this limit. They are processed in the order they are added. If there are no commands, the l3dview will do nothing cept debug drawing. As long as rcmd is assigned it won't be garbagecollected.
  You can insert after a another rcmd, which is searched in the list. When occurance is negative we will search the rcmd from the back first. An absolute value of 1 will be first occurance, 2 second and so on. 0 or passing no occurance value is same as +1. If before is true we will insert before the given rcmd (default is false).
  When only before == true is passed and no ref&occurance, we will insert the command as first.
rcmdempty (l3dview)
  returns: ()
  empties the rcmd list of this l3dview.
rcmdflag (l3dview,int id,[boolean])
  returns: ([boolean])
  sets rcmd process bit flag. If rcmdflag of view AND the own flag bitwise return true, then the rcmd will be processed. id = 0..31
rcmdget (l3dview,int index)
  returns: ([rcmd])
  gets the current rcmd from a specified index, nil if out of bounds. Useful for debugging.
rcmdremove (l3dview,rcmd,[int occurance])
  returns: (boolean success)
  removes the rcmd from the list. Occurance value treated as in rcmdadd.
usepolygonoffset (l3dview,[boolean])
  returns: ([boolean])
  returns or sets if depth values are changed depending on slope and constant factors when depth testing occurs.
viewpos (l3dview,[int x,y])
  returns: ([int x,y])
  returns or sets the viewport starting position in GLpixels. 0,0 is bottom left, which is not as in list2d. only used when windowsized is false
viewrefbounds (l3dview,[float refx,refy,refwidth,refheight])
  returns: ([float refx,refy,refwidth,refheight])
  returns or sets the viewport size and position in reference coordinates. only used when windowsized is false. Warning: viewsize must always be smaller than current window refsize.
viewsize (l3dview,[int width,height])
  returns: ([int width,height])
  returns or sets the viewport size in pixels. only used when windowsized is false. Warning: viewsize must always be smaller than current window resolution (unless FBO rendering is used).
windowsized (l3dview,[boolean])
  returns: ([boolean])
  returns or sets if the viewport should use the full window size (default true).

## Inherited Methods:

### From l3dlist