Panda3D
Loading...
Searching...
No Matches
iesDataset.h
1/**
2 *
3 * RenderPipeline
4 *
5 * Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 *
25 */
26
27#ifndef IESDATASET_H
28#define IESDATASET_H
29
30#include "pandabase.h"
31#include "pta_float.h"
32#include "pointerToArray.h"
33#include "texture.h"
34#include "pnmImage.h"
35
36NotifyCategoryDecl(iesdataset, EXPORT_CLASS, EXPORT_TEMPL);
37
38
39/**
40 * @brief This class generates a LUT from IES data.
41 * @details This class is used by the IESLoader to generate a LUT texture which
42 * is used in the shaders to perform IES lighting. It takes a set of vertical
43 * and horizontal angles, as well as a set of candela values, which then are
44 * lineary interpolated onto a 2D LUT Texture.
45 */
47PUBLISHED:
48 IESDataset();
49
50 void set_vertical_angles(const PTA_float &vertical_angles);
51 void set_horizontal_angles(const PTA_float &horizontal_angles);
52 void set_candela_values(const PTA_float &candela_values);
53
54 void generate_dataset_texture_into(Texture* dest_tex, size_t z) const;
55
56public:
57
58 float get_candela_value(float vertical_angle, float horizontal_angle) const;
59 float get_candela_value_from_index(size_t vertical_angle_idx, size_t horizontal_angle_idx) const;
60 float get_vertical_candela_value(size_t horizontal_angle_idx, float vertical_angle) const;
61
62private:
63 PTA_float _vertical_angles;
64 PTA_float _horizontal_angles;
65 PTA_float _candela_values;
66};
67
68#endif // IESDATASET_H
This class generates a LUT from IES data.
Definition iesDataset.h:46
void generate_dataset_texture_into(Texture *dest_tex, size_t z) const
Generates the IES LUT.
void set_candela_values(const PTA_float &candela_values)
Sets the candela values.
float get_candela_value_from_index(size_t vertical_angle_idx, size_t horizontal_angle_idx) const
Internal method to access the candela data.
void set_vertical_angles(const PTA_float &vertical_angles)
Sets the vertical angles of the dataset.
float get_candela_value(float vertical_angle, float horizontal_angle) const
Samples the dataset at the given position.
float get_vertical_candela_value(size_t horizontal_angle_idx, float vertical_angle) const
Fetches a vertical candela value.
void set_horizontal_angles(const PTA_float &horizontal_angles)
Sets the horizontal angles of the dataset.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition texture.h:72
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.