concinnity_core/components/mesh_renderer.rs
1// src/components/mesh_renderer.rs
2
3use crate::ecs::{MaterialHandle, MeshHandle, TextureHandle};
4
5/// Single-mesh render description for an entity: which mesh, material, and
6/// optional legacy texture to draw, plus an optional view-distance cutoff.
7///
8/// Runtime-only. Mutually exclusive with `ModelRenderer` on an entity (an
9/// entity has one or the other), which encodes the mesh-vs-model choice a
10/// `Prop` expresses with its `model` field taking precedence.
11#[derive(Debug, Clone, Default)]
12pub struct MeshRenderer {
13 /// A `Mesh` or `ProceduralMesh` to render, addressed by its shared
14 /// mesh-source handle.
15 pub mesh: Option<MeshHandle>,
16 /// A `Material` providing albedo plus lighting parameters, addressed by its
17 /// `MaterialHandle`.
18 pub material: Option<MaterialHandle>,
19 /// Legacy texture, used only when `material` is unset.
20 pub texture: Option<TextureHandle>,
21 /// View-distance cutoff in world units; 0 keeps the draw visible at any
22 /// distance.
23 pub cull_distance: f32,
24}