8#include <Common/primitive_type.h>
13namespace ph {
class PinholeCamera; }
14namespace ph {
class ThinLensCamera; }
38 real m_focalDistanceMM;
40 real m_sensorOffsetMM;
41 std::optional<real> m_fovDegrees;
46 ClassType clazz(
"single-lens");
47 clazz.docName(
"Single-Lens Observer");
49 "As its name suggests, the lens system in this observer is assumed to have "
50 "just a single lens. The biggest advantage of it is that depth of field "
51 "effects are possible under this model. In case of the lens radius is zero, "
52 "the lens system will be reduced to a pinhole. Images captured by this "
53 "observer is similar to how a normal human perceives the world but with "
54 "several simplifications.");
58 lensRadiusMM.description(
"Radius of the lens in millimeters.");
59 lensRadiusMM.defaultTo(0);
60 lensRadiusMM.optional();
61 clazz.addField(lensRadiusMM);
64 focalDistanceMM.
description(
"The distance in millimeters that the observer is focusing on.");
67 clazz.addField(focalDistanceMM);
70 sensorWidthMM.
description(
"Width of the sensor used by this observer in millimeters.");
73 clazz.addField(sensorWidthMM);
77 "Distance between sensor and light entry (more commonly known as focal length). "
78 "Will be overridden if FoV is provided.");
81 clazz.addField(sensorOffsetMM);
85 "Field of view of this observer in degrees. If provided, it will be used to "
86 "adjust sensor offset such that the desired FoV is reached.");
87 clazz.addField(fovDegrees);
97 return m_lensRadiusMM / 1000.0;
102 return m_focalDistanceMM / 1000.0;
Definition CoreCookedUnit.h:19
Definition CoreCookingContext.h:15
Definition OrientedRasterObserver.h:19
Definition SingleLensObserver.h:20
math::Vector2D getSensorSize(const CoreCookingContext &ctx) const
Definition SingleLensObserver.cpp:68
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< SingleLensObserver >)
Definition SingleLensObserver.h:44
void cook(const CoreCookingContext &ctx, CoreCookedUnit &cooked) override
Definition SingleLensObserver.cpp:15
float64 getLensRadius() const
Definition SingleLensObserver.h:95
float64 getSensorOffset(const CoreCookingContext &ctx) const
Definition SingleLensObserver.cpp:74
float64 getFocalDistance() const
Definition SingleLensObserver.h:100
void genPinholeCamera(const CoreCookingContext &ctx, CoreCookedUnit &cooked)
Definition SingleLensObserver.cpp:87
void genThinLensCamera(const CoreCookingContext &ctx, CoreCookedUnit &cooked)
Definition SingleLensObserver.cpp:106
SingleLensObserver()=default
math::TDecomposedTransform< float64 > makeRasterToSensor(const CoreCookingContext &ctx) const
Definition SingleLensObserver.cpp:27
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
The root for all renderer implementations.
Definition EEngineProject.h:6