Skip to main content

MeshAttachment

The MeshAttachment class represents an attachment that can be associated with a mesh node in a 3D scene. It supports various attachment types, including lights and cameras, allowing for flexible scene composition. The class provides methods for setting and retrieving the attachment type, name, associated node, and parameters. Each attachment can have custom parameters, such as boolean flags, scalar values, vectors, and colors, which can be added, accessed, and modified.

#include <format/TellusimMesh.h>

Constructors

explicit MeshAttachment(const char *name = nullptr)
explicit MeshAttachment(Type type, const char *name = nullptr)
explicit MeshAttachment(MeshNode &node, const char *name = nullptr)

Methods

Clear attachment.

void clear()

Attachment type.

void setType(Type type)
Type getType() const
static const char *getTypeName(Type type)
const char *getTypeName() const
bool isUnknown() const
bool isLight() const
bool isCamera() const

Attachment name.

void setName(const char *name)
String getName() const

Attachment node.

void setNode(MeshNode &node, bool check = true)
const MeshNode getNode() const
MeshNode getNode()

Attachment data.

void setData(const char *data)
void setData(const String &data)
String getData() const

Attachment parameters.

void clearParameters()
bool removeParameter(const char *type)
void copyParameters(const MeshAttachment &attachment)
uint32_t findParameter(const char *type) const
bool hasParameter(const char *type) const
uint32_t getNumParameters() const
String getParameterType(uint32_t index) const

Add attachment parameters.

void addParameter(const char *type, bool value)
void addParameter(const char *type, float32_t value)
void addParameter(const char *type, Vector4f vector)
void addParameter(const char *type, Color color)
void addParameter(const char *type, const char *name)
void addParameter(const char *type, const String &name)

Get attachment 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 Color getParameterColor(uint32_t index, Color color = Color::white) const
String getParameterName(uint32_t index, const String &name = String::null) const

Get attachment 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 Color getParameterColor(const char *type, Color color = Color::white) const
String getParameterName(const char *type, const String &name = String::null) const

Attachment transform.

void setTransform(Vector3f scale)
void setTransform(Matrix4x3f transform)
const Matrix4x3f getTransform() const

Compare attachments.

int32_t compare(const MeshAttachment &attachment) const

Memory usage.

size_t getMemory() const

Enums

Type

Attachment types.

NameValueDescription
TypeUnknown0
TypeLightGlobal1Global light.
TypeLightPoint2Point light.
TypeLightSpot3Spot light.
TypeLightImage4Image light.
TypeCameraPerspective5Perspective camera.
TypeCameraOrthographic6Orthographic camera.
NumTypes7

Flags

Attachment flags.

NameValueDescription
FlagNone0
FlagBool(1 << 0)Boolean parameter flag.
FlagScalarf32(1 << 1)Scalar parameter flag.
FlagVector4f(1 << 2)Vector parameter flag.
FlagColor(1 << 3)Color parameter flag.
FlagName(1 << 4)Name parameter flag.

Variables

TypeNameDescription
static const char*TypeColorLight parameter types.
static const char*TypeIntensity
static const char*TypeTemperature
static const char*TypeInnerAngle
static const char*TypeOuterAngle
static const char*TypeAttenuation
static const char*TypeDiffuse
static const char*TypeSpecular
static const char*TypeWidth
static const char*TypeHeight
static const char*TypeRadius
static const char*TypeLength
static const char*TypeShadow
static const char*TypeAspectCamera parameter types.
static const char*TypeFovX
static const char*TypeFovY
static const char*TypeSizeX
static const char*TypeSizeY
static const char*TypeZNear
static const char*TypeZFar
static const char*TypeFStop
static const char*TypeExposure
static const char*TypeApertureX
static const char*TypeApertureY
static const char*TypeFocalLength
static const char*TypeFocusDistance