mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-05 14:55:55 +00:00
Update name of trait method
This commit is contained in:
parent
79d19fbc49
commit
86b0415791
@ -3,7 +3,7 @@ use std::{collections::BTreeMap, fs::File};
|
|||||||
use crate::geometry::{Operation, Shape};
|
use crate::geometry::{Operation, Shape};
|
||||||
|
|
||||||
pub fn export(shape: &Shape) -> anyhow::Result<()> {
|
pub fn export(shape: &Shape) -> anyhow::Result<()> {
|
||||||
let tri_mesh = shape.triangles();
|
let tri_mesh = shape.tri_mesh();
|
||||||
|
|
||||||
let mut indices_by_vertex = BTreeMap::new();
|
let mut indices_by_vertex = BTreeMap::new();
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use std::{fmt, ops::Deref, rc::Rc};
|
|||||||
use super::tri_mesh::TriMesh;
|
use super::tri_mesh::TriMesh;
|
||||||
|
|
||||||
pub trait Operation: fmt::Display {
|
pub trait Operation: fmt::Display {
|
||||||
fn triangles(&self) -> TriMesh;
|
fn tri_mesh(&self) -> TriMesh;
|
||||||
fn children(&self) -> Vec<AnyOp>;
|
fn children(&self) -> Vec<AnyOp>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,8 +68,8 @@ impl fmt::Display for AnyOp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Operation for AnyOp {
|
impl Operation for AnyOp {
|
||||||
fn triangles(&self) -> TriMesh {
|
fn tri_mesh(&self) -> TriMesh {
|
||||||
self.inner.triangles()
|
self.inner.tri_mesh()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn children(&self) -> Vec<AnyOp> {
|
fn children(&self) -> Vec<AnyOp> {
|
||||||
|
@ -31,9 +31,9 @@ impl fmt::Display for Shape {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Operation for Shape {
|
impl Operation for Shape {
|
||||||
fn triangles(&self) -> TriMesh {
|
fn tri_mesh(&self) -> TriMesh {
|
||||||
if let Some(op) = self.sequence.last() {
|
if let Some(op) = self.sequence.last() {
|
||||||
op.triangles()
|
op.tri_mesh()
|
||||||
} else {
|
} else {
|
||||||
TriMesh::new()
|
TriMesh::new()
|
||||||
}
|
}
|
||||||
@ -54,14 +54,14 @@ struct OperationInSequence {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Operation for OperationInSequence {
|
impl Operation for OperationInSequence {
|
||||||
fn triangles(&self) -> TriMesh {
|
fn tri_mesh(&self) -> TriMesh {
|
||||||
let mesh = if let Some(op) = &self.previous {
|
let mesh = if let Some(op) = &self.previous {
|
||||||
op.triangles()
|
op.tri_mesh()
|
||||||
} else {
|
} else {
|
||||||
TriMesh::new()
|
TriMesh::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
mesh.merge(self.operation.triangles())
|
mesh.merge(self.operation.tri_mesh())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn children(&self) -> Vec<AnyOp> {
|
fn children(&self) -> Vec<AnyOp> {
|
||||||
|
@ -27,7 +27,7 @@ impl fmt::Display for Triangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Operation for Triangle {
|
impl Operation for Triangle {
|
||||||
fn triangles(&self) -> TriMesh {
|
fn tri_mesh(&self) -> TriMesh {
|
||||||
TriMesh {
|
TriMesh {
|
||||||
triangles: vec![self.clone()],
|
triangles: vec![self.clone()],
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ pub struct Geometry {
|
|||||||
|
|
||||||
impl Geometry {
|
impl Geometry {
|
||||||
pub fn new(device: &wgpu::Device, operation: &dyn Operation) -> Self {
|
pub fn new(device: &wgpu::Device, operation: &dyn Operation) -> Self {
|
||||||
let tri_mesh = operation.triangles();
|
let tri_mesh = operation.tri_mesh();
|
||||||
|
|
||||||
let mut indices = Vec::new();
|
let mut indices = Vec::new();
|
||||||
let mut vertices = Vec::new();
|
let mut vertices = Vec::new();
|
||||||
|
@ -43,7 +43,7 @@ impl fmt::Display for Face {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Operation for Face {
|
impl Operation for Face {
|
||||||
fn triangles(&self) -> TriMesh {
|
fn tri_mesh(&self) -> TriMesh {
|
||||||
// This is a placeholder implementation that only supports convex faces.
|
// This is a placeholder implementation that only supports convex faces.
|
||||||
|
|
||||||
let mut triangulation =
|
let mut triangulation =
|
||||||
|
@ -29,7 +29,7 @@ impl fmt::Display for Vertex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Operation for Vertex {
|
impl Operation for Vertex {
|
||||||
fn triangles(&self) -> TriMesh {
|
fn tri_mesh(&self) -> TriMesh {
|
||||||
TriMesh::new()
|
TriMesh::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,8 +128,8 @@ impl fmt::Display for OperationView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Operation for OperationView {
|
impl Operation for OperationView {
|
||||||
fn triangles(&self) -> TriMesh {
|
fn tri_mesh(&self) -> TriMesh {
|
||||||
self.operation.triangles()
|
self.operation.tri_mesh()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn children(&self) -> Vec<AnyOp> {
|
fn children(&self) -> Vec<AnyOp> {
|
||||||
|
Loading…
Reference in New Issue
Block a user