Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
APreethamDome.h
Go to the documentation of this file.
1#pragma once
2
3#include "Actor/ADome.h"
7#include "Math/TVector2.h"
8#include "SDL/sdl_interface.h"
9
10#include <Common/primitive_type.h>
11
12#include <memory>
13#include <optional>
14
15namespace ph
16{
17
22class APreethamDome : public ADome
23{
24public:
25 std::shared_ptr<TTexture<math::Spectrum>> loadRadianceFunction(
26 const CookingContext& ctx, DomeRadianceFunctionInfo* out_info) const override;
27
28private:
29 math::Vector2R calcSunSphericalCoordinates() const;
30
31 static void checkTurbidity(real turbidity);
32
33 real m_turbidity;
34 real m_standardTime24H;
35 real m_standardMeridianDegrees;
36 real m_siteLatitudeDegrees;
37 real m_siteLongitudeDegrees;
38 integer m_julianDate;
39
40 std::optional<math::Vector2R> m_sunPhiThetaDegrees;
41
42public:
44 {
45 ClassType clazz("preetham-dome");
46 clazz.docName("Preetham Dome Actor");
47 clazz.description(
48 "Using Preetham model to generate absolute energy from sky.");
49 clazz.baseOn<ADome>();
50
51 TSdlReal<OwnerType> turbidity("turbidity", &OwnerType::m_turbidity);
52 turbidity.description("Turbidity of the atmosphere.");
53 turbidity.defaultTo(3.0_r);
54 turbidity.optional();
55 clazz.addField(turbidity);
56
57 TSdlReal<OwnerType> standardTime24H("standard-time-24h", &OwnerType::m_standardTime24H);
58 standardTime24H.description("Standard time in 24H.");
59 standardTime24H.defaultTo(12.0_r);
60 standardTime24H.optional();
61 clazz.addField(standardTime24H);
62
63 TSdlReal<OwnerType> standardMeridianDegrees("standard-meridian-degrees", &OwnerType::m_standardMeridianDegrees);
64 standardMeridianDegrees.description("Standard meridian in degrees.");
65 standardMeridianDegrees.defaultTo(0.0_r);
66 standardMeridianDegrees.optional();
67 clazz.addField(standardMeridianDegrees);
68
69 TSdlReal<OwnerType> siteLatitudeDegrees("site-latitude-degrees", &OwnerType::m_siteLatitudeDegrees);
70 siteLatitudeDegrees.description(
71 "Site latitude in [-90, 90] degrees (\"+\" implies N and \"-\" implies S).");
72 siteLatitudeDegrees.defaultTo(0.0_r);
73 siteLatitudeDegrees.optional();
74 clazz.addField(siteLatitudeDegrees);
75
76 TSdlReal<OwnerType> siteLongitudeDegrees("site-longitude-degrees", &OwnerType::m_siteLongitudeDegrees);
77 siteLongitudeDegrees.description(
78 "Site longitude in [0, 360] degrees (with prime meridian being 0)");
79 siteLongitudeDegrees.defaultTo(0.0_r);
80 siteLongitudeDegrees.optional();
81 clazz.addField(siteLongitudeDegrees);
82
83 TSdlInteger<OwnerType> julianDate("julian-date", &OwnerType::m_julianDate);
84 julianDate.description("The day of the year as an integer in the range [1, 366].");
85 julianDate.defaultTo(1);
86 julianDate.optional();
87 clazz.addField(julianDate);
88
89 TSdlOptionalVector2R<OwnerType> sunPhiThetaDegrees("sun-phi-theta-degrees", &OwnerType::m_sunPhiThetaDegrees);
90 sunPhiThetaDegrees.description(
91 "Directly specify sun position in the sky in spherical coordinates. Note that this option "
92 "may not be physically correct since not every position in the sky is possible for the sun "
93 "given a location on Earth.");
94 clazz.addField(sunPhiThetaDegrees);
95
96 return clazz;
97 }
98};
99
100}// end namespace ph
An actor that models the sky of the scene. Model the sky in latitude-longitude format....
Definition ADome.h:26
Model the sky of the scene with an image.
Definition APreethamDome.h:23
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< APreethamDome >)
Definition APreethamDome.h:43
std::shared_ptr< TTexture< math::Spectrum > > loadRadianceFunction(const CookingContext &ctx, DomeRadianceFunctionInfo *out_info) const override
Definition APreethamDome.cpp:14
Information about the world being cooked.
Definition CookingContext.h:24
A field class that binds a integral member variable.
Definition TSdlInteger.h:21
SDL binding type for a canonical SDL resource class.
Definition TSdlOwnerClass.h:23
A field class that binds a floating point member variable.
Definition TSdlReal.h:21
TSdlValue & description(std::string descriptionStr)
Definition TSdlValue.ipp:95
TSdlValue & optional()
Definition TSdlValue.ipp:103
TSdlValue & defaultTo(T defaultValue)
Definition TSdlValue.ipp:71
Definition TSdlVector2.h:20
The root for all renderer implementations.
Definition EEngineProject.h:6
Definition ADome.h:16