mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-04 09:58:27 +00:00
Prepare to consolidate operation addition APIs
This commit is contained in:
parent
3dc94c24ad
commit
c5ceab8ef9
@ -13,6 +13,13 @@ pub struct Shape {
|
||||
}
|
||||
|
||||
impl Shape {
|
||||
pub fn extend(&mut self) -> OperationResult<()> {
|
||||
OperationResult {
|
||||
operations: self,
|
||||
results: (),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn vertex(
|
||||
&mut self,
|
||||
vertex: impl Into<Vertex>,
|
||||
|
@ -2,6 +2,7 @@ use crate::geometry::Shape;
|
||||
|
||||
pub fn model(shape: &mut Shape) {
|
||||
let (a, b, c, d, e, f, g, h) = shape
|
||||
.extend()
|
||||
.vertex([-0.5, -0.5, -0.5])
|
||||
.vertex([0.5, -0.5, -0.5])
|
||||
.vertex([-0.5, 0.5, -0.5])
|
||||
@ -13,6 +14,7 @@ pub fn model(shape: &mut Shape) {
|
||||
.results();
|
||||
|
||||
shape
|
||||
.extend()
|
||||
.triangle([&a, &e, &g]) // left
|
||||
.triangle([&a, &g, &c])
|
||||
.triangle([&b, &d, &h]) // right
|
||||
|
Loading…
Reference in New Issue
Block a user