50#define CE_MATERIAL_MODEL_PROPERTY_ACCESSOR(NAME, FIELD, TYPE) \
51 [[nodiscard]] inline const TYPE##MaterialProperty& get##NAME() const { return mModel.FIELD; } \
52 [[nodiscard]] inline TYPE get##NAME##Value() { return mModel.FIELD.value; } \
53 [[nodiscard]] inline const HTexture& get##NAME##Texture() { return mModel.FIELD.texture; } \
54 [[nodiscard]] inline const GPUSamplerDescriptor& get##NAME##Sampler() { return mModel.FIELD.sampler; } \
55 [[nodiscard]] inline const MaterialPropertySwizzle<TYPE>& get##NAME##Swizzle() { return mModel.FIELD.swizzle; } \
57 inline void set##NAME(const TYPE##MaterialProperty& value) { \
58 mModel.FIELD = value; \
60 didChangeModel(mModel); \
63 inline void set##NAME(const TYPE& value) { \
64 mModel.FIELD = TYPE##MaterialProperty(value); \
66 didChangeModel(mModel); \
69 inline void set##NAME##Value(const TYPE& value) { \
70 mModel.FIELD.value = value; \
72 didChangeModel(mModel); \
75 inline void set##NAME##Texture(const HTexture& texture) { \
76 mModel.FIELD.texture = texture; \
78 didChangeModel(mModel); \
81 inline void set##NAME##Sampler(const GPUSamplerDescriptor& sampler) { \
82 mModel.FIELD.sampler = sampler; \
84 didChangeModel(mModel); \
87 inline void set##NAME##Swizzle(const MaterialPropertySwizzle<TYPE>& swizzle) { \
88 mModel.FIELD.swizzle = swizzle; \
90 didChangeModel(mModel); \
93 inline void set##NAME(const HTexture& texture, const TYPE& value = TYPE(1)) { \
94 mModel.FIELD.texture = texture; \
95 mModel.FIELD.value = value; \
97 didChangeModel(mModel); \
#define CE_MATERIAL_MODEL_PROPERTY_ACCESSOR(NAME, FIELD, TYPE)
Definition Material.hpp:50
#define CE_META_CLASS_FRIEND(T)
Definition Forward.hpp:48
A graphics material to be used when rendering objects in a scene.
Definition Material.hpp:21
A material type that uses a PBR model.
Definition Material.hpp:30
PBRMaterial(ResourceData &resourceData, const PBRMaterialModel &model)
Definition Material.hpp:47
void setModel(const PBRMaterialModel &model)
Definition Material.hpp:128
const PBRMaterialModel & getModel() const
Definition Material.hpp:125
void setNormalMapSpace(const MaterialNormalMapSpace normalMapSpace)
Determines if the normals are stored in tangent space, object-space or world-space.
Definition Material.hpp:112
MaterialNormalMapSpace getNormalMapType() const
Determines if the normals are stored in tangent space, object-space or world-space.
Definition Material.hpp:109
PBRMaterialModel mModel
The PBR material model. Can be used to quickly return.
Definition Material.hpp:36
Event< void(const PBRMaterialModel &)> didChangeModel
An event called whenever the associated PBRMaterialModel has a property changed.
Definition Material.hpp:41
decltype(auto) changeModel(Func &&func)
Definition Material.hpp:118
PBRMaterial(const PBRMaterialModel &model)
Definition Material.hpp:46
An object, provided by the resource manager, to view and alter data from the resource itself.
Definition Resource.hpp:89
void markAsDirty()
Marks the resource as dirty.
A material that renders using a custom shader.
Definition Material.hpp:136
void setShader(const HShader &shader)
The shader to be used when rendering the material.
ShaderMaterial(const HShader &shader)
const HShader & getShader() const
The shader to be used when rendering the material.
Definition Material.hpp:149
HShader mShader
The shader to be used when rendering the material.
Definition Material.hpp:142
Base template for the event class.
Definition Event.hpp:27
Utility template class that can be extended by Resources to automatically implement methods that are ...
Definition Resource.hpp:272
Definition Application.hpp:19
@ Color
Attachment is used for color output.
MaterialNormalMapSpace
Specifies the kind of normal map used by a material.
Definition MaterialModel.hpp:244
@ Normal
Displays the cursor normally as per the user operating system preferences.
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
double Double
Definition DataTypes.hpp:33
A material model that represents a PBR surface.
Definition MaterialModel.hpp:256
MaterialNormalMapSpace normalMapSpace
Determines if the normals are stored in tangent space, object-space or world-space.
Definition MaterialModel.hpp:280