Struct MaterialInstance¶
‘MaterialInstance’ defines a per-components state of additional material settings.
-
struct MaterialInstance¶
‘MaterialInstance’ defines a per-components state of additional material settings.
While the material of an object is immutable, this struct here can be modified. This allows things like prim/env color or texture placeholders to be set on a per-object basis.
Public Functions
-
MaterialInstance() = default¶
-
MaterialInstance(const MaterialInstance&) = delete¶
-
MaterialInstance &operator=(const MaterialInstance&) = delete¶
-
MaterialInstance(MaterialInstance&&) = delete¶
-
MaterialInstance &operator=(MaterialInstance&&) = delete¶
-
~MaterialInstance()¶
-
inline constexpr bool doesAnything() const¶
Checks if this instance has at least one setting enabled.
If this returns false, it means this instance if effective a no-op and doesn’t need to be applied at all.
- Returns:
true if it does anything, false if not
-
inline constexpr bool setsAnyPlaceholder() const¶
Checks if this instance has at least one active placeholder.
This information is baked into the instance at build-time, and needs to be set in the editor.
- Returns:
true if at least one placeholder is set, false if not
-
inline constexpr bool setsPlaceholder(uint32_t idx) const¶
Checks if a specific placeholder-slot is active.
- Parameters:
idx – the slot index (0-7)
- Returns:
true if the slot is active, false if not
-
inline Placeholder *getPlaceholder(uint32_t slot)¶
Returns a placeholder for a given slot (0-7).
This must be set up in the editor to be available at runtime, otherwise this will return a nullptr.
On the returned placeholder you can then modify tile-settings or the texture (depending on the setup). When done, call ‘update()’ on it to prepare the changed data for future drawing.
- Parameters:
slot – the slot index (0-7)
- Returns:
placeholder or nullptr if not set up
-
inline uint32_t getSize() const¶
Returns the allocated size of this object in bytes.
(This is used internally to manage allocation and copying).
- Returns:
size in bytes
Friends
- friend class Comp::Model
- friend class Comp::AnimModel
-
MaterialInstance() = default¶