mittens_engine/engine/ecs/component/
mesh.rs1use crate::engine::ecs::ComponentId;
2use crate::engine::ecs::component::Component;
3
4#[derive(Debug, Clone)]
9pub struct MeshComponent {
10 pub key: String,
11}
12
13impl MeshComponent {
14 pub fn new(key: impl Into<String>) -> Self {
15 Self { key: key.into() }
16 }
17}
18
19impl Component for MeshComponent {
20 fn name(&self) -> &'static str {
21 "mesh"
22 }
23
24 fn as_any(&self) -> &dyn std::any::Any {
25 self
26 }
27
28 fn as_any_mut(&mut self) -> &mut dyn std::any::Any {
29 self
30 }
31
32 fn init(&mut self, _emit: &mut dyn crate::engine::ecs::SignalEmitter, _component: ComponentId) {
33 }
35
36 fn to_mms_ast(
37 &self,
38 _world: &crate::engine::ecs::World,
39 ) -> crate::scripting::ast::ComponentExpression {
40 use crate::engine::ecs::component::ce_helpers::*;
41 ce_call("Mesh", "new", vec![s(&self.key)])
42 }
43}