#include <shader_lightlist.h>
Public Member Functions | |
LightIterator (miState *state, miTag *shader_light_list=0, int n_shader_lights=0, int version=mi_ray_interface_version) | |
construct a LightIterator | |
LightIterator (miState *state, const miVector &axis, miScalar spread_cos, miTag *shader_light_list=0, int n_shader_lights=0, int version=mi_ray_interface_version) | |
construct a LightIterator | |
LightIterator (const LightIterator &liter) | |
copy constructor | |
~LightIterator () | |
destructor | |
miTag | operator * () const |
obtain current light tag | |
LightList * | operator-> () const |
access to light list from iterator | |
const LightIterator & | operator++ () |
pre-increment LightIterator | |
LightIterator | operator++ (int) |
post-increment LightIterator | |
bool | at_end () const |
check if iterator has reached end | |
const LightIterator & | operator= (const LightIterator &iter) |
assign LightIterator | |
bool | operator== (const LightIterator &iter) const |
compare LightIterators for equality | |
bool | operator!= (const LightIterator &iter) const |
compare LightIterators for inequality |
mental ray 3.5 introduces the concept of instance light lists. These lists are not explicitely passed to the shader as a parameter. Instead mental ray makes them available through LightIterators. The LightIterator class allows shaders to iterate over lights for the purpose of sampling. A typical use would look like
for (mi::shader::LightIterator iter(state); !iter.at_end(); ++iter) { miColor col = {0,0,0,1}; while (iter->sample()) { miColor light_color; iter->get_contribution(&light_color); col.r += light_color.r; col.g += light_color.g; col.b += light_color.b; } const int n_samples = iter->get_number_of_samples(); if (n_samples > 1) { col.r /= n_samples; col.g /= n_samples; col.b /= n_samples; } }
|
construct a LightIterator Note that two different light lists may be assigned to instances: a light list and a shadow light list. During regular rendering the iterator uses the light list, but when either rendering shadow maps or tracing shadow rays, then the iterator prefers the shadow light list over the light list, that is, in these cases the light list will only be used if no shadow light list is present. It is also possible to instanciate the iterator with an explicit light list provided by the shader.
|
|
construct a LightIterator The cone for light samples is defined by axis and the cosine of the angle.
|
|
copy constructor creates a copy of a given LightIterator. This constructor is needed to return LightIterators from methods.
|
|
destructor The destructor for a LightIterator instance is called when it goes out of scope. It releases all resources associated with this instance. |
|
check if iterator has reached end
|
|
obtain current light tag dereferencing a LightIterator with the unary prefix operator '*' yields the tag of the current light. Note that this operation is distinctly different from dereferencing a LightIterator with the postfix operator '->'.
|
|
compare LightIterators for inequality Two LightIterators are unequal if they do not refer to the same LightList or have two different current lights within the list.
|
|
post-increment LightIterator The increment operator advances the LightIterator to the next light in the light list.
|
|
pre-increment LightIterator The operator advances the LightIterator to the next light in the light list.
|
|
access to light list from iterator the postfix dereference operator '->' allows to invoke public methods of the LightList class as if they would be methods of the LightIterator class.
|
|
assign LightIterator assigns a LightIterator to another one. |
|
compare LightIterators for equality Two LightIterators are considered equal if they refer to the same light list and have the same current light within the list.
|
Copyright © 1986-2008 by
mental images GmbH