31 void setRaw(std::vector<T> values);
47 std::vector<float64> m_values;
53 ClassType clazz(
"constant");
54 clazz.docName(
"Constant Image");
56 "An image that stores constant values. It can be a single scalar, a vector or a color. "
57 "By default, all values are treated as raw data (bypass any color space conversion).");
58 clazz.baseOn<
Image>();
61 values.description(
"A series of values to initialize the constant.");
63 clazz.addField(values);
67 "Associated color space of the constant. By default, values are raw data. If a color "
68 "space is specified, then values will be treated as if in the specified color space. "
69 "When the engine is in spectral mode, raw data may be treated as linear sRGB if a "
70 "direct conversion is impossible.");
73 clazz.addField(colorSpace);
84 setRaw(std::vector<T>{value});
90 setRaw(std::vector<T>{values.
x(), values.
y(), values.
z()});
102 setValues(std::vector<T>{color}, colorSpace);
108 setValues(std::vector<T>{color.
x(), color.
y(), color.
z()}, colorSpace);
114 if constexpr(std::is_same_v<T, float64>)
116 m_values = std::move(values);
120 m_values.resize(values.size());
121 for(std::size_t i = 0; i < values.size(); ++i)
123 m_values[i] =
static_cast<float64
>(values[i]);
127 m_colorSpace = colorSpace;
Definition ConstantImage.h:16
void setValues(std::vector< T > values, math::EColorSpace colorSpace)
Definition ConstantImage.h:112
std::shared_ptr< TTexture< math::Spectrum > > genColorTexture(const CookingContext &ctx) override
Definition ConstantImage.cpp:43
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< ConstantImage >)
Definition ConstantImage.h:51
std::shared_ptr< TTexture< Image::ArrayType > > genNumericTexture(const CookingContext &ctx) override
Definition ConstantImage.cpp:17
void setRaw(T value)
Definition ConstantImage.h:82
void setColor(T color, math::EColorSpace colorSpace)
Set as a monochromatic color value.
Definition ConstantImage.h:100
Information about the world being cooked.
Definition CookingContext.h:24
Definition TSdlEnumField.h:23
SDL binding type for a canonical SDL resource class.
Definition TSdlOwnerClass.h:23
Definition TSdlRealArray.h:23
TSdlValue & description(std::string descriptionStr)
Definition TSdlValue.ipp:95
TSdlValue & optional()
Definition TSdlValue.ipp:103
TSdlValue & defaultTo(T defaultValue)
Definition TSdlValue.ipp:71
Represents a 3-D vector.
Definition TVector3.h:17
T & y()
Definition TVector3.ipp:189
T & z()
Definition TVector3.ipp:195
T & x()
Definition TVector3.ipp:183
EColorSpace
Definition color_enums.h:7
The root for all renderer implementations.
Definition EEngineProject.h:6