struct

MaterialComponent

ECS component for materials

Module
Game
Header
#include "Game/Components/MaterialComponent.h"
Namespace
Mowo

Properties

TypeNameDescription
Material*material(this component's, or the asset's), never the owner itself. Default nullptr.
Ref<Material>ownedMaterialStrong reference to an inline (non-asset) material. Shared with the entity's MeshRendererComponent, so the two components hold ONE object and the last one to die frees it — with its GPU texture refs, exactly once. Null when material views an asset-owned material: the asset holds that Ref, and a reimport keeps the object in place.
UUIDmaterialAssetIDUUID of the MaterialAsset (invalid for inline materials). Used for serialization round-trip through the Asset system.
AssetHandle<MaterialAsset>materialAssetAsset reference (non-empty when loaded from asset pipeline)

Constructors

SignatureNameDescription
MaterialComponent() = defaultMaterialComponent
explicit MaterialComponent(Material* mat) : material(mat)MaterialComponent

Public functions

ReturnsNameDescription
voidAdoptMaterialTake ownership of an inline material and point the view at it.
Vec4GetBaseColorConvenience accessors (delegate to material if available)
Vec3GetSpecularColor
floatGetShininess
boolHasTexture

Function details

MaterialComponent

C++
MaterialComponent() = default

MaterialComponent

C++
explicit MaterialComponent(Material* mat) : material(mat)

AdoptMaterial

C++
void AdoptMaterial(Ref<Material> mat)

Take ownership of an inline material and point the view at it. The view is set FROM the Ref: adopting a raw pointer into the Ref would let a second owner meet the first on one object.

GetBaseColor

C++
Vec4 GetBaseColor() const

Convenience accessors (delegate to material if available)

GetSpecularColor

C++
Vec3 GetSpecularColor() const

GetShininess

C++
float GetShininess() const

HasTexture

C++
bool HasTexture() const
Generated from Game/Components/MaterialComponent.h via game.json · Nov 5, 2026Version 1.0.0