This class generates a LUT from IES data. More...
#include "iesDataset.h"
Public Member Functions | |
void | generate_dataset_texture_into (Texture *dest_tex, size_t z) const |
Generates the IES LUT. More... | |
float | get_candela_value (float vertical_angle, float horizontal_angle) const |
Samples the dataset at the given position. More... | |
float | get_candela_value_from_index (size_t vertical_angle_idx, size_t horizontal_angle_idx) const |
Internal method to access the candela data. More... | |
float | get_vertical_candela_value (size_t horizontal_angle_idx, float vertical_angle) const |
Fetches a vertical candela value. More... | |
void | set_candela_values (const PTA_float &candela_values) |
Sets the candela values. More... | |
void | set_horizontal_angles (const PTA_float &horizontal_angles) |
Sets the horizontal angles of the dataset. More... | |
void | set_vertical_angles (const PTA_float &vertical_angles) |
Sets the vertical angles of the dataset. More... | |
This class generates a LUT from IES data.
This class is used by the IESLoader to generate a LUT texture which is used in the shaders to perform IES lighting. It takes a set of vertical and horizontal angles, as well as a set of candela values, which then are lineary interpolated onto a 2D LUT Texture.
Definition at line 46 of file iesDataset.h.
void IESDataset::generate_dataset_texture_into | ( | Texture * | dest_tex, |
size_t | z | ||
) | const |
Generates the IES LUT.
This generates the LUT into a given dataset texture. The x-axis referes to the vertical_angle, whereas the y-axis refers to the horizontal angle.
dest_tex | Texture to write the LUT into |
z | Layer to write the LUT into, in case the texture is a 3D Texture or 2D Texture Array. |
Definition at line 214 of file iesDataset.cxx.
References get_candela_value(), Texture::get_x_size, Texture::get_y_size, Texture::load(), and PNMImage::set_xel().
float IESDataset::get_candela_value | ( | float | vertical_angle, |
float | horizontal_angle | ||
) | const |
Samples the dataset at the given position.
This looks up a value in the dataset, by specifying a horizontal and vertical angle. This is used for generating the LUT. The vertical and horizontal angle should be inside of the bounds of the vertical and horizontal angle arrays.
vertical_angle | Vertical angle, from 0 .. 90 or 0 .. 180 depending on the dataset |
horizontal_angle | Horizontal angle, from 0 .. 180 or 0 .. 360 depending on the dataset. |
Definition at line 106 of file iesDataset.cxx.
References get_vertical_candela_value().
Referenced by generate_dataset_texture_into().
float IESDataset::get_candela_value_from_index | ( | size_t | vertical_angle_idx, |
size_t | horizontal_angle_idx | ||
) | const |
Internal method to access the candela data.
This lookups a candela value in the candela values. It converts a two dimensional index to a onedimensional index and then returns the candela value at that position.
vertical_angle_idx | Index of the vertical angle |
horizontal_angle_idx | Index of the horizontal angle |
Definition at line 89 of file iesDataset.cxx.
float IESDataset::get_vertical_candela_value | ( | size_t | horizontal_angle_idx, |
float | vertical_angle | ||
) | const |
Fetches a vertical candela value.
Fetches a vertical candela value, using a given horizontal position. This does an 1D interpolation in the candela values array.
horizontal_angle_idx | The index of the horizontal angle in the horizontal angle array. |
vertical_angle | The vertical angle. Interpolation will be done if the vertical angle is not in the vertical angles array. |
Definition at line 166 of file iesDataset.cxx.
Referenced by get_candela_value().
void IESDataset::set_candela_values | ( | const PTA_float & | candela_values | ) |
Sets the candela values.
This sets the candela values of the dataset. They should be an interleaved 2D array with the dimensions vertical_angles x horizontal_angles. They also should be normalized by dividing by the maximum entry.
candela_values | Interleaved 2D-vector of candela values. |
Definition at line 73 of file iesDataset.cxx.
void IESDataset::set_horizontal_angles | ( | const PTA_float & | horizontal_angles | ) |
Sets the horizontal angles of the dataset.
This sets the list of horizontal angles of the dataset.
horizontal_angles | Vector of all horizontal angles. |
Definition at line 61 of file iesDataset.cxx.
void IESDataset::set_vertical_angles | ( | const PTA_float & | vertical_angles | ) |
Sets the vertical angles of the dataset.
This sets the list of vertical angles of the dataset.
vertical_angles | Vector of all vertical angles. |
Definition at line 50 of file iesDataset.cxx.