# Class: particlecloud

A ParticleCloud contains many static particles, which are organised as groups. The user specifies all particle properties, the groups are used to handle automatic particle position updates. The fastest types to render are quad,triangle and point.

## Hierarchy

    o-+ resource
      o-+ particlecloud

## Interfaces:

- matobject
- renderflag
- rendersurface

## Methods:

### Method overview:

- attpointdist
- attpointsize
- camrotfix
- checkmax
- checkmin
- checktype
- clearparticles
- color
- colormul
- create
- defaultpath
- drawlayer
- forceinstance
- getrestype
- inside
- instancemesh
- lightmap
- lightmapmatrix
- matsurface
- model
- nogpu
- originoffset
- particlecolor
- particlenormal
- particlerotate
- pointsize
- probability
- probabilityfadeout
- range
- rotatedirection
- sequencecount
- sizemul
- smoothpoints
- sort
- typehemisphere
- typemodel
- typepoint
- typequad
- typesphere
- typetriangle
- usecolormul
- useoriginoffset
- useprobability
- usesizemul
- useworldaxis
- visflag
- worldaxis

attpointdist (particlecloud,[float const,lin,quad])
  returns: ([float const,lin,quad])
  gets or sets automatic point size attenuation along with the min and max values from pointsize.
attpointsize (particlecloud,[float min,max,alpha])
  returns: ([float min,max,alpha])
  gets or sets the automatic point parameter sizes. Combined with pointdist you can define how point particles should change size depending on distance.
camrotfix (particlecloud,[boolean])
  returns: ([boolean])
  gets or sets if particle rotation is influenced by the camera orientation. Fixes billboard rotation issues when we look 'down' on particles, but will rotate them if we are the same plane as well.
