Infinity Engine v0.6.20
C++ API Documentation
Loading...
Searching...
No Matches
Material.hpp
1#pragma once
2
3#include <Infinity/Types/Core/Data.hpp>
4#include <Infinity/Types/Core/Value.hpp>
5#include <Infinity/Types/Containers/Array.hpp>
6#include <Infinity/Types/Containers/Array2D.hpp>
7#include <Infinity/Types/Containers/ImmutableMap.hpp>
8
9#include <variant>
10
12{
95 class INFINITY_API_PUBLIC Material : public Core::Data
96 {
97 public:
104 std::string name;
105
119 std::string shaderName;
120
128
135
139 virtual ~Material();
140
141 std::unique_ptr<Core::Base> clone() const override;
142
149 void setInt(const std::string& key, int value);
150
157 void setFloat(const std::string& key, float value);
158
165 void setVector2(const std::string& key, const Infinity::Types::Math::Vector2& value);
166
173 void setVector3(const std::string& key, const Infinity::Types::Math::Vector3& value);
174
181 void setVector4(const std::string& key, const Infinity::Types::Math::Vector4& value);
182
189 void setColor(const std::string& key, const Infinity::Types::Math::Vector4ub& value);
190
197 void setTexture(const std::string& key, std::shared_ptr<const Containers::ArrayBase> texture);
198
205 void setTexture2DR(const std::string& key, const Containers::Array2D<uint8_t>& texture);
206
213 void setTexture2DRG(const std::string& key, const Containers::Array2D<Math::Vector2ub>& texture);
214
221 void setTexture2DRGB(const std::string& key, const Containers::Array2D<Math::Vector3ub>& texture);
222
229 void setTexture2DRGBA(const std::string& key, const Containers::Array2D<Math::Vector4ub>& texture);
230
237 void setTexture2DR_SFloat32(const std::string& key, const Containers::Array2D<float>& texture);
238
245 void setTexture2DRG_SFloat32(const std::string& key, const Containers::Array2D<Math::Vector2>& texture);
246
253 void setTexture2DRGB_SFloat32(const std::string& key, const Containers::Array2D<Math::Vector3>& texture);
254
261 void setTexture2DRGBA_SFloat32(const std::string& key, const Containers::Array2D<Math::Vector4>& texture);
262
270 int getInt(const std::string& key) const;
271
279 float getFloat(const std::string& key) const;
280
288 Math::Vector2 getVector2(const std::string& key) const;
289
297 Math::Vector3 getVector3(const std::string& key) const;
298
306 Math::Vector4 getVector4(const std::string& key) const;
307
315 Math::Vector4ub getColor(const std::string& key) const;
316
326 Math::Vector4ub getColorRGBA(const std::string& key) const;
327
337 Math::Vector4 getColorRGBAFloat(const std::string& key) const;
338
345 bool hasParam(const std::string& key) const;
346
353 bool hasTexture(const std::string& key) const;
354
362 const Containers::ArrayBase& getTexture(const std::string& key) const;
363
372 const Containers::Array2D<uint8_t>& getTexture2DR(const std::string& key) const;
373
382 const Containers::Array2D<Math::Vector2ub>& getTexture2DRG(const std::string& key) const;
383
392 const Containers::Array2D<Math::Vector3ub>& getTexture2DRGB(const std::string& key) const;
393
402 const Containers::Array2D<Math::Vector4ub>& getTexture2DRGBA(const std::string& key) const;
403
412 const Containers::Array2D<float>& getTexture2DR_SFloat32(const std::string& key) const;
413
423
433
443
449 const Infinity::Types::TypeID& typeId() const override;
450 };
451}
452
Two-dimensional array container for grid-based data in procedural generation.
Definition Array2D.hpp:82
Abstract base class for all array container types in the Infinity type system.
Definition ArrayBase.hpp:72
Dynamic contiguous container for homogeneous elements in the Infinity type system.
Definition Array.hpp:77
Type-safe heterogeneous key-value container for configuration and metadata.
Definition ImmutableMap.hpp:85
Base class for complex data types with memory wrapping and property support.
Definition Data.hpp:49
Shader configuration with parameters and textures for surface appearance.
Definition Material.hpp:96
void setFloat(const std::string &key, float value)
Sets a float parameter.
bool hasTexture(const std::string &key) const
Checks if a texture parameter exists.
void setTexture2DRGB_SFloat32(const std::string &key, const Containers::Array2D< Math::Vector3 > &texture)
Sets a three-channel 32-bit float texture (RGB format, HDR).
const Containers::Array2D< float > & getTexture2DR_SFloat32(const std::string &key) const
Gets a single-channel 32-bit float texture.
const Containers::Array2D< uint8_t > & getTexture2DR(const std::string &key) const
Gets a single-channel 8-bit texture.
const Infinity::Types::TypeID & typeId() const override
Gets the TypeID for Material.
void setColor(const std::string &key, const Infinity::Types::Math::Vector4ub &value)
Sets a color parameter (8-bit RGBA).
void setVector2(const std::string &key, const Infinity::Types::Math::Vector2 &value)
Sets a 2D vector parameter.
std::string shaderName
Name of the shader to use for rendering.
Definition Material.hpp:119
void setVector4(const std::string &key, const Infinity::Types::Math::Vector4 &value)
Sets a 4D vector parameter.
void setTexture2DRGBA_SFloat32(const std::string &key, const Containers::Array2D< Math::Vector4 > &texture)
Sets a four-channel 32-bit float texture (RGBA format, HDR).
void setTexture2DRGBA(const std::string &key, const Containers::Array2D< Math::Vector4ub > &texture)
Sets a four-channel 8-bit texture (RGBA format).
const Containers::Array2D< Math::Vector2ub > & getTexture2DRG(const std::string &key) const
Gets a two-channel 8-bit texture.
Math::Vector2 getVector2(const std::string &key) const
Gets a 2D vector parameter.
const Containers::Array2D< Math::Vector3 > & getTexture2DRGB_SFloat32(const std::string &key) const
Gets a three-channel 32-bit float texture.
const Containers::Array2D< Math::Vector4ub > & getTexture2DRGBA(const std::string &key) const
Gets a four-channel 8-bit texture.
void setTexture2DR_SFloat32(const std::string &key, const Containers::Array2D< float > &texture)
Sets a single-channel 32-bit float texture (R format, HDR).
const Containers::ArrayBase & getTexture(const std::string &key) const
Gets a texture as generic ArrayBase reference.
Math::Vector4ub getColorRGBA(const std::string &key) const
Gets a color parameter as 8-bit RGBA.
int getInt(const std::string &key) const
Gets an integer parameter.
void setTexture(const std::string &key, std::shared_ptr< const Containers::ArrayBase > texture)
Sets a texture from a generic array base.
Math::Vector4 getVector4(const std::string &key) const
Gets a 4D vector parameter.
std::unique_ptr< Core::Base > clone() const override
Math::Vector4ub getColor(const std::string &key) const
Gets a color parameter as 8-bit RGBA.
const Containers::Array2D< Math::Vector3ub > & getTexture2DRGB(const std::string &key) const
Gets a three-channel 8-bit texture.
void setTexture2DRG(const std::string &key, const Containers::Array2D< Math::Vector2ub > &texture)
Sets a two-channel 8-bit texture (RG format).
Math::Vector3 getVector3(const std::string &key) const
Gets a 3D vector parameter.
void setTexture2DRG_SFloat32(const std::string &key, const Containers::Array2D< Math::Vector2 > &texture)
Sets a two-channel 32-bit float texture (RG format, HDR).
std::string name
Human-readable material name.
Definition Material.hpp:104
bool hasParam(const std::string &key) const
Checks if a parameter exists.
const Containers::Array2D< Math::Vector4 > & getTexture2DRGBA_SFloat32(const std::string &key) const
Gets a four-channel 32-bit float texture.
Math::Vector4 getColorRGBAFloat(const std::string &key) const
Gets a color parameter as normalized float RGBA.
const Containers::Array2D< Math::Vector2 > & getTexture2DRG_SFloat32(const std::string &key) const
Gets a two-channel 32-bit float texture.
void setTexture2DRGB(const std::string &key, const Containers::Array2D< Math::Vector3ub > &texture)
Sets a three-channel 8-bit texture (RGB format).
Containers::ImmutableMap params
Parameter storage for shader uniforms and textures.
Definition Material.hpp:127
void setVector3(const std::string &key, const Infinity::Types::Math::Vector3 &value)
Sets a 3D vector parameter.
float getFloat(const std::string &key) const
Gets a float parameter.
void setInt(const std::string &key, int value)
Sets an integer parameter.
void setTexture2DR(const std::string &key, const Containers::Array2D< uint8_t > &texture)
Sets a single-channel 8-bit texture (R format).
Definition IndexBuffer.hpp:9
Template structure representing a 2-component vector.
Definition Vector2.hpp:75
Template structure representing a 3-component vector.
Definition Vector3.hpp:82
Template structure representing a 4-component vector.
Definition Vector4.hpp:85
Runtime type identifier for the Infinity type system.
Definition TypeID.hpp:71