39 _light_type = light_type;
40 _needs_update =
false;
41 _casts_shadows =
false;
46 _source_resolution = 512;
67 nassertv(_shadow_sources.size() >= 0);
68 nassertv(_shadow_sources[0]->
has_slot());
106 float mm = 1000.0 / temperature;
108 float mm3 = mm2 * mm;
111 if (temperature < 4000) {
112 x = -0.2661239 * mm3 - 0.2343580 * mm2 + 0.8776956 * mm + 0.179910;
114 x = -3.0258469 * mm3 + 2.1070379 * mm2 + 0.2226347 * mm + 0.240390;
119 if (temperature < 2222) {
120 y = -1.1063814 * x3 - 1.34811020 * x2 + 2.18555832 * x - 0.20219683;
121 }
else if (temperature < 4000) {
122 y = -0.9549476 * x3 - 1.37418593 * x2 + 2.09137015 * x - 0.16748867;
124 y = 3.0817580 * x3 - 5.87338670 * x2 + 3.75112997 * x - 0.37001483;
128 LVecBase3 xyz(x / y, 1, (1 - x - y) / y);
131 const static LMatrix3 xyz_to_rgb(
132 3.2406, -0.9689, 0.0557,
133 -1.5372, 1.8758, -0.2050,
134 -0.4986, 0.0415, 1.0570);
RPLight(LightType light_type)
RenderPipeline.
virtual ~RPLight()
Light destructor.
void set_color_from_temperature(float temperature)
Sets the lights color from a given color temperature.
set_color
Sets the lights color.
void clear_shadow_sources()
Clears all shadow source.
bool has_slot() const
Returns whether the light has a slot.
virtual void write_to_command(GPUCommand &cmd)
Writes the light to a GPUCommand.
void push_vec3(const LVecBase3 &v)
Appends a 3-component floating point vector to the GPUCommand.
LightType
Different types of light.
Class for storing data to be transferred to the GPU.
int get_slot() const
Returns the slot of the light.
void push_int(int v)
RenderPipeline.