checkmax (particlecloud,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets maximum of the check boundingbox.
checkmin (particlecloud,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets minimum of the check boundingbox.
checktype (particlecloud,[int])
  returns: ([int])
  returns or sets what kind of axis aligned bounding box check should be done. Only particles within the box (defined by checkmin/max) are drawn. Checks performed are:
  1 = x-axis
  2 = y-axis
  3 = x,y-axis
  4 = z-axis
  5 = x,z-axis
  6 = y,z-axis
  7 = all axis
  any other value = no check (default)
clearparticles (particlecloud)
  returns: ()
  delets all active particles
color (particlecloud,[float r,g,b,a])
  returns: ([float r,g,b,a])
  gets or sets common color for all particles, if particlecolor is false.
colormul (particlecloud,[float r,g,b,a])
  returns: ([float r,g,b,a])
  color multiplier applied when usecolormul is true
create (string name,int particlecount,[int sortkey])
  returns: (particlecloud)
  creates a particlecloud with the number of given particles, the name is just a identifier. However make sure to pick a unique name, else a old cloud will be returned.
defaultpath ([string])
  returns: ([string])
  returns or sets the default resource path. Luxinia will search in those when resources are not found.
drawlayer (particlecloud,[l3dlayerid])
  returns: ()
  at the end of which layer it will be drawn, l3dset info is ignored.
forceinstance (particlecloud,[boolean])
  returns: ([boolean])
  will use instancing rendering even for the small normally batched billboards
getrestype ()
  returns: (int restype)
  returns the resource type as int value, useful for resdata or reschunk functions
inside (particlecloud,[boolean])
  returns: ([boolean])
  gets or sets insideflag, if it is set and range is specified particles need to be within the range to be rendered.
instancemesh (particlecloud,string meshname)
  returns: (boolean)
  sets the instance mesh. Trys to lookup the mesh in the model that is used for rendering. If the mesh is small (only triangles/quads, max 32 vertices, 96 indices) we can instance it. Returns true on success
lightmap (particlecloud,[texture])
  returns: ([texture])
  lightmap texture to be used. for texture coordinates the world space positions are transformed with lightmapmatrix
lightmapmatrix (particlecloud,[matrix4x4])
  returns: ([matrix4x4])
  generates texture coordinates when lightmap is used.
matsurface (particlecloud,[matsurface])
  returns: ([material/texture])
  gets or sets what kind of material/texture should be used. If your textures contain combined sequences use sequencecount to set how many.
model (particlecloud,[model])
  returns: ([model])
  gets or sets model, only will be used if pcloud type is also set to model.
nogpu (particlecloud,[boolean])
  returns: ([boolean])
  wont use the default gpu programs
originoffset (particlecloud,[float x,y,z])
  returns: ([float x,y,z])
  returns or sets vector that is added to the generic quad/triangle center. Only applied if useoriginoffset is true.
particlecolor (particlecloud,[boolean])
  returns: ([boolean])
  gets or sets if particles have their own colors.
particlenormal (particlecloud,[boolean])
  returns: ([boolean])
  will use particle's normal. Only applied when instancing renderpath is used.
particlerotate (particlecloud,[boolean])
  returns: ([boolean])
  gets or sets if particles can have rotation.
pointsize (particlecloud,[float])
  returns: ([float])
  gets or sets particle pointsize for typepoint, size is in pixels at 640x480.
probability (particlecloud,[float])
  returns: ([float])
  percentage of how many particles are rendered when useprobability is true
probabilityfadeout (particlecloud,[float])
  returns: ([float])
  fadeout threshold. when particle's render probability is between probability-thresh its color alpha will be interpolated accordingly. The more it closes the probability value the less its alpha will be.
range (particlecloud,[float])
  returns: ([float])
  gets or sets range for particles, depending on the 'inside' flag, particles are either only drawn when inside range or outside.
rotatedirection (particlecloud,[boolean])
  returns: ([boolean])
  automaticall rotates into the direction their normals point.
sequencecount (particlecloud,[int])
  returns: ([int])
  gets or sets number of sequence items that the material holds.
sizemul (particlecloud,[float])
  returns: ([float])
  size multiplier applied when usesizemul is true
smoothpoints (particlecloud,[boolean])
  returns: ([boolean])
  gets or sets if points should be smoothed.
sort (particlecloud,[boolean])
  returns: ([boolean])
  gets or sets z-sort state, setting can be good for some blendtypes.
typehemisphere (particlecloud)
  returns: ()
  hemisphere facing towards camera.
typemodel (particlecloud)
  returns: ()
  meshes taken from the given model, very expensive. Set the model with 'model' command. Faster if instancemesh is used.
typepoint (particlecloud)
  returns: ()
  just simple points, some systems may have capability for simple textured sprites. particle sizes will be ignored. but using pointsize (default 32) and attpointsize/dist you can influence the sizes.
typequad (particlecloud)
  returns: ()
  quad facing towards camera. origin at center
typesphere (particlecloud)
  returns: ()
  spheres, that can be lit but are yet untextured
typetriangle (particlecloud)
  returns: ()
  a single triangle facing camera
usecolormul (particlecloud,[boolean])
  returns: ([boolean])
  if set output colors are multipiled with colormul
useoriginoffset (particlecloud,[boolean])
  returns: ([boolean])
  if set the quads/triangles center will be moved by the originoffset vector. Useful to create particles that dont have their center in the middle.
useprobability (particlecloud,[boolean])
  returns: ([boolean])
  if set not all particles are drawn but user given percentage
usesizemul (particlecloud,[boolean])
  returns: ([boolean])
  if set output size is multiplied with sizemul
useworldaxis (particlecloud,[boolean])
  returns: ([boolean])
  when set the billboards will be aligned with the user given world axis and not face camera.
visflag (particlecloud,int id,[boolean])
  returns: ([boolean])
  sets visibility bit flag, default is true for id 1 and false for rest. It is bitwise 'and'ed with camera bitid to decide if particles should be drawn.
worldaxis (particlecloud,[matrix4x4])
  returns: ([matrix4x4])
  the user given align matrix for all billboards when useworldaxis is true. It will remove the camrotfix flag as it is unneeded.

## Inherited Methods:

### From resource

condition, getresname, getresshortname, resuserstring