Unravel Engine C++ Reference
Loading...
Searching...
No Matches
light_component.cpp
Go to the documentation of this file.
1#include "light_component.hpp"
2
6
9
10namespace unravel
11{
13{
14 entt::meta_factory<light_component>{}
15 .type("light_component"_hs)
17 entt::attribute{"name", "light_component"},
18 entt::attribute{"category", "LIGHTING"},
19 entt::attribute{"pretty_name", "Light"},
20 })
21 .func<&component_meta<light_component>::exists>("component_exists"_hs)
22 .func<&component_meta<light_component>::add>("component_add"_hs)
23 .func<&component_meta<light_component>::save>("component_save"_hs)
24 .func<&component_meta<light_component>::load>("component_load"_hs)
25 .func<&component_meta<light_component>::remove>("component_remove"_hs)
27 .custom<entt::attributes>(entt::attributes{
28 entt::attribute{"name", "light"},
29 entt::attribute{"pretty_name", "Light"},
30 });
31}
32
34{
35 try_save(ar, ser20::make_nvp("light", obj.get_light()));
36}
39
41{
42 light l;
43 try_load(ar, ser20::make_nvp("light", l));
44 obj.set_light(l);
45}
48
50{
51 auto skybox_predicate_entt = entt::property_predicate<bool>([](const entt::meta_any& obj)
52 {
53 auto data = obj.try_cast<skylight_component>();
55 });
56
57
58 auto dynamic_sky_predicate_entt = entt::property_predicate<bool>([](const entt::meta_any& obj)
59 {
60 auto data = obj.try_cast<skylight_component>();
62 });
63
64 auto perez_predicate_entt = entt::property_predicate<bool>([](const entt::meta_any& obj)
65 {
66 auto data = obj.try_cast<skylight_component>();
68 });
69
70 auto clouds_enabled_predicate_entt = entt::property_predicate<bool>([](const entt::meta_any& obj)
71 {
72 auto data = obj.try_cast<skylight_component>();
74 && data->get_cloud_mode() != skylight_component::cloud_mode::none;
75 });
76
77 auto volumetric_clouds_predicate_entt = entt::property_predicate<bool>([](const entt::meta_any& obj)
78 {
79 auto data = obj.try_cast<skylight_component>();
81 && data->get_cloud_mode() == skylight_component::cloud_mode::volumetric;
82 });
83
84 // Register skylight_component::sky_mode enum with entt
85 entt::meta_factory<skylight_component::sky_mode>{}
86 .type("sky_mode"_hs)
88 entt::attribute{"name", "sky_mode"},
89 entt::attribute{"pretty_name", "Sky Mode"},
90 })
91 // .data<skylight_component::sky_mode::reserved_0>("reserved_0"_hs)
92 // .custom<entt::attributes>(entt::attributes{
93 // entt::attribute{"name", "standard"},
94 // entt::attribute{"pretty_name", "Standard"},
95 // })
96 .data<skylight_component::sky_mode::perez>("perez"_hs)
98 entt::attribute{"name", "perez"},
99 entt::attribute{"pretty_name", "Perez"},
100 })
101 .data<skylight_component::sky_mode::skybox>("skybox"_hs)
103 entt::attribute{"name", "skybox"},
104 entt::attribute{"pretty_name", "Skybox"},
105 });
106
107 // Register skylight_component::irradiance_quality enum with entt
108 entt::meta_factory<skylight_component::irradiance_quality>{}
109 .type("irradiance_quality"_hs)
111 entt::attribute{"name", "irradiance_quality"},
112 entt::attribute{"pretty_name", "Irradiance Quality"},
113 })
114 .data<skylight_component::irradiance_quality::flat>("flat"_hs)
116 entt::attribute{"name", "flat"},
117 entt::attribute{"pretty_name", "Flat"},
118 entt::attribute{"tooltip", "Flat ambient (L0 only): same color for every surface normal."},
119 })
120 .data<skylight_component::irradiance_quality::directional>("directional"_hs)
122 entt::attribute{"name", "directional"},
123 entt::attribute{"pretty_name", "Directional"},
124 entt::attribute{"tooltip", "Directional ambient (L0-L2 spherical harmonics): varies with the surface normal."},
125 });
126
127 entt::meta_factory<skylight_component::cloud_mode>{}
128 .type("cloud_mode"_hs)
130 entt::attribute{"name", "cloud_mode"},
131 entt::attribute{"pretty_name", "Cloud Mode"},
132 })
133 .data<skylight_component::cloud_mode::none>("none"_hs)
135 entt::attribute{"name", "none"},
136 entt::attribute{"pretty_name", "None"},
137 entt::attribute{"tooltip", "No clouds rendered."},
138 })
139 .data<skylight_component::cloud_mode::flat>("flat"_hs)
141 entt::attribute{"name", "flat"},
142 entt::attribute{"pretty_name", "Flat"},
143 entt::attribute{"tooltip", "Flat projected clouds. Cheap single-sample scattering on a dome plane."},
144 })
145 .data<skylight_component::cloud_mode::volumetric>("volumetric"_hs)
147 entt::attribute{"name", "volumetric"},
148 entt::attribute{"pretty_name", "Volumetric"},
149 entt::attribute{"tooltip", "Volumetric raymarched clouds. Full scattering at half resolution with temporal blending."},
150 });
151
152 // Register skylight_component class with entt
153 entt::meta_factory<skylight_component>{}
154 .type("skylight_component"_hs)
156 entt::attribute{"name", "skylight_component"},
157 entt::attribute{"category", "LIGHTING"},
158 entt::attribute{"pretty_name", "Skylight"},
159 })
160 .func<&component_meta<skylight_component>::exists>("component_exists"_hs)
161 .func<&component_meta<skylight_component>::add>("component_add"_hs)
162 .func<&component_meta<skylight_component>::save>("component_save"_hs)
163 .func<&component_meta<skylight_component>::load>("component_load"_hs)
164 .func<&component_meta<skylight_component>::remove>("component_remove"_hs)
166 .custom<entt::attributes>(entt::attributes{
167 entt::attribute{"name", "mode"},
168 entt::attribute{"pretty_name", "Mode"},
169 })
170 .data<&skylight_component::set_sky_brightness, &skylight_component::get_sky_brightness>("sky_brightness"_hs)
172 entt::attribute{"name", "sky_brightness"},
173 entt::attribute{"pretty_name", "Sky Brightness"},
174 entt::attribute{"min", 0.0f},
175 entt::attribute{"max", 4.0f},
176 entt::attribute{"step", 0.05f},
177 entt::attribute{"tooltip", "Brightness multiplier for sky and irradiance (1.0 = neutral)."},
178 })
179 .data<&skylight_component::set_turbidity, &skylight_component::get_turbidity>("turbidity"_hs)
181 entt::attribute{"name", "turbidity"},
182 entt::attribute{"pretty_name", "Turbidity"},
183 entt::attribute{"min", 1.9f},
184 entt::attribute{"max", 10.0f},
185 entt::attribute{"tooltip", "Adjusts the clarity of the atmosphere. Lower values (1.9) result in a clear, blue sky, while higher values (up to 10) create a hazy, diffused appearance with more scattering of light.."},
186 entt::attribute{"predicate", dynamic_sky_predicate_entt},
187 })
188 .data<&skylight_component::set_cloud_mode, &skylight_component::get_cloud_mode>("cloud_mode"_hs)
190 entt::attribute{"name", "cloud_mode"},
191 entt::attribute{"pretty_name", "Cloud Mode"},
192 entt::attribute{"group", "Clouds"},
193 entt::attribute{"tooltip", "Cloud rendering mode. None disables clouds, Flat uses cheap projected clouds, Volumetric uses full raymarched clouds."},
194 entt::attribute{"predicate", dynamic_sky_predicate_entt},
195 })
196 .data<&skylight_component::set_cloud_coverage, &skylight_component::get_cloud_coverage>("cloud_coverage"_hs)
198 entt::attribute{"name", "cloud_coverage"},
199 entt::attribute{"pretty_name", "Cloud Coverage"},
200 entt::attribute{"group", "Clouds"},
201 entt::attribute{"min", 0.0f},
202 entt::attribute{"max", 1.0f},
203 entt::attribute{"tooltip", "Controls cloud density. 0.0 = clear sky, 1.0 = overcast. Higher values create more clouds by lowering the density threshold."},
204 entt::attribute{"predicate", clouds_enabled_predicate_entt},
205 })
206 .data<&skylight_component::set_cloud_base_altitude, &skylight_component::get_cloud_base_altitude>("cloud_base_altitude"_hs)
208 entt::attribute{"name", "cloud_base_altitude"},
209 entt::attribute{"pretty_name", "Cloud Base Altitude"},
210 entt::attribute{"group", "Clouds"},
211 entt::attribute{"min", 100.0f},
212 entt::attribute{"max", 60000.0f},
213 entt::attribute{"step", 500.0f},
214 entt::attribute{"tooltip", "Cloud layer base altitude in world units. Volumetric: slab bottom. Flat: projection height."},
215 entt::attribute{"predicate", clouds_enabled_predicate_entt},
216 })
217 .data<&skylight_component::set_cloud_top_altitude, &skylight_component::get_cloud_top_altitude>("cloud_top_altitude"_hs)
219 entt::attribute{"name", "cloud_top_altitude"},
220 entt::attribute{"pretty_name", "Cloud Top Altitude"},
221 entt::attribute{"group", "Clouds"},
222 entt::attribute{"min", 200.0f},
223 entt::attribute{"max", 80000.0f},
224 entt::attribute{"step", 500.0f},
225 entt::attribute{"tooltip", "Cloud layer top altitude in world units. Only used by volumetric clouds (slab top). Flat clouds ignore this."},
226 entt::attribute{"predicate", clouds_enabled_predicate_entt},
227
228 })
229 .data<&skylight_component::set_cloud_speed, &skylight_component::get_cloud_speed>("cloud_speed"_hs)
231 entt::attribute{"name", "cloud_speed"},
232 entt::attribute{"pretty_name", "Cloud Speed (km/h)"},
233 entt::attribute{"group", "Clouds"},
234 entt::attribute{"min", 0.0f},
235 entt::attribute{"max", 200.0f},
236 entt::attribute{"step", 1.0f},
237 entt::attribute{"tooltip", "Cloud wind speed in km/h. ~10 = gentle drift, ~50 = strong wind, ~100+ = storm."},
238 entt::attribute{"predicate", clouds_enabled_predicate_entt},
239 })
240 .data<&skylight_component::set_cloud_density, &skylight_component::get_cloud_density>("cloud_density"_hs)
242 entt::attribute{"name", "cloud_density"},
243 entt::attribute{"pretty_name", "Cloud Density"},
244 entt::attribute{"group", "Clouds"},
245 entt::attribute{"min", 0.0f},
246 entt::attribute{"max", 20.0f},
247 entt::attribute{"step", 0.05f},
248 entt::attribute{"tooltip", "Cloud opacity multiplier. Higher values make clouds more opaque and visible."},
249 entt::attribute{"predicate", clouds_enabled_predicate_entt},
250 })
251 .data<&skylight_component::set_cloud_absorption, &skylight_component::get_cloud_absorption>("cloud_absorption"_hs)
253 entt::attribute{"name", "cloud_absorption"},
254 entt::attribute{"pretty_name", "Cloud Absorption"},
255 entt::attribute{"group", "Clouds"},
256 entt::attribute{"min", 0.01f},
257 entt::attribute{"max", 0.5f},
258 entt::attribute{"step", 0.01f},
259 entt::attribute{"tooltip", "Beer-Lambert extinction coefficient. Controls how quickly light is absorbed passing through the cloud. Higher = more opaque."},
260 entt::attribute{"predicate", clouds_enabled_predicate_entt},
261 })
262 .data<&skylight_component::set_cloud_light_absorption, &skylight_component::get_cloud_light_absorption>("cloud_light_absorption"_hs)
264 entt::attribute{"name", "cloud_light_absorption"},
265 entt::attribute{"pretty_name", "Cloud Light Absorption"},
266 entt::attribute{"group", "Clouds"},
267 entt::attribute{"min", 0.01f},
268 entt::attribute{"max", 0.5f},
269 entt::attribute{"step", 0.01f},
270 entt::attribute{"tooltip", "Self-shadow strength. Controls how much light is absorbed along the sun-facing direction. Higher = darker shadow side."},
271 entt::attribute{"predicate", clouds_enabled_predicate_entt},
272 })
273 .data<&skylight_component::set_cloud_vol_uv_scale, &skylight_component::get_cloud_vol_uv_scale>("cloud_vol_uv_scale"_hs)
275 entt::attribute{"name", "cloud_vol_uv_scale"},
276 entt::attribute{"pretty_name", "Vol. Noise UV Scale"},
277 entt::attribute{"group", "Volumetric"},
278 entt::attribute{"min", 0.00001f},
279 entt::attribute{"max", 0.001f},
280 entt::attribute{"step", 0.00001f},
281 entt::attribute{"tooltip", "World-to-noise scale; lower values produce larger cloud features."},
282 entt::attribute{"predicate", volumetric_clouds_predicate_entt},
283 })
284 .data<&skylight_component::set_cloud_vol_edge_width, &skylight_component::get_cloud_vol_edge_width>("cloud_vol_edge_width"_hs)
286 entt::attribute{"name", "cloud_vol_edge_width"},
287 entt::attribute{"pretty_name", "Vol. Edge Width"},
288 entt::attribute{"group", "Volumetric"},
289 entt::attribute{"min", 0.01f},
290 entt::attribute{"max", 0.8f},
291 entt::attribute{"step", 0.01f},
292 entt::attribute{"tooltip", "Width of the density ramp; lower = sharper cloud silhouettes."},
293 entt::attribute{"predicate", volumetric_clouds_predicate_entt},
294 })
295 .data<&skylight_component::set_cloud_vol_shape_power, &skylight_component::get_cloud_vol_shape_power>("cloud_vol_shape_power"_hs)
297 entt::attribute{"name", "cloud_vol_shape_power"},
298 entt::attribute{"pretty_name", "Vol. Shape Power"},
299 entt::attribute{"group", "Volumetric"},
300 entt::attribute{"min", 0.5f},
301 entt::attribute{"max", 4.0f},
302 entt::attribute{"step", 0.05f},
303 entt::attribute{"tooltip", "Contrast on the density mask; higher thins wispy regions."},
304 entt::attribute{"predicate", volumetric_clouds_predicate_entt},
305 })
306 .data<&skylight_component::set_cloud_vol_detail_erode, &skylight_component::get_cloud_vol_detail_erode>("cloud_vol_detail_erode"_hs)
308 entt::attribute{"name", "cloud_vol_detail_erode"},
309 entt::attribute{"pretty_name", "Vol. Detail Erode"},
310 entt::attribute{"group", "Volumetric"},
311 entt::attribute{"min", 0.0f},
312 entt::attribute{"max", 2.0f},
313 entt::attribute{"step", 0.02f},
314 entt::attribute{"tooltip", "Worley detail subtraction; higher adds more holes and wisps."},
315 entt::attribute{"predicate", volumetric_clouds_predicate_entt},
316 })
317 .data<&skylight_component::set_cloud_vol_macro_strength, &skylight_component::get_cloud_vol_macro_strength>("cloud_vol_macro_strength"_hs)
319 entt::attribute{"name", "cloud_vol_macro_strength"},
320 entt::attribute{"pretty_name", "Vol. Macro Variation"},
321 entt::attribute{"group", "Volumetric"},
322 entt::attribute{"min", 0.0f},
323 entt::attribute{"max", 1.5f},
324 entt::attribute{"step", 0.02f},
325 entt::attribute{"tooltip", "Strength of large-scale threshold jitter (clearings vs uniform sheet)."},
326 entt::attribute{"predicate", volumetric_clouds_predicate_entt},
327 })
328 .data<&skylight_component::set_cloud_vol_coarse_scale, &skylight_component::get_cloud_vol_coarse_scale>("cloud_vol_coarse_scale"_hs)
330 entt::attribute{"name", "cloud_vol_coarse_scale"},
331 entt::attribute{"pretty_name", "Vol. Coarse Scale"},
332 entt::attribute{"group", "Volumetric"},
333 entt::attribute{"min", 0.05f},
334 entt::attribute{"max", 1.0f},
335 entt::attribute{"step", 0.01f},
336 entt::attribute{"tooltip", "Scale of the coarse noise sample (lower = larger masses)."},
337 entt::attribute{"predicate", volumetric_clouds_predicate_entt},
338 })
339 .data<&skylight_component::set_cloud_vol_base_mix, &skylight_component::get_cloud_vol_base_mix>("cloud_vol_base_mix"_hs)
341 entt::attribute{"name", "cloud_vol_base_mix"},
342 entt::attribute{"pretty_name", "Vol. Coarse/Fine Mix"},
343 entt::attribute{"group", "Volumetric"},
344 entt::attribute{"min", 0.0f},
345 entt::attribute{"max", 1.0f},
346 entt::attribute{"step", 0.02f},
347 entt::attribute{"tooltip", "Blend between coarse and fine base noise (0 = coarse, 1 = fine)."},
348 entt::attribute{"predicate", volumetric_clouds_predicate_entt},
349 })
350 .data<&skylight_component::set_cloud_vol_sun_intensity, &skylight_component::get_cloud_vol_sun_intensity>("cloud_vol_sun_intensity"_hs)
352 entt::attribute{"name", "cloud_vol_sun_intensity"},
353 entt::attribute{"pretty_name", "Vol. Sun Intensity"},
354 entt::attribute{"group", "Volumetric"},
355 entt::attribute{"min", 0.0f},
356 entt::attribute{"max", 200.0f},
357 entt::attribute{"step", 1.0f},
358 entt::attribute{"tooltip", "Multiplier for direct sun scattering in the cloud integrator."},
359 entt::attribute{"predicate", volumetric_clouds_predicate_entt},
360 })
361 .data<&skylight_component::set_irradiance_intensity, &skylight_component::get_irradiance_intensity>("irradiance_intensity"_hs)
363 entt::attribute{"name", "irradiance_intensity"},
364 entt::attribute{"pretty_name", "Irradiance Intensity"},
365 entt::attribute{"group", "Irradiance"},
366 entt::attribute{"min", 0.0f},
367 entt::attribute{"max", 1.0f},
368 entt::attribute{"step", 0.01f},
369 entt::attribute{"tooltip", "Strength of indirect diffuse lighting from the sky."},
370 })
371 .data<&skylight_component::set_irradiance_tint, &skylight_component::get_irradiance_tint>("irradiance_tint"_hs)
373 entt::attribute{"name", "irradiance_tint"},
374 entt::attribute{"pretty_name", "Irradiance Tint"},
375 entt::attribute{"group", "Irradiance"},
376 entt::attribute{"tooltip", "Optional tint override for irradiance (white = use sky-derived color)."},
377 })
378 .data<&skylight_component::set_irradiance_quality, &skylight_component::get_irradiance_quality>("irradiance_quality"_hs)
380 entt::attribute{"name", "irradiance_quality"},
381 entt::attribute{"pretty_name", "Irradiance Quality"},
382 entt::attribute{"group", "Irradiance"},
383 entt::attribute{"tooltip", "Directional variation of the ambient: Flat (L0 only) or Directional (full spherical harmonics)."},
384 })
385 .data<&skylight_component::set_irradiance_use_sky, &skylight_component::get_irradiance_use_sky>("irradiance_use_sky"_hs)
387 entt::attribute{"name", "irradiance_use_sky"},
388 entt::attribute{"pretty_name", "Irradiance Sky Contribution"},
389 entt::attribute{"group", "Irradiance"},
390 entt::attribute{"tooltip", "When on, the ambient is tinted by the sky/environment color. When off, only the irradiance tint is used as a flat artist-defined ambient (sky ignored)."},
391 })
392 .data<&skylight_component::set_cubemap, &skylight_component::get_cubemap>("cubemap"_hs)
394 entt::attribute{"name", "cubemap"},
395 entt::attribute{"pretty_name", "Cubemap"},
396 entt::attribute{"predicate", skybox_predicate_entt},
397 });
398}
399
401{
402 try_save(ar, ser20::make_nvp("mode", obj.get_mode()));
403 try_save(ar, ser20::make_nvp("sky_brightness", obj.get_sky_brightness()));
404 try_save(ar, ser20::make_nvp("turbidity", obj.get_turbidity()));
405 try_save(ar, ser20::make_nvp("cloud_mode", obj.get_cloud_mode()));
406 try_save(ar, ser20::make_nvp("cloud_coverage", obj.get_cloud_coverage()));
407 try_save(ar, ser20::make_nvp("cloud_base_altitude", obj.get_cloud_base_altitude()));
408 try_save(ar, ser20::make_nvp("cloud_top_altitude", obj.get_cloud_top_altitude()));
409 try_save(ar, ser20::make_nvp("cloud_speed", obj.get_cloud_speed()));
410 try_save(ar, ser20::make_nvp("cloud_density", obj.get_cloud_density()));
411 try_save(ar, ser20::make_nvp("cloud_absorption", obj.get_cloud_absorption()));
412 try_save(ar, ser20::make_nvp("cloud_light_absorption", obj.get_cloud_light_absorption()));
413 try_save(ar, ser20::make_nvp("cloud_vol_uv_scale", obj.get_cloud_vol_uv_scale()));
414 try_save(ar, ser20::make_nvp("cloud_vol_edge_width", obj.get_cloud_vol_edge_width()));
415 try_save(ar, ser20::make_nvp("cloud_vol_shape_power", obj.get_cloud_vol_shape_power()));
416 try_save(ar, ser20::make_nvp("cloud_vol_detail_erode", obj.get_cloud_vol_detail_erode()));
417 try_save(ar, ser20::make_nvp("cloud_vol_macro_strength", obj.get_cloud_vol_macro_strength()));
418 try_save(ar, ser20::make_nvp("cloud_vol_coarse_scale", obj.get_cloud_vol_coarse_scale()));
419 try_save(ar, ser20::make_nvp("cloud_vol_base_mix", obj.get_cloud_vol_base_mix()));
420 try_save(ar, ser20::make_nvp("cloud_vol_sun_intensity", obj.get_cloud_vol_sun_intensity()));
421 try_save(ar, ser20::make_nvp("irradiance_intensity", obj.get_irradiance_intensity()));
422 try_save(ar, ser20::make_nvp("irradiance_tint", obj.get_irradiance_tint()));
423 try_save(ar, ser20::make_nvp("irradiance_quality", obj.get_irradiance_quality()));
424 try_save(ar, ser20::make_nvp("irradiance_use_sky", obj.get_irradiance_use_sky()));
425 try_save(ar, ser20::make_nvp("cubemap", obj.get_cubemap()));
426}
429
431{
433 if(try_load(ar, ser20::make_nvp("mode", mode)))
434 {
435 obj.set_mode(mode);
436 }
437
438 float sky_brightness{1.0f};
439 if(try_load(ar, ser20::make_nvp("sky_brightness", sky_brightness)))
440 {
441 obj.set_sky_brightness(sky_brightness);
442 }
443
444 float turbidity{};
445 if(try_load(ar, ser20::make_nvp("turbidity", turbidity)))
446 {
447 obj.set_turbidity(turbidity);
448 }
449
451 if(try_load(ar, ser20::make_nvp("cloud_mode", cloud_mode)))
452 {
453 obj.set_cloud_mode(cloud_mode);
454 }
455
456 float cloud_coverage{};
457 if(try_load(ar, ser20::make_nvp("cloud_coverage", cloud_coverage)))
458 {
459 obj.set_cloud_coverage(cloud_coverage);
460 }
461
462 float cloud_base_altitude{};
463 if(try_load(ar, ser20::make_nvp("cloud_base_altitude", cloud_base_altitude)))
464 {
465 obj.set_cloud_base_altitude(cloud_base_altitude);
466 }
467
468 float cloud_top_altitude{};
469 if(try_load(ar, ser20::make_nvp("cloud_top_altitude", cloud_top_altitude)))
470 {
471 obj.set_cloud_top_altitude(cloud_top_altitude);
472 }
473
474 float cloud_speed{};
475 if(try_load(ar, ser20::make_nvp("cloud_speed", cloud_speed)))
476 {
477 obj.set_cloud_speed(cloud_speed);
478 }
479
480 float cloud_density{};
481 if(try_load(ar, ser20::make_nvp("cloud_density", cloud_density)))
482 {
483 obj.set_cloud_density(cloud_density);
484 }
485
486 float cloud_absorption{};
487 if(try_load(ar, ser20::make_nvp("cloud_absorption", cloud_absorption)))
488 {
489 obj.set_cloud_absorption(cloud_absorption);
490 }
491
492 float cloud_light_absorption{};
493 if(try_load(ar, ser20::make_nvp("cloud_light_absorption", cloud_light_absorption)))
494 {
495 obj.set_cloud_light_absorption(cloud_light_absorption);
496 }
497
498 float cloud_vol_uv_scale{};
499 if(try_load(ar, ser20::make_nvp("cloud_vol_uv_scale", cloud_vol_uv_scale)))
500 {
501 obj.set_cloud_vol_uv_scale(cloud_vol_uv_scale);
502 }
503
504 float cloud_vol_edge_width{};
505 if(try_load(ar, ser20::make_nvp("cloud_vol_edge_width", cloud_vol_edge_width)))
506 {
507 obj.set_cloud_vol_edge_width(cloud_vol_edge_width);
508 }
509
510 float cloud_vol_shape_power{};
511 if(try_load(ar, ser20::make_nvp("cloud_vol_shape_power", cloud_vol_shape_power)))
512 {
513 obj.set_cloud_vol_shape_power(cloud_vol_shape_power);
514 }
515
516 float cloud_vol_detail_erode{};
517 if(try_load(ar, ser20::make_nvp("cloud_vol_detail_erode", cloud_vol_detail_erode)))
518 {
519 obj.set_cloud_vol_detail_erode(cloud_vol_detail_erode);
520 }
521
522 float cloud_vol_macro_strength{};
523 if(try_load(ar, ser20::make_nvp("cloud_vol_macro_strength", cloud_vol_macro_strength)))
524 {
525 obj.set_cloud_vol_macro_strength(cloud_vol_macro_strength);
526 }
527
528 float cloud_vol_coarse_scale{};
529 if(try_load(ar, ser20::make_nvp("cloud_vol_coarse_scale", cloud_vol_coarse_scale)))
530 {
531 obj.set_cloud_vol_coarse_scale(cloud_vol_coarse_scale);
532 }
533
534 float cloud_vol_base_mix{};
535 if(try_load(ar, ser20::make_nvp("cloud_vol_base_mix", cloud_vol_base_mix)))
536 {
537 obj.set_cloud_vol_base_mix(cloud_vol_base_mix);
538 }
539
540 float cloud_vol_sun_intensity{};
541 if(try_load(ar, ser20::make_nvp("cloud_vol_sun_intensity", cloud_vol_sun_intensity)))
542 {
543 obj.set_cloud_vol_sun_intensity(cloud_vol_sun_intensity);
544 }
545
546 float irradiance_intensity{};
547 if(try_load(ar, ser20::make_nvp("irradiance_intensity", irradiance_intensity)))
548 {
549 obj.set_irradiance_intensity(irradiance_intensity);
550 }
551
552 math::color irradiance_tint;
553 if(try_load(ar, ser20::make_nvp("irradiance_tint", irradiance_tint)))
554 {
555 obj.set_irradiance_tint(irradiance_tint);
556 }
557
559 if(try_load(ar, ser20::make_nvp("irradiance_quality", irradiance_quality)))
560 {
561 obj.set_irradiance_quality(irradiance_quality);
562 }
563
564 bool irradiance_use_sky{true};
565 if(try_load(ar, ser20::make_nvp("irradiance_use_sky", irradiance_use_sky)))
566 {
567 obj.set_irradiance_use_sky(irradiance_use_sky);
568 }
569
571 if(try_load(ar, ser20::make_nvp("cubemap", cubemap)))
572 {
573 obj.set_cubemap(cubemap);
574 }
575}
578} // namespace unravel
Class that contains core light data, used for rendering and other purposes.
void set_light(const light &l)
Sets the light object.
auto get_light() const -> const light &
Gets the light object.
Class that contains sky light data.
void set_mode(const sky_mode &mode)
Sets the sky mode.
auto get_mode() const noexcept -> const sky_mode &
Gets the current sky mode.
@ volumetric
Volumetric raymarched clouds (full scattering, half-res with temporal)
irradiance_quality
Directional variation of the indirect diffuse ambient.
@ flat
Flat ambient: only the constant SH band (L0) is written, same color for every normal.
sky_mode
Enumeration for sky modes.
auto property_predicate(property_predicate_t< T > predicate) -> property_predicate_t< T >
Definition reflection.h:89
attributes::value_type attribute
Definition reflection.h:19
std::map< std::string, meta_any > attributes
Definition reflection.h:18
BinaryInputArchive iarchive_binary_t
simd::JSONOutputArchive oarchive_associative_t
BinaryOutputArchive oarchive_binary_t
simd::JSONInputArchive iarchive_associative_t
#define REFLECT(cls)
Definition reflection.h:149
#define SAVE_INSTANTIATE(cls, Archive)
#define LOAD(cls)
auto try_save(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
#define LOAD_INSTANTIATE(cls, Archive)
#define SAVE(cls)
auto try_load(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
Thread-safe handle to an asset.
Struct representing a light.
Definition light.h:87