struct
MaterialComponent
ECS component for materials
- Module
- Game
- Header
#include "Game/Components/MaterialComponent.h"- Namespace
Mowo
Properties
| Type | Name | Description |
|---|---|---|
Material* | material | (this component's, or the asset's), never the owner itself. Default nullptr. |
Ref<Material> | ownedMaterial | Strong 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. |
UUID | materialAssetID | UUID of the MaterialAsset (invalid for inline materials). Used for serialization round-trip through the Asset system. |
AssetHandle<MaterialAsset> | materialAsset | Asset reference (non-empty when loaded from asset pipeline) |
Constructors
| Signature | Name | Description |
|---|---|---|
MaterialComponent() = default | MaterialComponent | |
explicit MaterialComponent(Material* mat) : material(mat) | MaterialComponent |
Public functions
| Returns | Name | Description |
|---|---|---|
void | AdoptMaterial | Take ownership of an inline material and point the view at it. |
Vec4 | GetBaseColor | Convenience accessors (delegate to material if available) |
Vec3 | GetSpecularColor | |
float | GetShininess | |
bool | HasTexture |
Function details
MaterialComponent
C++
MaterialComponent() = defaultMaterialComponent
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() constConvenience accessors (delegate to material if available)
GetSpecularColor
C++
Vec3 GetSpecularColor() constGetShininess
C++
float GetShininess() constHasTexture
C++
bool HasTexture() constGenerated from Game/Components/MaterialComponent.h via game.json · Nov 5, 2026Version 1.0.0