mi::shader_v3::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
 sets the current light in the light list
virtual size_t get_current () const =0
 get the index of the current light
virtual bool sample ()=0
 sample the current light source
virtual miScalar get_dot_nl () const =0
 return dot product between light direction and surface normal
virtual const miVector & get_direction () const =0
 return the direction to the light source
virtual void get_contribution (miColor *c) const =0
 get the color contribution of the light source
virtual void get_contribution (miSpectrum *s) const =0
 get the spectrum contribution of the light source
virtual int get_number_of_samples () const =0
 returns the number of light samples taken so far.
virtual miTag get_light_tag (size_t current) const =0
 get the requested light tag
virtual size_t get_number_of_lights () const =0
 obtain the number of lights in the list
virtual void connect ()=0
 increase reference count
virtual void release ()=0
 decrease reference count


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 size_t mi::shader_v3::LightList::set_current ( size_t  current  )  [pure virtual]

sets the current light in the light list

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

Referenced by mi::shader_v3::LightIterator::operator->().

virtual size_t mi::shader_v3::LightList::get_current (  )  const [pure virtual]

get the index of the current light

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

Returns:
the current light index

virtual bool mi::shader_v3::LightList::sample (  )  [pure virtual]

sample the current 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 miScalar mi::shader_v3::LightList::get_dot_nl (  )  const [pure virtual]

return dot product between light direction and surface normal

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

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

return the direction to the light source

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

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

get the color contribution of the light source

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

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

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

get the spectrum contribution of the light source

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

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

virtual int mi::shader_v3::LightList::get_number_of_samples (  )  const [pure virtual]

returns the number of light samples taken so far.

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 miTag mi::shader_v3::LightList::get_light_tag ( size_t  current  )  const [pure virtual]

get the requested 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.

Referenced by mi::shader_v3::LightIterator::operator*().

virtual size_t mi::shader_v3::LightList::get_number_of_lights (  )  const [pure virtual]

obtain the number of lights in the list

Returns:
the number of lights in the light list.

Referenced by mi::shader_v3::LightIterator::at_end().

virtual void mi::shader_v3::LightList::connect (  )  [pure virtual]

increase reference count

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.

Referenced by mi::shader_v3::LightIterator::LightIterator(), and mi::shader_v3::LightIterator::operator=().

virtual void mi::shader_v3::LightList::release (  )  [pure virtual]

decrease reference count

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.

Referenced by mi::shader_v3::LightIterator::operator=(), and mi::shader_v3::LightIterator::~LightIterator().

Copyright © 1986-2011 by mental images GmbH