MeshMaterial
The MeshMaterial class represents a material used in a MeshGeometry object, supporting a flexible system of parameters for defining surface properties such as textures, colors, scalars, vectors, and transformation matrices. Materials can be named, assigned to geometries, and include multiple parameters identified by type strings. These parameters can store booleans, floats, vectors, matrices, colors, strings, images, and binary blobs.
#include <format/TellusimMesh.h>
Constructors
explicit MeshMaterial(const char *name = nullptr)
explicit MeshMaterial(MeshGeometry &geometry, const char *name = nullptr)
Methods
Clear material.
void clear()
Material name.
void setName(const char *name)
String getName() const
Material index.
uint32_t getIndex() const
Material indices.
void setIndices(MeshIndices &indices)
const MeshIndices getIndices() const
MeshIndices getIndices()
Material geometry.
void setGeometry(MeshGeometry &geometry, bool check = true)
const MeshGeometry getGeometry() const
MeshGeometry getGeometry()
Material data.
void setData(const char *data)
void setData(const String &data)
String getData() const
Material parameters.
void clearParameters()
bool removeParameter(const char *type)
void copyParameters(const MeshMaterial &material)
uint32_t findParameter(const char *type) const
bool hasParameter(const char *type) const
uint32_t getNumParameters() const
String getParameterType(uint32_t index) const
Add material parameters.
void addParameter(const char *type, bool value)
void addParameter(const char *type, float32_t value)
void addParameter(const char *type, Vector4f value)
void addParameter(const char *type, Matrix3x2f value)
void addParameter(const char *type, Color color)
void addParameter(const char *type, const char *name, const char *layout = nullptr)
void addParameter(const char *type, const String &name, const char *layout = nullptr)
void addParameter(const char *type, const Image &image, const char *layout = nullptr)
void addParameter(const char *type, Blob &blob, const char *layout = nullptr)
Get material parameter by index.
Flags getParameterFlags(uint32_t index) const
bool hasParameterFlag(uint32_t index, Flags flags) const
bool hasParameterFlags(uint32_t index, Flags flags) const
bool getParameterBool(uint32_t index, bool value = false) const
float32_t getParameterScalarf32(uint32_t index, float32_t value = 0.0f) const
const Vector4f getParameterVector4f(uint32_t index, Vector4f vector = Vector4f::zero) const
const Matrix3x2f getParameterMatrix3x2f(uint32_t index, Matrix3x2f matrix = Matrix3x2f::identity) const
const Color getParameterColor(uint32_t index, Color color = Color::white) const
String getParameterName(uint32_t index, const String &name = String::null) const
String getParameterLayout(uint32_t index, const String &layout = String::null) const
const Image getParameterImage(uint32_t index) const
Blob getParameterBlob(uint32_t index) const
Image getParameterImage(uint32_t index)
Blob getParameterBlob(uint32_t index)
Get material parameter by type.
Flags getParameterFlags(const char *type) const
bool hasParameterFlag(const char *type, Flags flags) const
bool hasParameterFlags(const char *type, Flags flags) const
bool getParameterBool(const char *type, bool value = false) const
float32_t getParameterScalarf32(const char *type, float32_t value = 0.0f) const
const Vector4f getParameterVector4f(const char *type, Vector4f vector = Vector4f::zero) const
const Matrix3x2f getParameterMatrix3x2f(const char *type, Matrix3x2f matrix = Matrix3x2f::identity) const
const Color getParameterColor(const char *type, Color color = Color::white) const
String getParameterName(const char *type, const String &name = String::null) const
String getParameterLayout(const char *type, const String &layout = String::null) const
Compare materials.
int32_t compare(const MeshMaterial &material) const
Memory usage.
size_t getMemory() const
Enums
Flags
Material flags.
Name | Value | Description |
---|---|---|
FlagNone | 0 | |
FlagBool | (1 << 0) | Boolean parameter flag. |
FlagScalarf32 | (1 << 1) | Scalar parameter flag. |
FlagVector4f | (1 << 2) | Vector parameter flag. |
FlagMatrix3x2f | (1 << 3) | Matrix parameter flag. |
FlagColor | (1 << 4) | Color parameter flag. |
FlagName | (1 << 5) | Name parameter flag. |
FlagLayout | (1 << 6) | Layout parameter flag. |
FlagBlob | (1 << 7) | Blob parameter flag. |
FlagImage | (1 << 8) | Image parameter flag. |
FlagTexture | (FlagName | FlagBlob | FlagImage) |
Variables
Type | Name | Description |
---|---|---|
static const char* | TypeBump | Parameter types. |
static const char* | TypeHeight | |
static const char* | TypeNormal | |
static const char* | TypeEmission | |
static const char* | TypeOcclusion | |
static const char* | TypeOpacity | |
static const char* | TypeAmbient | |
static const char* | TypeDiffuse | |
static const char* | TypeSpecular | |
static const char* | TypeMetallic | |
static const char* | TypeRoughness | |
static const char* | TypeShininess | |
static const char* | TypeGlossiness | |
static const char* | TypeTransparent | |
static const char* | TypeTransparency | |
static const char* | TypeTransmission | |
static const char* | TypeReflective | |
static const char* | TypeReflectivity | |
static const char* | TypeRefractiveIndex | |
static const char* | TypeClearcoat | |
static const char* | TypeClearcoatNormal | |
static const char* | TypeClearcoatRoughness | |
static const char* | TypeClearcoatGlossiness | |
static const char* | TypeIridescence | |
static const char* | TypeIridescenceThickness | |
static const char* | TypeIridescenceRefractiveIndex | |
static const char* | TypeSheen | |
static const char* | TypeSheenRoughness | |
static const char* | TypeVolume | |
static const char* | TypeVolumeThickness | |
static const char* | TypeAnisotropy | |
static const char* | TypeAnisotropyAngle | |
static const char* | TypeDoubleSided | |
static const char* | TypeAlphaBlend | |
static const char* | TypeAlphaMask | |
static const char* | TypeTechnique | |
static const char* | TypeTexCoord |