Panda3D
Public Member Functions | List of all members
IESDataset Class Reference

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...
 

Detailed Description

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.

Member Function Documentation

◆ generate_dataset_texture_into()

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.

Parameters
dest_texTexture to write the LUT into
zLayer 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().

◆ get_candela_value()

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.

Parameters
vertical_angleVertical angle, from 0 .. 90 or 0 .. 180 depending on the dataset
horizontal_angleHorizontal angle, from 0 .. 180 or 0 .. 360 depending on the dataset.
Returns
Candela value between 0 .. 1

Definition at line 106 of file iesDataset.cxx.

References get_vertical_candela_value().

Referenced by generate_dataset_texture_into().

◆ get_candela_value_from_index()

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.

Parameters
vertical_angle_idxIndex of the vertical angle
horizontal_angle_idxIndex of the horizontal angle
Returns
Candela value between 0 .. 1

Definition at line 89 of file iesDataset.cxx.

◆ get_vertical_candela_value()

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.

Parameters
horizontal_angle_idxThe index of the horizontal angle in the horizontal angle array.
vertical_angleThe vertical angle. Interpolation will be done if the vertical angle is not in the vertical angles array.
Returns
Candela value between 0 .. 1

Definition at line 166 of file iesDataset.cxx.

Referenced by get_candela_value().

◆ set_candela_values()

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.

Parameters
candela_valuesInterleaved 2D-vector of candela values.

Definition at line 73 of file iesDataset.cxx.

◆ set_horizontal_angles()

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.

Parameters
horizontal_anglesVector of all horizontal angles.

Definition at line 61 of file iesDataset.cxx.

◆ set_vertical_angles()

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.

Parameters
vertical_anglesVector of all vertical angles.

Definition at line 50 of file iesDataset.cxx.


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