1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//! Module for the registration of primitives and for constants that map to
//! Aframe's built-in primitives.
use crateregisterPrimitive;
use HashMap;
use *;
use Serialize;
/// https://aframe.io/docs/1.6.0/primitives/a-box.html
pub const A_BOX: &'static str = "a-box";
/// https://aframe.io/docs/1.6.0/primitives/a-camera.html
pub const A_CAMERA: &'static str = "a-camera";
/// https://aframe.io/docs/1.6.0/primitives/a-circle.html
pub const A_CIRCLE: &'static str = "a-circle";
/// https://aframe.io/docs/1.6.0/primitives/a-cone.html
pub const A_CONE: &'static str = "a-cone";
/// https://aframe.io/docs/1.6.0/primitives/a-cursor.html
pub const A_CURSOR: &'static str = "a-cursor";
/// https://aframe.io/docs/1.6.0/primitives/a-curvedimage.html
pub const A_CURVEDIMAGE: &'static str = "a-curvedimage";
/// https://aframe.io/docs/1.6.0/primitives/a-cylinder.html
pub const A_CYLINDER: &'static str = "a-cylinder";
/// https://aframe.io/docs/1.6.0/primitives/a-dodecahedron.html
pub const A_DODECAHEDRON: &'static str = "a-dodecahedron";
/// https://aframe.io/docs/1.6.0/primitives/a-gltf-model.html
pub const A_GLTF_MODEL: &'static str = "a-gltf-model";
/// https://aframe.io/docs/1.6.0/primitives/a-icosahedron.html
pub const A_ICOSAHEDRON: &'static str = "a-icosahedron";
/// https://aframe.io/docs/1.6.0/primitives/a-image.html
pub const A_IMAGE: &'static str = "a-image";
/// https://aframe.io/docs/1.6.0/primitives/a-light.html
pub const A_LIGHT: &'static str = "a-light";
/// https://aframe.io/docs/1.6.0/primitives/a-link.html
pub const A_LINK: &'static str = "a-link";
/// https://aframe.io/docs/1.6.0/primitives/a-obj-model.html
pub const A_OBJ_MODEL: &'static str = "a-obj-model";
/// https://aframe.io/docs/1.6.0/primitives/a-octahedron.html
pub const A_OCTAHEDRON: &'static str = "a-octahedron";
/// https://aframe.io/docs/1.6.0/primitives/a-plane.html
pub const A_PLANE: &'static str = "a-plane";
/// https://aframe.io/docs/1.6.0/primitives/a-ring.html
pub const A_RING: &'static str = "a-ring";
/// https://aframe.io/docs/1.6.0/primitives/a-sky.html
pub const A_SKY: &'static str = "a-sky";
/// https://aframe.io/docs/1.6.0/primitives/a-sound.html
pub const A_SOUND: &'static str = "a-sound";
/// https://aframe.io/docs/1.6.0/primitives/a-sphere.html
pub const A_SPHERE: &'static str = "a-sphere";
/// https://aframe.io/docs/1.6.0/primitives/a-tetrahedron.html
pub const A_TETRAHEDRON: &'static str = "a-tetrahedron";
/// https://aframe.io/docs/1.6.0/primitives/a-text.html
pub const A_TEXT: &'static str = "a-text";
/// https://aframe.io/docs/1.6.0/primitives/a-torus-knot.html
pub const A_TORUS_KNOT: &'static str = "a-torus-knot";
/// https://aframe.io/docs/1.6.0/primitives/a-torus.html
pub const A_TORUS: &'static str = "a-torus";
/// https://aframe.io/docs/1.6.0/primitives/a-triangle.html
pub const A_TRIANGLE: &'static str = "a-triangle";
/// https://aframe.io/docs/1.6.0/primitives/a-video.html
pub const A_VIDEO: &'static str = "a-video";
/// https://aframe.io/docs/1.6.0/primitives/a-videosphere.html
pub const A_VIDEOSPHERE: &'static str = "a-videosphere";
/// Top-level macro to define a new primitive.
/// ```ignore
/// let prim = primitive!
/// {
/// components:
/// ("position", component::Position{ x: 0.0, y: -2.0, z: -1.0 }),
/// ("rotation", component::Rotation { x: 0.0, y: 45.0, z: 0.0 }),
/// ("geometry", component!(component::Geometry)),
/// ("animation__click", component!
/// {
/// component::Animation,
/// property: Cow::Borrowed("rotation"),
/// from: Cow::Borrowed("0 45 0"),
/// to: Cow::Borrowed("0 405 0"),
/// start_events: component::List(Cow::Borrowed(&[Cow::Borrowed("click")])),
/// dur: 900,
/// easing: component::Easing::EaseOutCubic
/// }),
/// ("shadow", component!(component::Shadow)),
/// ("material", component!
/// {
/// component::Material,
/// props: component::MaterialProps(Cow::Owned(vec!((Cow::Borrowed("src"), Cow::Borrowed("#ramen")))))
/// })
/// mappings:
/// ("src", "material.src"),
/// ("depth", "geometry.depth"),
/// ("height", "geometry.height"),
/// ("width", "geometry.width")
/// };
/// unsafe
/// {
/// match prim.register("ramen-cube")
/// {
/// Ok(_) => (),
/// Err(err) => yew::services::ConsoleService::log(&format!("{:?}", err))
/// }
/// }
/// ```
}
}
/// Contains primitive definition which may be registered to Aframe