mi::shader::LightList Class Reference

Light lists, used internally by LightIterator. More...

#include <shader_lightlist.h>

List of all members.

Public Member Functions

virtual size_t set_current (size_t current)=0
 set current light
virtual size_t get_current () const =0
 get current light index
virtual bool sample ()=0
 sample light source
virtual miScalar get_dot_nl () const =0
 dot prod. light dir, normal
virtual const miVector & get_direction () const =0
 get direction of sample
virtual void get_contribution (miColor *c) const =0
 get color contribution
virtual void get_contribution (miSpectrum *s) const =0
 get spectrum contribution
virtual int get_number_of_samples () const =0
 get current number of samples
virtual miTag get_light_tag (size_t current) const =0
 get current light tag
virtual size_t get_number_of_lights () const =0
 get number of lights in list
virtual void connect ()=0
 used for reference counting
virtual void release ()=0
 release resource if not ref'ed


Detailed Description

Light lists, used internally by LightIterator.

The LightList class manages the iteration over light sources. The class is only used internally by the LightIterator class. The class is reference counted to allow several iterators to refer to the same light list. However, the class maintains only one cache for the results of light sampling. Therefore, if there are several LightIterators referencing the same light list, then most of the class "get" methods will return results obtained from the most recent call of the sample method.


Member Function Documentation

virtual void mi::shader::LightList::connect  )  [pure virtual]
 

used for reference counting

Tell the light list that one more object (most likely a LightIterator) has connected to the list. As long as there are objects connected, the light list is not deleted.

virtual void mi::shader::LightList::get_contribution miSpectrum *  s  )  const [pure virtual]
 

get spectrum contribution

The method gets the cached spectrum contribution obtained from the light source during the last sampling.

Parameters:
s will on return contain the spectrum contribution of the light source.

virtual void mi::shader::LightList::get_contribution miColor *  c  )  const [pure virtual]
 

get color contribution

The method gets the cached color contribution obtained from the light source during the last sampling.

Parameters:
c will on return contain the color contribution of the light source.

virtual size_t mi::shader::LightList::get_current  )  const [pure virtual]
 

get current light index

The method is used by light iterators to obtain the current light index

Returns:
the current light index

virtual const miVector& mi::shader::LightList::get_direction  )  const [pure virtual]
 

get direction of sample

Returns:
the direction vector to the light source, as obtained and cached during the last sampling.

virtual miScalar mi::shader::LightList::get_dot_nl  )  const [pure virtual]
 

dot prod. light dir, normal

Returns:
the dot product between the light direction and the surface normal, as obtained and chached during the last sampling.

virtual miTag mi::shader::LightList::get_light_tag size_t  current  )  const [pure virtual]
 

get current light tag

The method obtains the light tag at the current'th position in the light list.

Parameters:
current gives the index of the light in the list.
Returns:
the light tag at the requested position in the list.

virtual size_t mi::shader::LightList::get_number_of_lights  )  const [pure virtual]
 

get number of lights in list

Returns:
the number of lights in the light list.

virtual int mi::shader::LightList::get_number_of_samples  )  const [pure virtual]
 

get current number of samples

The method should be invoked after the sample method returned false. It allows to weight the color/spectrum contributions of a light source with the number of samples taken.

Returns:
the number of samples taken for the current light source.

virtual void mi::shader::LightList::release  )  [pure virtual]
 

release resource if not ref'ed

Tell the light list that an object (most likely a LightIterator) releases its connection to the list. If there are no more connections left, then the LightList will be deleted.

virtual bool mi::shader::LightList::sample  )  [pure virtual]
 

sample light source

The method samples the current light and caches the obtained results

Returns:
true if a sample was obtained and further samples should be taken, false if no further samples are required.

virtual size_t mi::shader::LightList::set_current size_t  current  )  [pure virtual]
 

set current light

The method is used by light iterators to set the light list to the wanted light. It is used when dereferencing a light iterator to specify which light should be sampled.

Parameters:
current identifies the light to be made the current one.
Returns:
the current light index


The documentation for this class was generated from the following file:

Copyright © 1986-2008 by mental images GmbH