8#include <Common/assertion.h>
9#include <Common/primitive_type.h>
17template<
typename Owner,
typename Element = real,
typename SdlValueType = TSdlValue<math::TVector4<Element>, Owner>>
20 static_assert(std::is_base_of_v<TSdlAbstractValue<math::TVector4<Element>, Owner>, SdlValueType>,
21 "SdlValueType should be a subclass of TSdlAbstractValue.");
23 static_assert(std::is_same_v<Element, real>,
24 "Currently supports only ph::real");
31 template<
typename ValueType>
32 TSdlVector4(std::string valueName, ValueType Owner::* const valuePtr) :
33 SdlValueType(
"vector4",
std::move(valueName), valuePtr)
35 if constexpr(std::is_same_v<SdlValueType, TSdlValue<math::TVector4<Element>, Owner>>)
49 if constexpr(std::is_base_of_v<TSdlOptionalValue<math::TVector4<Element>, Owner>, SdlValueType>)
62 optVec4 = std::nullopt;
79 data.numElements = vec4 ? 4 : 0;
81 data.isNullClearable =
true;
135template<
typename Owner,
typename Element = real>
Data that SDL input process can rely on.
Definition SdlInputContext.h:19
Definition SdlNativeData.h:88
static auto permissiveElementSetter(SdlSetterVariant input, ElementType *out_elementPtr) -> bool
Given a valid target element, set its value in a permissive way (with auto conversions).
Definition SdlNativeData.ipp:349
std::size_t numElements
Hint for number of elements in this block of native data. For example, numElements would be 12 for an...
Definition SdlNativeData.h:99
std::size_t tupleSize
Hint for number of elements that form a natural group. For an array of 10 vec3s, tupleSize may have a...
Definition SdlNativeData.h:105
static auto permissiveElementGetter(ElementType *elementPtr) -> SdlGetterVariant
Given a valid target element, get its value in a permissive way (with auto conversions).
Definition SdlNativeData.ipp:312
ESdlDataType elementType
Hint for the type of elements.
Definition SdlNativeData.h:113
ESdlDataFormat elementContainer
Hint for the type that encapsulates elements.
Definition SdlNativeData.h:109
Carries SDL representation of various data during the output process. Helps to write output data such...
Definition SdlOutputClause.h:14
std::string value
Stores stringified data of a clause. As the output clause generator knows best how its data look like...
Definition SdlOutputClause.h:29
bool isEmpty
If the clause carries no data and does not need to be written.
Definition SdlOutputClause.h:41
Data that SDL output process can rely on.
Definition SdlOutputContext.h:19
Definition SdlNativeData.h:24
void setValue(Owner &owner, T value) const override
Store a value.
Definition TSdlValue.ipp:38
const T * getConstValue(const Owner &owner) const override
Get a pointer to the stored value.
Definition TSdlValue.ipp:50
T * getValue(Owner &owner) const override
Get a pointer to the stored value.
Definition TSdlValue.ipp:44
TSdlValue & defaultTo(T defaultValue)
Definition TSdlValue.ipp:71
T & valueRef(Owner &owner) const
Definition TSdlValue.ipp:132
Definition TSdlVector4.h:19
void loadFromSdl(Owner &owner, const SdlInputClause &clause, const SdlInputContext &ctx) const override
Load SDL value to actual value and store it in the owner's field. Implementations are highly encourag...
Definition TSdlVector4.h:109
TSdlVector4(std::string valueName, ValueType Owner::*const valuePtr)
Bind a Vector4 field to SDL.
Definition TSdlVector4.h:32
SdlNativeData ownedNativeData(Owner &owner) const override
Direct access to the field memory of an owner. Short-lived owner objects such as function parameter s...
Definition TSdlVector4.h:46
void saveToSdl(const Owner &owner, SdlOutputClause &out_clause, const SdlOutputContext &ctx) const override
Convert actual value back to SDL value. Saving a loaded value as SDL value should rarely fail–as load...
Definition TSdlVector4.h:117
std::string valueAsString(const math::TVector4< Element > &vec4) const override
Definition TSdlVector4.h:41
Represents a 4-D vector.
Definition TVector4.h:15
std::string toString() const
Definition TArithmeticArrayBase.ipp:825
void save_vector4(const math::TVector4< Element > &value, std::string &out_str)
Definition sdl_helpers.ipp:338
math::TVector4< Element > load_vector4(std::string_view sdlVec4Str)
Definition sdl_helpers.ipp:145
constexpr ESdlDataType number_type_of()
Definition sdl_helpers.ipp:478
The root for all renderer implementations.
Definition EEngineProject.h:6
TAnyPtr< false > AnyNonConstPtr
A type-safe, lightweight wrapper for any non-const raw pointer type.
Definition TAnyPtr.h:47
Low-level helpers for SDL. Helpers are in an additional sdl namespace.