Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
BlackBodyRadiationImage.h
Go to the documentation of this file.
1#pragma once
2
3#include "Actor/Image/Image.h"
5#include "SDL/sdl_interface.h"
6
7#include <Common/primitive_type.h>
8
9#include <optional>
10
11namespace ph
12{
13
15{
16public:
17 std::shared_ptr<TTexture<Image::ArrayType>> genNumericTexture(
18 const CookingContext& ctx) override;
19
20 std::shared_ptr<TTexture<math::Spectrum>> genColorTexture(
21 const CookingContext& ctx) override;
22
26
27private:
28 real m_temperatureK;
29 bool m_isSpectralRadiance;
30 std::optional<real> m_energy;
31 math::EColorSpace m_numericColorSpace;
32
33public:
35 {
36 ClassType clazz("black-body");
37 clazz.docName("Black-body Radiation Image");
38 clazz.description(
39 "An image outputs the value of black-body radiation.");
40 clazz.baseOn<Image>();
41
42 TSdlReal<OwnerType> temperatureK("temperature-k", &OwnerType::m_temperatureK);
43 temperatureK.description(
44 "Temperature (in Kelvin) that the black-body radiates on.");
45 temperatureK.defaultTo(3000.0_r);
46 temperatureK.required();
47 clazz.addField(temperatureK);
48
49 TSdlBool<OwnerType> isSpectralRadiance("is-spectral-radiance", &OwnerType::m_isSpectralRadiance);
50 isSpectralRadiance.description(
51 "false (default): The energy unit is in radiance; true: The energy unit is in spectral "
52 "radiance. If \"energy\" value is specified, this option will have no effect (the user "
53 "is then responsible for specifying \"energy\" value in their desired unit).");
54 isSpectralRadiance.defaultTo(false);
55 isSpectralRadiance.optional();
56 clazz.addField(isSpectralRadiance);
57
58 TSdlOptionalReal<OwnerType> energy("energy", &OwnerType::m_energy);
59 energy.description(
60 "If specified, the resulting radiation will be adjusted (scaled) to the target "
61 "energy level; otherwise, the true energy level at the temperature will be used.");
62 clazz.addField(energy);
63
64 TSdlEnumField<OwnerType, math::EColorSpace> numericColorSpace(&OwnerType::m_numericColorSpace);
65 numericColorSpace.description(
66 "The tristimulus color space to use when using the image as a numeric texture. "
67 "The default is to use the current tristimulus space, and linear-sRGB when the engine "
68 "is in spectral mode.");
70 numericColorSpace.optional();
71 clazz.addField(numericColorSpace);
72
73 return clazz;
74 }
75};
76
77}// end namespace ph
Definition BlackBodyRadiationImage.h:15
math::Spectrum getRadiation() const
Get the black-body radiation as defined by the input parameters.
Definition BlackBodyRadiationImage.cpp:77
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< BlackBodyRadiationImage >)
Definition BlackBodyRadiationImage.h:34
std::shared_ptr< TTexture< math::Spectrum > > genColorTexture(const CookingContext &ctx) override
Definition BlackBodyRadiationImage.cpp:68
std::shared_ptr< TTexture< Image::ArrayType > > genNumericTexture(const CookingContext &ctx) override
Definition BlackBodyRadiationImage.cpp:19
Information about the world being cooked.
Definition CookingContext.h:24
Definition Image.h:21
A field class that binds a bool member variable.
Definition TSdlBool.h:21
Definition TSdlEnumField.h:23
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 TTristimulusSpectrum.h:11
EColorSpace
Definition color_enums.h:7
The root for all renderer implementations.
Definition EEngineProject.h:6