[253] 3D-Entourage: Low-Poly-Netze für Person (stehend/gehend), Velo, Auto, Sitzbank, Stuhl, Tische mit Stühlen
Kern furniture_3d.rs: prozedurale, geschlossene Teilnetze aus den Parametern (Höhe h einstellbar), Platzierung auf Gelände/Geschoss. Im 3D (model3d::emit_entourage, Explosion, Cache-Stand), Cycles-Szene, 3D-Dokument (axo) und Schattenwurf; Klasse der Zeichnung ([180]); Grundriss bleibt 2D. Beispiel :wettbewerb: 3 Personen, Auto, Velo, Bank. Nicht im IFC, nicht in Schnitt/Ansicht (TODO).
This commit is contained in:
20 files changed
+879
-27
No files matched your search
@@ -40,6 +40,8 @@ pub enum Owner {
|
||||
Context(usize),
|
||||
/// [115] Index in `Project::extruded_solids`.
|
||||
Solid(usize),
|
||||
/// [253] Index in `Project::drawings2d` (Entourage: Bibliotheksobjekt mit 3D-Netz).
|
||||
Drawing(usize),
|
||||
}
|
||||
|
||||
impl Owner {
|
||||
@@ -58,6 +60,7 @@ impl Owner {
|
||||
Owner::Stair(i) => at(&p.stairs, i).map(|e| e.id.as_str()),
|
||||
Owner::Context(i) => at(&p.context, i).map(|e| e.id()),
|
||||
Owner::Solid(i) => at(&p.extruded_solids, i).map(|e| e.id.as_str()),
|
||||
Owner::Drawing(i) => p.drawings2d.get(i).map(|d| d.id.as_str()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -352,6 +355,7 @@ pub fn parts_filtered(p: &Project, layered: bool, detail: f64, for_section: bool
|
||||
column_meshes: {
|
||||
let mut m = emit_columns(p);
|
||||
m.extend(emit_trees(p));
|
||||
m.extend(emit_entourage(p));
|
||||
m.extend(emit_railings(p));
|
||||
m
|
||||
},
|
||||
|
||||
@@ -192,6 +192,18 @@ pub fn emit_trees(p: &Project) -> Vec<RMesh> {
|
||||
out
|
||||
}
|
||||
|
||||
/// [253] Entourage: Bibliotheksobjekte mit 3D-Netz (Person, Auto, Velo, Bank, Tische mit Stühlen, `furniture_3d.rs`) als
|
||||
/// Meshes, je Teilnetz eines; Herkunft = die Zeichnung (Klasse und Ausblenden wie die der Zeichnung, [180]).
|
||||
pub fn emit_entourage(p: &Project) -> Vec<RMesh> {
|
||||
let mut out = Vec::new();
|
||||
for (i, parts) in crate::furniture_3d::placed(p) {
|
||||
for m in parts {
|
||||
out.push(RMesh { crease_angle: None, positions: m.positions, indices: m.indices, kind: "extrusion", color: m.color, vertex_colors: None, material_index: None, owner: Owner::Drawing(i) });
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// [149] Bäume als Welt-Dreiecke (Stamm + Krone, wie [`emit_trees`]) für den 3D-Pick.
|
||||
pub fn pick_trees(p: &Project) -> Vec<PickTree> {
|
||||
let trees = p.trees.as_deref().unwrap_or(&[]);
|
||||
|
||||
@@ -1163,3 +1163,27 @@ fn slice_x_quader_bleibt_geschlossen() {
|
||||
assert!(m.positions.chunks_exact(3).all(|c| [0.0, 0.25, 0.6, 1.0].iter().any(|x| (c[0] - x).abs() < 1e-12)));
|
||||
assert!(m.positions.chunks_exact(3).any(|c| c[0] == 0.25) && m.positions.chunks_exact(3).any(|c| c[0] == 0.6));
|
||||
}
|
||||
|
||||
/// [253] Entourage im 3D: Bibliotheksobjekte mit Netz kommen als Meshes bei den Stützen, Herkunft = Zeichnung; die Klasse
|
||||
/// der Zeichnung und das Ausblenden der Id wirken wie bei jedem Element; Objekte ohne Netz (WC) liefern nichts.
|
||||
#[test]
|
||||
fn entourage_im_3d_klasse_und_filter() {
|
||||
let mut p = sample();
|
||||
let lv = p.drawing_levels[0].id.clone();
|
||||
let n0 = parts(&p, true, 1.0, false).unwrap().column_meshes.len();
|
||||
let d = |v: serde_json::Value| -> Drawing2D { serde_json::from_value(v).unwrap() };
|
||||
p.drawings2d.push(d(serde_json::json!({"id": "pers1", "type": "drawing2d", "levelId": lv, "categoryCode": "24", "geom": {"shape": "libobj", "libId": "lib:person-stehend", "at": {"x": 4.0, "y": -3.0}, "rotation": 0.5}})));
|
||||
p.drawings2d.push(d(serde_json::json!({"id": "wc1", "type": "drawing2d", "levelId": lv, "categoryCode": "23", "geom": {"shape": "libobj", "libId": "lib:wc-wand", "at": {"x": 1.0, "y": 1.0}, "rotation": 0.0}})));
|
||||
let m = parts(&p, true, 1.0, false).unwrap().column_meshes;
|
||||
assert_eq!(m.len(), n0 + 6, "Person = Rumpf, Kopf, 2 Beine, 2 Arme; WC nur 2D");
|
||||
let idx = p.drawings2d.iter().position(|x| x.id == "pers1").unwrap();
|
||||
assert!(m[n0..].iter().all(|x| x.owner == Owner::Drawing(idx) && x.owner.id(&p) == Some("pers1")));
|
||||
let zmax = m[n0..].iter().flat_map(|x| x.positions.chunks_exact(3).map(|q| q[2])).fold(f64::NEG_INFINITY, f64::max);
|
||||
let base = p.floor(&lv).map_or(0.0, |f| f.base_elevation.unwrap_or(0.0));
|
||||
assert!((zmax - (base + 1.75)).abs() < 1e-9, "{zmax}");
|
||||
// Klasse „24" aus: weg; Id ausgeblendet: weg.
|
||||
let f = ClassFilter::new(&p, &["24".to_string()]);
|
||||
assert_eq!(parts_filtered(&p, true, 1.0, false, &f).unwrap().column_meshes.len(), n0);
|
||||
let f = ClassFilter::from_text(&p, r#"{"hideIds": ["pers1"]}"#);
|
||||
assert_eq!(parts_filtered(&p, true, 1.0, false, &f).unwrap().column_meshes.len(), n0);
|
||||
}
|
||||
Reference in new issue
Block a user