mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-18 22:26:09 +00:00
Make standard planes available from Surfaces
This commit is contained in:
parent
c1972f618c
commit
9a6b7f7d05
@ -128,9 +128,13 @@ impl Objects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The store for [`Surface`]s
|
/// The store for [`Surface`]s
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug)]
|
||||||
pub struct Surfaces {
|
pub struct Surfaces {
|
||||||
store: Store<Surface>,
|
store: Store<Surface>,
|
||||||
|
|
||||||
|
xy_plane: Handle<Surface>,
|
||||||
|
xz_plane: Handle<Surface>,
|
||||||
|
yz_plane: Handle<Surface>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Surfaces {
|
impl Surfaces {
|
||||||
@ -138,4 +142,36 @@ impl Surfaces {
|
|||||||
pub fn insert(&self, surface: Surface) -> Handle<Surface> {
|
pub fn insert(&self, surface: Surface) -> Handle<Surface> {
|
||||||
self.store.insert(surface)
|
self.store.insert(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Access the xy-plane
|
||||||
|
pub fn xy_plane(&self) -> Handle<Surface> {
|
||||||
|
self.xy_plane.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Access the xz-plane
|
||||||
|
pub fn xz_plane(&self) -> Handle<Surface> {
|
||||||
|
self.xz_plane.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Access the yz-plane
|
||||||
|
pub fn yz_plane(&self) -> Handle<Surface> {
|
||||||
|
self.yz_plane.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Surfaces {
|
||||||
|
fn default() -> Self {
|
||||||
|
let store = Store::new();
|
||||||
|
|
||||||
|
let xy_plane = store.insert(Surface::xy_plane());
|
||||||
|
let xz_plane = store.insert(Surface::xz_plane());
|
||||||
|
let yz_plane = store.insert(Surface::yz_plane());
|
||||||
|
|
||||||
|
Self {
|
||||||
|
store,
|
||||||
|
xy_plane,
|
||||||
|
xz_plane,
|
||||||
|
yz_plane,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user