MeshRenderer¶
class in Infernux.components.builtin
Inherits from: BuiltinComponent
Description¶
Renders a mesh with assigned materials.
description
Properties¶
| Name | Type | Description |
|---|---|---|
| casts_shadows | bool |
Whether this renderer casts shadows. |
| receives_shadows | bool |
Whether this renderer receives shadows. |
| render_material | Any |
The material at slot 0 (convenience property). |
| material_guid | str |
The asset GUID of the material at slot 0. |
| material_count | int |
The number of material slots on this renderer. (read-only) |
| has_mesh_asset | bool |
Whether a mesh asset is assigned to this renderer. (read-only) |
| mesh_asset_guid | str |
The asset GUID of the assigned mesh. (read-only) |
| mesh_name | str |
The name of the assigned mesh. (read-only) |
| vertex_count | int |
The number of vertices in the mesh. (read-only) |
| index_count | int |
The number of indices in the mesh. (read-only) |
properties
Public Methods¶
| Method | Description |
|---|---|
has_render_material() → bool |
Return whether a material is assigned at slot 0. |
get_effective_material(slot: int = ...) → Any |
Return the effective material for the given slot, including fallbacks. |
get_material(slot: int) → Any |
Return the material at the specified slot index. |
set_material(slot: int, guid: str) → None |
Assign a material to the specified slot by asset GUID. |
get_material_guids() → List[str] |
Return the list of material GUIDs for all slots. |
set_materials(guids: List[str]) → None |
Set all material slots from a list of asset GUIDs. |
set_material_slot_count(count: int) → None |
Set the number of material slots on this renderer. |
has_inline_mesh() → bool |
Return whether the renderer has an inline (non-asset) mesh. |
get_mesh_asset() → Any |
Return the InxMesh asset object, or None. |
get_material_slot_names() → List[str] |
Return material slot names from the model file. |
get_submesh_infos() → List[Dict[str, Any]] |
Return info dicts for each submesh. |
get_positions() → List[Tuple[float, float, float]] |
Return the list of vertex positions. |
get_normals() → List[Tuple[float, float, float]] |
Return the list of vertex normals. |
get_uvs() → List[Tuple[float, float]] |
Return the list of UV coordinates. |
get_indices() → List[int] |
Return the list of triangle indices. |
serialize() → str |
Serialize the component to a JSON string. |
public_methods
Example¶
example
See Also¶
see_also