refactor(scene): group modules into role-based subfolders

Move the 30 flat modules under src/scene/ into six folders by role:
convert (entity→geometry), text (fonts/shaping), model (render models),
pick (hit-test/selection/grips/xclip), view (camera/transform/render),
cache (block + property caches). pipeline/ is unchanged.

Full path migration — all `scene::X` references become
`scene::<group>::X`, no compatibility re-exports. render.rs items that
were `pub(super)` (parent was scene) become `pub(in crate::scene)` to
keep their original scene-wide visibility.

No behavior change; build and tests are green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-16 11:33:46 +03:00
1 parent cd048165a9
commit 7fe7e0230d
160 files changed
+732 -715

No files matched your search

+21 -21
View File
@@ -523,8 +523,8 @@ impl OpenCADStudio {
for h in &dest { for h in &dest {
if let Some(e) = self.tabs[i].scene.document.get_entity_mut(*h) { if let Some(e) = self.tabs[i].scene.document.get_entity_mut(*h) {
e.as_entity_mut().set_layer(layer.clone()); e.as_entity_mut().set_layer(layer.clone());
crate::scene::dispatch::apply_color(e, color); crate::scene::view::dispatch::apply_color(e, color);
crate::scene::dispatch::apply_line_weight(e, lw); crate::scene::view::dispatch::apply_line_weight(e, lw);
e.common_mut().linetype = linetype.clone(); e.common_mut().linetype = linetype.clone();
e.common_mut().linetype_scale = lt_scale; e.common_mut().linetype_scale = lt_scale;
} }
@@ -553,7 +553,7 @@ impl OpenCADStudio {
.clone() .clone()
.into_iter() .into_iter()
.map(|mut entity| { .map(|mut entity| {
crate::scene::dispatch::apply_transform(&mut entity, &translate); crate::scene::view::dispatch::apply_transform(&mut entity, &translate);
entity.common_mut().handle = acadrust::Handle::NULL; entity.common_mut().handle = acadrust::Handle::NULL;
self.tabs[i].scene.add_entity(entity) self.tabs[i].scene.add_entity(entity)
}) })
@@ -1170,8 +1170,8 @@ impl OpenCADStudio {
} => { } => {
use crate::entities::traits::EntityTypeOps; use crate::entities::traits::EntityTypeOps;
use crate::modules::insert::solid3d_cmds::empty_solid3d; use crate::modules::insert::solid3d_cmds::empty_solid3d;
use crate::scene::acad_to_truck::TruckObject; use crate::scene::convert::acad_to_truck::TruckObject;
use crate::scene::truck_tess; use crate::scene::convert::truck_tess;
use truck_modeling::builder; use truck_modeling::builder;
use truck_modeling::Vector3 as TruckVec3; use truck_modeling::Vector3 as TruckVec3;
@@ -1192,7 +1192,7 @@ impl OpenCADStudio {
verts, verts,
normals, normals,
indices, indices,
} => Some(crate::scene::mesh_model::MeshModel { } => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(), name: String::new(),
verts, verts,
normals, normals,
@@ -1236,8 +1236,8 @@ impl OpenCADStudio {
} => { } => {
use crate::entities::traits::EntityTypeOps; use crate::entities::traits::EntityTypeOps;
use crate::modules::insert::solid3d_cmds::empty_solid3d; use crate::modules::insert::solid3d_cmds::empty_solid3d;
use crate::scene::acad_to_truck::TruckObject; use crate::scene::convert::acad_to_truck::TruckObject;
use crate::scene::truck_tess; use crate::scene::convert::truck_tess;
use truck_modeling::builder; use truck_modeling::builder;
use truck_modeling::{Point3, Rad, Vector3 as TruckVec3}; use truck_modeling::{Point3, Rad, Vector3 as TruckVec3};
@@ -1270,7 +1270,7 @@ impl OpenCADStudio {
verts, verts,
normals, normals,
indices, indices,
} => Some(crate::scene::mesh_model::MeshModel { } => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(), name: String::new(),
verts, verts,
normals, normals,
@@ -1311,8 +1311,8 @@ impl OpenCADStudio {
} => { } => {
use crate::entities::traits::EntityTypeOps; use crate::entities::traits::EntityTypeOps;
use crate::modules::insert::solid3d_cmds::empty_solid3d; use crate::modules::insert::solid3d_cmds::empty_solid3d;
use crate::scene::acad_to_truck::TruckObject; use crate::scene::convert::acad_to_truck::TruckObject;
use crate::scene::truck_tess; use crate::scene::convert::truck_tess;
use truck_modeling::builder; use truck_modeling::builder;
use truck_modeling::Vector3 as TruckVec3; use truck_modeling::Vector3 as TruckVec3;
@@ -1355,7 +1355,7 @@ impl OpenCADStudio {
verts, verts,
normals, normals,
indices, indices,
} => Some(crate::scene::mesh_model::MeshModel { } => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(), name: String::new(),
verts, verts,
normals, normals,
@@ -1372,7 +1372,7 @@ impl OpenCADStudio {
verts, verts,
normals, normals,
indices, indices,
} => Some(crate::scene::mesh_model::MeshModel { } => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(), name: String::new(),
verts, verts,
normals, normals,
@@ -1404,7 +1404,7 @@ impl OpenCADStudio {
verts, verts,
normals, normals,
indices, indices,
} => Some(crate::scene::mesh_model::MeshModel { } => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(), name: String::new(),
verts, verts,
normals, normals,
@@ -1421,7 +1421,7 @@ impl OpenCADStudio {
verts, verts,
normals, normals,
indices, indices,
} => Some(crate::scene::mesh_model::MeshModel { } => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(), name: String::new(),
verts, verts,
normals, normals,
@@ -1460,8 +1460,8 @@ impl OpenCADStudio {
CmdResult::LoftEntities { handles, color } => { CmdResult::LoftEntities { handles, color } => {
use crate::entities::traits::EntityTypeOps; use crate::entities::traits::EntityTypeOps;
use crate::modules::insert::solid3d_cmds::empty_solid3d; use crate::modules::insert::solid3d_cmds::empty_solid3d;
use crate::scene::acad_to_truck::TruckObject; use crate::scene::convert::acad_to_truck::TruckObject;
use crate::scene::truck_tess; use crate::scene::convert::truck_tess;
use truck_modeling::builder; use truck_modeling::builder;
// Collect wires from each profile. // Collect wires from each profile.
@@ -1482,7 +1482,7 @@ impl OpenCADStudio {
} }
let woff = self.tabs[i].scene.world_offset; let woff = self.tabs[i].scene.world_offset;
let result: Option<crate::scene::mesh_model::MeshModel> = (|| { let result: Option<crate::scene::model::mesh_model::MeshModel> = (|| {
if wires.len() < 2 { if wires.len() < 2 {
return None; return None;
} }
@@ -1511,7 +1511,7 @@ impl OpenCADStudio {
verts, verts,
normals, normals,
indices, indices,
} => Some(crate::scene::mesh_model::MeshModel { } => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(), name: String::new(),
verts, verts,
normals, normals,
@@ -1552,8 +1552,8 @@ impl OpenCADStudio {
if let Some(mut model) = self.tabs[i].scene.hatches.get(&handle).cloned() { if let Some(mut model) = self.tabs[i].scene.hatches.get(&handle).cloned() {
// Update model fields // Update model fields
if !name.is_empty() { if !name.is_empty() {
use crate::scene::hatch_model::HatchPattern; use crate::scene::model::hatch_model::HatchPattern;
use crate::scene::hatch_patterns; use crate::scene::model::hatch_patterns;
model.name = name.clone(); model.name = name.clone();
if name.to_uppercase() == "SOLID" { if name.to_uppercase() == "SOLID" {
model.pattern = HatchPattern::Solid; model.pattern = HatchPattern::Solid;
+1 -1
View File
@@ -1,7 +1,7 @@
use crate::command::CadCommand; use crate::command::CadCommand;
use crate::linetypes; use crate::linetypes;
use crate::modules::home::modify::refedit::RefEditSession; use crate::modules::home::modify::refedit::RefEditSession;
use crate::scene::grip::GripEdit; use crate::scene::pick::grip::GripEdit;
use crate::scene::GripDef; use crate::scene::GripDef;
use crate::scene::Scene; use crate::scene::Scene;
use crate::snap::SnapResult; use crate::snap::SnapResult;
+2 -2
View File
@@ -50,7 +50,7 @@ pub struct GripPopup {
pub handle: acadrust::Handle, pub handle: acadrust::Handle,
pub grip_id: usize, pub grip_id: usize,
pub anchor: iced::Point, pub anchor: iced::Point,
pub items: Vec<crate::scene::object::GripMenuItem>, pub items: Vec<crate::scene::model::object::GripMenuItem>,
pub selected: usize, pub selected: usize,
} }
@@ -62,7 +62,7 @@ pub struct GripPopup {
pub struct GripPendingValue { pub struct GripPendingValue {
pub handle: acadrust::Handle, pub handle: acadrust::Handle,
pub grip_id: usize, pub grip_id: usize,
pub action: crate::scene::object::GripMenuAction, pub action: crate::scene::model::object::GripMenuAction,
pub label: &'static str, pub label: &'static str,
} }
+1 -1
View File
@@ -9,7 +9,7 @@ use truck_modeling::Solid;
use super::Message; use super::Message;
use crate::modules::model::boolean_cmd::BoolOp; use crate::modules::model::boolean_cmd::BoolOp;
use crate::scene::model_solid::{self, Bool}; use crate::scene::model::model_solid::{self, Bool};
impl super::OpenCADStudio { impl super::OpenCADStudio {
/// Commit a Model-tab solid: add its acadrust entity to the document, then /// Commit a Model-tab solid: add its acadrust entity to the document, then
+2 -2
View File
@@ -323,8 +323,8 @@ pub fn visible_spans(raw: &str) -> Vec<(usize, usize)> {
// ── App-side editor driver ────────────────────────────────────────────────── // ── App-side editor driver ──────────────────────────────────────────────────
use crate::scene::tessellate; use crate::scene::convert::tessellate;
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use iced::widget::text_editor::{Action, Edit}; use iced::widget::text_editor::{Action, Edit};
use std::sync::Arc; use std::sync::Arc;
+31 -31
View File
@@ -1,7 +1,7 @@
use super::helpers::{entity_type_key, entity_type_label, title_case_word}; use super::helpers::{entity_type_key, entity_type_label, title_case_word};
use super::{OpenCADStudio, VARIES_LABEL}; use super::{OpenCADStudio, VARIES_LABEL};
use crate::linetypes; use crate::linetypes;
use crate::scene::dispatch; use crate::scene::view::dispatch;
use crate::ui; use crate::ui;
use acadrust::{EntityType, Handle}; use acadrust::{EntityType, Handle};
@@ -118,28 +118,28 @@ impl OpenCADStudio {
.collect(); .collect();
if let Some(geom) = sections.last_mut() { if let Some(geom) = sections.last_mut() {
geom.props.push(crate::scene::object::Property { geom.props.push(crate::scene::model::object::Property {
label: "Frozen Layers".to_string(), label: "Frozen Layers".to_string(),
field: "frozen_layers", field: "frozen_layers",
value: crate::scene::object::PropValue::EditText( value: crate::scene::model::object::PropValue::EditText(
frozen_names.join(", "), frozen_names.join(", "),
), ),
}); });
if !ucs_names.is_empty() { if !ucs_names.is_empty() {
geom.props.push(crate::scene::object::Property { geom.props.push(crate::scene::model::object::Property {
label: "UCS Name".to_string(), label: "UCS Name".to_string(),
field: "vp_ucs_name", field: "vp_ucs_name",
value: crate::scene::object::PropValue::Choice { value: crate::scene::model::object::PropValue::Choice {
selected: current_ucs, selected: current_ucs,
options: ucs_names, options: ucs_names,
}, },
}); });
} }
if !view_names.is_empty() { if !view_names.is_empty() {
geom.props.push(crate::scene::object::Property { geom.props.push(crate::scene::model::object::Property {
label: "Named View".to_string(), label: "Named View".to_string(),
field: "vp_named_view", field: "vp_named_view",
value: crate::scene::object::PropValue::Choice { value: crate::scene::model::object::PropValue::Choice {
selected: String::new(), selected: String::new(),
options: view_names, options: view_names,
}, },
@@ -167,7 +167,7 @@ impl OpenCADStudio {
if let Some(prop) = if let Some(prop) =
geom.props.iter_mut().find(|p| p.field == "vscale_std") geom.props.iter_mut().find(|p| p.field == "vscale_std")
{ {
prop.value = crate::scene::object::PropValue::Choice { prop.value = crate::scene::model::object::PropValue::Choice {
selected, selected,
options, options,
}; };
@@ -195,10 +195,10 @@ impl OpenCADStudio {
geom.props.iter_mut().find(|p| p.field == "style_name") geom.props.iter_mut().find(|p| p.field == "style_name")
{ {
let current = match &prop.value { let current = match &prop.value {
crate::scene::object::PropValue::EditText(s) => s.clone(), crate::scene::model::object::PropValue::EditText(s) => s.clone(),
_ => String::new(), _ => String::new(),
}; };
prop.value = crate::scene::object::PropValue::Choice { prop.value = crate::scene::model::object::PropValue::Choice {
selected: current, selected: current,
options: dim_style_names, options: dim_style_names,
}; };
@@ -210,10 +210,10 @@ impl OpenCADStudio {
if !group_names.is_empty() { if !group_names.is_empty() {
let label = group_names.join(", "); let label = group_names.join(", ");
if let Some(general) = sections.first_mut() { if let Some(general) = sections.first_mut() {
general.props.push(crate::scene::object::Property { general.props.push(crate::scene::model::object::Property {
label: "Group".to_string(), label: "Group".to_string(),
field: "group", field: "group",
value: crate::scene::object::PropValue::ReadOnly(label), value: crate::scene::model::object::PropValue::ReadOnly(label),
}); });
} }
} }
@@ -240,7 +240,7 @@ impl OpenCADStudio {
.iter() .iter()
.flat_map(|section| section.props.iter()) .flat_map(|section| section.props.iter())
.filter_map(|prop| match &prop.value { .filter_map(|prop| match &prop.value {
crate::scene::object::PropValue::Choice { options, .. } => Some(( crate::scene::model::object::PropValue::Choice { options, .. } => Some((
prop.field.to_string(), prop.field.to_string(),
iced::widget::combo_box::State::new(options.clone()), iced::widget::combo_box::State::new(options.clone()),
)), )),
@@ -252,7 +252,7 @@ impl OpenCADStudio {
layer_combo: iced::widget::combo_box::State::new(layer_names.clone()), layer_combo: iced::widget::combo_box::State::new(layer_names.clone()),
linetype_combo: iced::widget::combo_box::State::new(linetype_items.clone()), linetype_combo: iced::widget::combo_box::State::new(linetype_items.clone()),
hatch_pattern_combo: iced::widget::combo_box::State::new( hatch_pattern_combo: iced::widget::combo_box::State::new(
crate::scene::hatch_patterns::names(), crate::scene::model::hatch_patterns::names(),
), ),
lineweight_combo: iced::widget::combo_box::State::new( lineweight_combo: iced::widget::combo_box::State::new(
ui::properties::lw_options(), ui::properties::lw_options(),
@@ -284,7 +284,7 @@ impl OpenCADStudio {
.iter() .iter()
.flat_map(|section| section.props.iter()) .flat_map(|section| section.props.iter())
.filter_map(|prop| match &prop.value { .filter_map(|prop| match &prop.value {
crate::scene::object::PropValue::Choice { options, .. } => Some(( crate::scene::model::object::PropValue::Choice { options, .. } => Some((
prop.field.to_string(), prop.field.to_string(),
iced::widget::combo_box::State::new(options.clone()), iced::widget::combo_box::State::new(options.clone()),
)), )),
@@ -299,7 +299,7 @@ impl OpenCADStudio {
layer_combo: iced::widget::combo_box::State::new(layer_names.clone()), layer_combo: iced::widget::combo_box::State::new(layer_names.clone()),
linetype_combo: iced::widget::combo_box::State::new(linetype_items.clone()), linetype_combo: iced::widget::combo_box::State::new(linetype_items.clone()),
hatch_pattern_combo: iced::widget::combo_box::State::new( hatch_pattern_combo: iced::widget::combo_box::State::new(
crate::scene::hatch_patterns::names(), crate::scene::model::hatch_patterns::names(),
), ),
lineweight_combo: iced::widget::combo_box::State::new( lineweight_combo: iced::widget::combo_box::State::new(
ui::properties::lw_options(), ui::properties::lw_options(),
@@ -527,13 +527,13 @@ impl OpenCADStudio {
} }
} }
crate::scene::dispatch::apply_color(&mut entity, self.ribbon.active_color); crate::scene::view::dispatch::apply_color(&mut entity, self.ribbon.active_color);
crate::scene::dispatch::apply_common_prop( crate::scene::view::dispatch::apply_common_prop(
&mut entity, &mut entity,
"linetype", "linetype",
&self.ribbon.active_linetype.clone(), &self.ribbon.active_linetype.clone(),
); );
crate::scene::dispatch::apply_line_weight(&mut entity, self.ribbon.active_lineweight); crate::scene::view::dispatch::apply_line_weight(&mut entity, self.ribbon.active_lineweight);
// CELTSCALE (header.current_entity_linetype_scale): new entities // CELTSCALE (header.current_entity_linetype_scale): new entities
// pick up the document's saved per-entity linetype scale. The user // pick up the document's saved per-entity linetype scale. The user
// can override per entity later via the properties panel. // can override per entity later via the properties panel.
@@ -741,12 +741,12 @@ pub(super) fn build_selection_groups(
pub(super) fn aggregate_sections( pub(super) fn aggregate_sections(
selected: &[(Handle, &EntityType)], selected: &[(Handle, &EntityType)],
text_style_names: &[String], text_style_names: &[String],
) -> Vec<crate::scene::object::PropSection> { ) -> Vec<crate::scene::model::object::PropSection> {
if selected.is_empty() { if selected.is_empty() {
return vec![]; return vec![];
} }
let mut all_sections: Vec<Vec<crate::scene::object::PropSection>> = selected let mut all_sections: Vec<Vec<crate::scene::model::object::PropSection>> = selected
.iter() .iter()
.map(|(handle, entity)| dispatch::properties_sectioned(*handle, entity, text_style_names)) .map(|(handle, entity)| dispatch::properties_sectioned(*handle, entity, text_style_names))
.collect(); .collect();
@@ -759,15 +759,15 @@ pub(super) fn aggregate_sections(
} }
fn merge_sections( fn merge_sections(
left: &[crate::scene::object::PropSection], left: &[crate::scene::model::object::PropSection],
right: &[crate::scene::object::PropSection], right: &[crate::scene::model::object::PropSection],
) -> Vec<crate::scene::object::PropSection> { ) -> Vec<crate::scene::model::object::PropSection> {
left.iter() left.iter()
.filter_map(|section| { .filter_map(|section| {
let rhs = right let rhs = right
.iter() .iter()
.find(|candidate| candidate.title == section.title)?; .find(|candidate| candidate.title == section.title)?;
let props: Vec<crate::scene::object::Property> = section let props: Vec<crate::scene::model::object::Property> = section
.props .props
.iter() .iter()
.filter_map(|prop| { .filter_map(|prop| {
@@ -775,7 +775,7 @@ fn merge_sections(
.props .props
.iter() .iter()
.find(|candidate| candidate.field == prop.field)?; .find(|candidate| candidate.field == prop.field)?;
Some(crate::scene::object::Property { Some(crate::scene::model::object::Property {
label: prop.label.clone(), label: prop.label.clone(),
field: prop.field, field: prop.field,
value: merge_prop_value(&prop.value, &other.value), value: merge_prop_value(&prop.value, &other.value),
@@ -785,7 +785,7 @@ fn merge_sections(
if props.is_empty() { if props.is_empty() {
None None
} else { } else {
Some(crate::scene::object::PropSection { Some(crate::scene::model::object::PropSection {
title: section.title.clone(), title: section.title.clone(),
props, props,
}) })
@@ -795,10 +795,10 @@ fn merge_sections(
} }
fn merge_prop_value( fn merge_prop_value(
left: &crate::scene::object::PropValue, left: &crate::scene::model::object::PropValue,
right: &crate::scene::object::PropValue, right: &crate::scene::model::object::PropValue,
) -> crate::scene::object::PropValue { ) -> crate::scene::model::object::PropValue {
use crate::scene::object::PropValue; use crate::scene::model::object::PropValue;
if left == right { if left == right {
return left.clone(); return left.clone();
+39 -39
View File
@@ -4,8 +4,8 @@ use super::helpers::{
}; };
use super::{Message, OpenCADStudio, POLY_START_DELAY_MS}; use super::{Message, OpenCADStudio, POLY_START_DELAY_MS};
use crate::modules::ModuleEvent; use crate::modules::ModuleEvent;
use crate::scene::grip::{find_hit_grip, find_hit_grip_paper, GripEdit}; use crate::scene::pick::grip::{find_hit_grip, find_hit_grip_paper, GripEdit};
use crate::scene::object::GripApply; use crate::scene::model::object::GripApply;
use crate::scene::{ use crate::scene::{
self, hover_id, Scene, TileEdgeOrient, VIEWCUBE_DRAW_PX, VIEWCUBE_PAD, VIEWCUBE_PX, self, hover_id, Scene, TileEdgeOrient, VIEWCUBE_DRAW_PX, VIEWCUBE_PAD, VIEWCUBE_PX,
}; };
@@ -552,13 +552,13 @@ impl OpenCADStudio {
// STL gets the highest-resolution LOD (slot 0) so the // STL gets the highest-resolution LOD (slot 0) so the
// exported geometry isn't downgraded by the view-dependent // exported geometry isn't downgraded by the view-dependent
// mesh LOD ladder used for rendering. // mesh LOD ladder used for rendering.
let meshes: Vec<crate::scene::mesh_model::MeshModel> = self.tabs[i] let meshes: Vec<crate::scene::model::mesh_model::MeshModel> = self.tabs[i]
.scene .scene
.meshes .meshes
.values() .values()
.filter_map(|s| s.lods.first().cloned()) .filter_map(|s| s.lods.first().cloned())
.collect(); .collect();
let mesh_refs: Vec<&crate::scene::mesh_model::MeshModel> = meshes.iter().collect(); let mesh_refs: Vec<&crate::scene::model::mesh_model::MeshModel> = meshes.iter().collect();
match crate::io::stl::build_stl(&mesh_refs) { match crate::io::stl::build_stl(&mesh_refs) {
Some(bytes) => match std::fs::write(&path, bytes) { Some(bytes) => match std::fs::write(&path, bytes) {
Ok(()) => self Ok(()) => self
@@ -603,13 +603,13 @@ impl OpenCADStudio {
Message::StepExportPath(Some(path)) => { Message::StepExportPath(Some(path)) => {
let i = self.active_tab; let i = self.active_tab;
// Export uses LOD 0 (full resolution); see StlExportPath above. // Export uses LOD 0 (full resolution); see StlExportPath above.
let meshes: Vec<crate::scene::mesh_model::MeshModel> = self.tabs[i] let meshes: Vec<crate::scene::model::mesh_model::MeshModel> = self.tabs[i]
.scene .scene
.meshes .meshes
.values() .values()
.filter_map(|s| s.lods.first().cloned()) .filter_map(|s| s.lods.first().cloned())
.collect(); .collect();
let mesh_refs: Vec<&crate::scene::mesh_model::MeshModel> = meshes.iter().collect(); let mesh_refs: Vec<&crate::scene::model::mesh_model::MeshModel> = meshes.iter().collect();
match crate::io::step::build_step(&mesh_refs) { match crate::io::step::build_step(&mesh_refs) {
Some(text) => match std::fs::write(&path, text.as_bytes()) { Some(text) => match std::fs::write(&path, text.as_bytes()) {
Ok(()) => self Ok(()) => self
@@ -1435,7 +1435,7 @@ impl OpenCADStudio {
if let Some(e) = self.tabs[i].scene.document.get_entity_mut(h) { if let Some(e) = self.tabs[i].scene.document.get_entity_mut(h) {
e.apply_grip_menu( e.apply_grip_menu(
gid, gid,
crate::scene::object::GripMenuAction::RemoveLeader, crate::scene::model::object::GripMenuAction::RemoveLeader,
); );
} }
self.tabs[i].scene.bump_geometry(); self.tabs[i].scene.bump_geometry();
@@ -2121,7 +2121,7 @@ impl OpenCADStudio {
// Multi-functional grip hover: detect cursor sitting on a // Multi-functional grip hover: detect cursor sitting on a
// selected entity's grip and, after a dwell, open the // selected entity's grip and, after a dwell, open the
// popup menu. See scene::object::GripMenuItem. // popup menu. See scene::model::object::GripMenuItem.
self.update_grip_hover(i, p); self.update_grip_hover(i, p);
let mut sel = self.tabs[i].scene.selection.borrow_mut(); let mut sel = self.tabs[i].scene.selection.borrow_mut();
@@ -2405,7 +2405,7 @@ impl OpenCADStudio {
}; };
let view_proj = self.tabs[i].scene.camera.borrow().view_proj(bounds); let view_proj = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let all_wires = self.tabs[i].scene.hit_test_wires(); let all_wires = self.tabs[i].scene.hit_test_wires();
let hovered = scene::hit_test::click_hit(p, &all_wires[..], view_proj, bounds) let hovered = scene::pick::hit_test::click_hit(p, &all_wires[..], view_proj, bounds)
.and_then(|s| Scene::handle_from_wire_name(s)); .and_then(|s| Scene::handle_from_wire_name(s));
self.tabs[i].scene.set_hover_highlight(hovered); self.tabs[i].scene.set_hover_highlight(hovered);
} else { } else {
@@ -2620,7 +2620,7 @@ impl OpenCADStudio {
p p
} else if needs_entity { } else if needs_entity {
let hover_handle = let hover_handle =
scene::hit_test::click_hit(p, &all_wires[..], view_proj, bounds) scene::pick::hit_test::click_hit(p, &all_wires[..], view_proj, bounds)
.and_then(|s| Scene::handle_from_wire_name(s)) .and_then(|s| Scene::handle_from_wire_name(s))
.unwrap_or(acadrust::Handle::NULL); .unwrap_or(acadrust::Handle::NULL);
let mut p = self.tabs[i] let mut p = self.tabs[i]
@@ -3185,7 +3185,7 @@ impl OpenCADStudio {
{ {
let vp_mat2 = self.tabs[i].scene.camera.borrow().view_proj(bounds); let vp_mat2 = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let all_wires2 = self.tabs[i].scene.hit_test_wires(); let all_wires2 = self.tabs[i].scene.hit_test_wires();
let hit = scene::hit_test::click_hit(p, &all_wires2[..], vp_mat2, bounds) let hit = scene::pick::hit_test::click_hit(p, &all_wires2[..], vp_mat2, bounds)
.and_then(|s| Scene::handle_from_wire_name(s)); .and_then(|s| Scene::handle_from_wire_name(s));
if let Some(handle) = hit { if let Some(handle) = hit {
// Some commands (e.g. SS_CATCHMENT) need the entity // Some commands (e.g. SS_CATCHMENT) need the entity
@@ -3374,7 +3374,7 @@ impl OpenCADStudio {
let crossing = box_crossing; let crossing = box_crossing;
let all_wires = self.tabs[i].scene.hit_test_wires(); let all_wires = self.tabs[i].scene.hit_test_wires();
let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds); let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let mut handles: Vec<Handle> = scene::hit_test::box_hit( let mut handles: Vec<Handle> = scene::pick::hit_test::box_hit(
a, a,
p, p,
crossing, crossing,
@@ -3385,7 +3385,7 @@ impl OpenCADStudio {
.into_iter() .into_iter()
.filter_map(|s| Scene::handle_from_wire_name(s)) .filter_map(|s| Scene::handle_from_wire_name(s))
.collect(); .collect();
handles.extend(scene::hit_test::box_hit_hatch( handles.extend(scene::pick::hit_test::box_hit_hatch(
a, a,
p, p,
crossing, crossing,
@@ -3427,7 +3427,7 @@ impl OpenCADStudio {
self.tabs[i].scene.selection.borrow_mut().poly_last_crossing = crossing; self.tabs[i].scene.selection.borrow_mut().poly_last_crossing = crossing;
let all_wires = self.tabs[i].scene.hit_test_wires(); let all_wires = self.tabs[i].scene.hit_test_wires();
let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds); let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let mut handles: Vec<Handle> = scene::hit_test::poly_hit( let mut handles: Vec<Handle> = scene::pick::hit_test::poly_hit(
&poly_pts, &poly_pts,
crossing, crossing,
&all_wires[..], &all_wires[..],
@@ -3437,7 +3437,7 @@ impl OpenCADStudio {
.into_iter() .into_iter()
.filter_map(|s| Scene::handle_from_wire_name(s)) .filter_map(|s| Scene::handle_from_wire_name(s))
.collect(); .collect();
handles.extend(scene::hit_test::poly_hit_hatch( handles.extend(scene::pick::hit_test::poly_hit_hatch(
&poly_pts, &poly_pts,
crossing, crossing,
&self.tabs[i].scene.visible_hatches_for_click(), &self.tabs[i].scene.visible_hatches_for_click(),
@@ -3481,7 +3481,7 @@ impl OpenCADStudio {
// unchanged when off. // unchanged when off.
let mut handled_by_cycling = false; let mut handled_by_cycling = false;
if self.selection_cycling { if self.selection_cycling {
let cands: Vec<Handle> = scene::hit_test::click_hits_all( let cands: Vec<Handle> = scene::pick::hit_test::click_hits_all(
p, p,
&all_wires[..], &all_wires[..],
vp_mat, vp_mat,
@@ -3500,10 +3500,10 @@ impl OpenCADStudio {
if !handled_by_cycling { if !handled_by_cycling {
let hit = let hit =
scene::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds) scene::pick::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds)
.and_then(|s| Scene::handle_from_wire_name(s)) .and_then(|s| Scene::handle_from_wire_name(s))
.or_else(|| { .or_else(|| {
scene::hit_test::click_hit_hatch( scene::pick::hit_test::click_hit_hatch(
p, p,
&self.tabs[i].scene.visible_hatches_for_click(), &self.tabs[i].scene.visible_hatches_for_click(),
vp_mat, vp_mat,
@@ -3513,7 +3513,7 @@ impl OpenCADStudio {
.or_else(|| { .or_else(|| {
// Block-internal hatch: resolve to the // Block-internal hatch: resolve to the
// parent Insert (AutoCAD behaviour). // parent Insert (AutoCAD behaviour).
scene::hit_test::click_hit_insert_hatch( scene::pick::hit_test::click_hit_insert_hatch(
p, p,
&self.tabs[i].scene.insert_hatches_for_click(), &self.tabs[i].scene.insert_hatches_for_click(),
vp_mat, vp_mat,
@@ -3561,7 +3561,7 @@ impl OpenCADStudio {
let crossing = box_crossing; let crossing = box_crossing;
let all_wires = self.tabs[i].scene.hit_test_wires(); let all_wires = self.tabs[i].scene.hit_test_wires();
let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds); let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let mut handles: Vec<Handle> = scene::hit_test::box_hit( let mut handles: Vec<Handle> = scene::pick::hit_test::box_hit(
a, a,
p, p,
crossing, crossing,
@@ -3572,7 +3572,7 @@ impl OpenCADStudio {
.into_iter() .into_iter()
.filter_map(|s| Scene::handle_from_wire_name(s)) .filter_map(|s| Scene::handle_from_wire_name(s))
.collect(); .collect();
handles.extend(scene::hit_test::box_hit_hatch( handles.extend(scene::pick::hit_test::box_hit_hatch(
a, a,
p, p,
crossing, crossing,
@@ -3657,7 +3657,7 @@ impl OpenCADStudio {
}; };
let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds); let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let all_wires = self.tabs[i].scene.hit_test_wires(); let all_wires = self.tabs[i].scene.hit_test_wires();
let hit = scene::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds) let hit = scene::pick::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds)
.and_then(|s| Scene::handle_from_wire_name(s)); .and_then(|s| Scene::handle_from_wire_name(s));
if let Some(handle) = hit { if let Some(handle) = hit {
// Any text-bearing entity opens its in-place editor // Any text-bearing entity opens its in-place editor
@@ -3712,7 +3712,7 @@ impl OpenCADStudio {
let hit_vp: Option<acadrust::Handle> = { let hit_vp: Option<acadrust::Handle> = {
let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds); let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let all_wires = self.tabs[i].scene.hit_test_wires(); let all_wires = self.tabs[i].scene.hit_test_wires();
scene::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds) scene::pick::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds)
.and_then(|s| Scene::handle_from_wire_name(s)) .and_then(|s| Scene::handle_from_wire_name(s))
.and_then(|h| { .and_then(|h| {
if let Some(AcadEntityType::Viewport(vp)) = if let Some(AcadEntityType::Viewport(vp)) =
@@ -3981,7 +3981,7 @@ impl OpenCADStudio {
return Task::none(); return Task::none();
}; };
use crate::entities::traits::EntityTypeOps; use crate::entities::traits::EntityTypeOps;
use crate::scene::object::GripMenuAction; use crate::scene::model::object::GripMenuAction;
if matches!( if matches!(
item.action, item.action,
GripMenuAction::Stretch GripMenuAction::Stretch
@@ -4643,7 +4643,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP"); self.push_undo_snapshot(i, "CHPROP");
for handle in handles { for handle in handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_common_prop(entity, "layer", &layer); crate::scene::view::dispatch::apply_common_prop(entity, "layer", &layer);
} }
} }
self.tabs[i].dirty = true; self.tabs[i].dirty = true;
@@ -4669,7 +4669,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP"); self.push_undo_snapshot(i, "CHPROP");
for handle in handles { for handle in handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_color(entity, color); crate::scene::view::dispatch::apply_color(entity, color);
} }
} }
self.tabs[i].dirty = true; self.tabs[i].dirty = true;
@@ -4706,7 +4706,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP"); self.push_undo_snapshot(i, "CHPROP");
for handle in handles { for handle in handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_common_prop(entity, "linetype", &lt); crate::scene::view::dispatch::apply_common_prop(entity, "linetype", &lt);
} }
} }
self.tabs[i].dirty = true; self.tabs[i].dirty = true;
@@ -4728,7 +4728,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP"); self.push_undo_snapshot(i, "CHPROP");
for handle in handles { for handle in handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_line_weight(entity, lw); crate::scene::view::dispatch::apply_line_weight(entity, lw);
} }
} }
self.tabs[i].dirty = true; self.tabs[i].dirty = true;
@@ -4790,7 +4790,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP"); self.push_undo_snapshot(i, "CHPROP");
for &handle in &handles { for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_common_prop(entity, "layer", &layer); crate::scene::view::dispatch::apply_common_prop(entity, "layer", &layer);
} }
} }
self.invalidate_property_targets(i, &handles); self.invalidate_property_targets(i, &handles);
@@ -4807,7 +4807,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP"); self.push_undo_snapshot(i, "CHPROP");
for &handle in &handles { for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_color(entity, color); crate::scene::view::dispatch::apply_color(entity, color);
} }
} }
self.invalidate_property_targets(i, &handles); self.invalidate_property_targets(i, &handles);
@@ -4826,7 +4826,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP"); self.push_undo_snapshot(i, "CHPROP");
for &handle in &handles { for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_line_weight(entity, lw); crate::scene::view::dispatch::apply_line_weight(entity, lw);
} }
} }
self.invalidate_property_targets(i, &handles); self.invalidate_property_targets(i, &handles);
@@ -4843,7 +4843,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP"); self.push_undo_snapshot(i, "CHPROP");
for &handle in &handles { for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_common_prop(entity, "linetype", &lt); crate::scene::view::dispatch::apply_common_prop(entity, "linetype", &lt);
} }
} }
self.invalidate_property_targets(i, &handles); self.invalidate_property_targets(i, &handles);
@@ -4857,7 +4857,7 @@ impl OpenCADStudio {
let i = self.active_tab; let i = self.active_tab;
let handles = self.property_target_handles(i); let handles = self.property_target_handles(i);
if !handles.is_empty() { if !handles.is_empty() {
use crate::scene::hatch_patterns; use crate::scene::model::hatch_patterns;
if let Some(entry) = hatch_patterns::find(&name) { if let Some(entry) = hatch_patterns::find(&name) {
self.push_undo_snapshot(i, "HATCHEDIT"); self.push_undo_snapshot(i, "HATCHEDIT");
for &handle in &handles { for &handle in &handles {
@@ -4867,7 +4867,7 @@ impl OpenCADStudio {
dxf.pattern = hatch_patterns::build_dxf_pattern(entry); dxf.pattern = hatch_patterns::build_dxf_pattern(entry);
dxf.is_solid = matches!( dxf.is_solid = matches!(
entry.gpu, entry.gpu,
crate::scene::hatch_model::HatchPattern::Solid crate::scene::model::hatch_model::HatchPattern::Solid
); );
} }
if let Some(model) = self.tabs[i].scene.hatches.get_mut(&handle) { if let Some(model) = self.tabs[i].scene.hatches.get_mut(&handle) {
@@ -4891,9 +4891,9 @@ impl OpenCADStudio {
for &handle in &handles { for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
match field { match field {
"invisible" => crate::scene::dispatch::toggle_invisible(entity), "invisible" => crate::scene::view::dispatch::toggle_invisible(entity),
_ => { _ => {
crate::scene::dispatch::apply_geom_prop(entity, field, "toggle") crate::scene::view::dispatch::apply_geom_prop(entity, field, "toggle")
} }
} }
} }
@@ -4958,7 +4958,7 @@ impl OpenCADStudio {
for &handle in &handles { for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle)
{ {
crate::scene::dispatch::apply_geom_prop(entity, field, &value); crate::scene::view::dispatch::apply_geom_prop(entity, field, &value);
} }
} }
} }
@@ -5014,12 +5014,12 @@ impl OpenCADStudio {
{ {
match field { match field {
"linetype_scale" | "transparency" => { "linetype_scale" | "transparency" => {
crate::scene::dispatch::apply_common_prop( crate::scene::view::dispatch::apply_common_prop(
entity, field, &val, entity, field, &val,
); );
} }
_ => { _ => {
crate::scene::dispatch::apply_geom_prop( crate::scene::view::dispatch::apply_geom_prop(
entity, field, &val, entity, field, &val,
); );
} }
+2 -2
View File
@@ -3,8 +3,8 @@ use super::document::{DynComponent, DynFieldEntry};
use super::helpers::grid_plane_from_camera; use super::helpers::grid_plane_from_camera;
use super::history::history_dropdown_labels; use super::history::history_dropdown_labels;
use super::{Message, OpenCADStudio}; use super::{Message, OpenCADStudio};
use crate::scene::grip::{grips_to_screen, grips_to_screen_paper}; use crate::scene::pick::grip::{grips_to_screen, grips_to_screen_paper};
use crate::scene::viewport_pane::ViewportPane; use crate::scene::view::viewport_pane::ViewportPane;
use crate::scene::{VIEWCUBE_DRAW_PX, VIEWCUBE_PAD}; use crate::scene::{VIEWCUBE_DRAW_PX, VIEWCUBE_PAD};
use crate::ui::overlay; use crate::ui::overlay;
use iced::widget::{ use iced::widget::{
+1 -1
View File
@@ -15,7 +15,7 @@ use acadrust::objects::BlockVisibilityParameter;
use acadrust::types::Vector3; use acadrust::types::Vector3;
use acadrust::{EntityType, Handle}; use acadrust::{EntityType, Handle};
use crate::scene::object::{GripDef, GripShape}; use crate::scene::model::object::{GripDef, GripShape};
use super::OpenCADStudio; use super::OpenCADStudio;
+3 -3
View File
@@ -5,8 +5,8 @@
// viewport events from main.rs and returns `CmdResult` tokens that tell // viewport events from main.rs and returns `CmdResult` tokens that tell
// the host what to do next. // the host what to do next.
use crate::scene::hatch_model::HatchModel; use crate::scene::model::hatch_model::HatchModel;
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use crate::scene::Scene; use crate::scene::Scene;
use acadrust::{EntityType, Handle}; use acadrust::{EntityType, Handle};
use glam::Vec3; use glam::Vec3;
@@ -194,7 +194,7 @@ pub enum CmdResult {
/// Create a Solid3D placeholder entity + associated MeshModel. /// Create a Solid3D placeholder entity + associated MeshModel.
/// `mesh_fn` is called with the entity's handle string to build the mesh. /// `mesh_fn` is called with the entity's handle string to build the mesh.
CommitSolid3D { CommitSolid3D {
mesh_fn: Box<dyn FnOnce(String) -> Option<crate::scene::mesh_model::MeshModel> + Send>, mesh_fn: Box<dyn FnOnce(String) -> Option<crate::scene::model::mesh_model::MeshModel> + Send>,
}, },
/// Extrude the profile entity `handle` by `height` along Z. /// Extrude the profile entity `handle` by `height` along Z.
ExtrudeEntity { ExtrudeEntity {
+14 -14
View File
@@ -5,9 +5,9 @@ use truck_modeling::{builder, Point3};
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, parse_f64, square_grip}; use crate::entities::common::{center_grip, edit_prop as edit, parse_f64, square_grip};
use crate::entities::traits::TruckConvertible; use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::{SnapHint, TangentGeom}; use crate::scene::model::wire_model::{SnapHint, TangentGeom};
const TAU: f64 = std::f64::consts::TAU; const TAU: f64 = std::f64::consts::TAU;
@@ -21,13 +21,13 @@ fn to_truck(arc: &Arc) -> TruckEntity {
let normal = (arc.normal.x, arc.normal.y, arc.normal.z); let normal = (arc.normal.x, arc.normal.y, arc.normal.z);
// Compute OCS basis vectors for this entity's normal. // Compute OCS basis vectors for this entity's normal.
let (ax, ay) = crate::scene::transform::ocs_axes(normal); let (ax, ay) = crate::scene::view::transform::ocs_axes(normal);
let ccw_end = if ea >= sa { ea } else { ea + TAU }; let ccw_end = if ea >= sa { ea } else { ea + TAU };
let mid_a = sa + (ccw_end - sa) * 0.5; let mid_a = sa + (ccw_end - sa) * 0.5;
// Arc centre in WCS. // Arc centre in WCS.
let (cwx, cwy, cwz) = crate::scene::transform::ocs_point_to_wcs((cx, cy, cz), normal); let (cwx, cwy, cwz) = crate::scene::view::transform::ocs_point_to_wcs((cx, cy, cz), normal);
// Arc points in WCS: centre_wcs + r*cos(a)*Ax + r*sin(a)*Ay // Arc points in WCS: centre_wcs + r*cos(a)*Ax + r*sin(a)*Ay
let arc_pt = |a: f64| { let arc_pt = |a: f64| {
@@ -198,8 +198,8 @@ fn apply_grip(arc: &mut Arc, grip_id: usize, apply: GripApply) {
} }
fn apply_transform(arc: &mut Arc, t: &EntityTransform) { fn apply_transform(arc: &mut Arc, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(arc, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(arc, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x, &mut entity.center.x,
&mut entity.center.y, &mut entity.center.y,
p1, p1,
@@ -227,8 +227,8 @@ impl crate::entities::traits::Grippable for Arc {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) { fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply); apply_grip(self, grip_id, apply);
} }
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
match grip_id { match grip_id {
0 => vec![GripMenuItem { 0 => vec![GripMenuItem {
label: "Stretch", label: "Stretch",
@@ -260,7 +260,7 @@ impl crate::entities::traits::Grippable for Arc {
], ],
} }
} }
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Radius / Arc Length / Lengthen all need a follow-up prompt; // Radius / Arc Length / Lengthen all need a follow-up prompt;
// the actual edit happens in `apply_grip_menu_value`. // the actual edit happens in `apply_grip_menu_value`.
} }
@@ -268,9 +268,9 @@ impl crate::entities::traits::Grippable for Arc {
fn grip_menu_value_prompt( fn grip_menu_value_prompt(
&self, &self,
_grip_id: usize, _grip_id: usize,
action: crate::scene::object::GripMenuAction, action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> { ) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
match action { match action {
A::Radius => Some("New radius"), A::Radius => Some("New radius"),
A::ArcLength => Some("New arc length"), A::ArcLength => Some("New arc length"),
@@ -282,10 +282,10 @@ impl crate::entities::traits::Grippable for Arc {
fn apply_grip_menu_value( fn apply_grip_menu_value(
&mut self, &mut self,
grip_id: usize, grip_id: usize,
action: crate::scene::object::GripMenuAction, action: crate::scene::model::object::GripMenuAction,
value: f64, value: f64,
) { ) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
match action { match action {
A::Radius if value > 0.0 => self.radius = value, A::Radius if value > 0.0 => self.radius = value,
A::ArcLength if value > 0.0 && self.radius > 1e-9 => { A::ArcLength if value > 0.0 && self.radius > 1e-9 => {
+5 -4
View File
@@ -12,10 +12,11 @@ use crate::entities::text_support::{
MTextRenderOpts, MTextVAnchor, ResolvedTextStyle, MTextRenderOpts, MTextVAnchor, ResolvedTextStyle,
}; };
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TextStroke, TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property}; use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
use crate::scene::{lff, transform}; use crate::scene::text::lff;
use crate::scene::view::transform;
// ── Shared helpers ──────────────────────────────────────────────────────────── // ── Shared helpers ────────────────────────────────────────────────────────────
+7 -7
View File
@@ -7,9 +7,9 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip, center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
}; };
use crate::entities::traits::TruckConvertible; use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::{SnapHint, TangentGeom}; use crate::scene::model::wire_model::{SnapHint, TangentGeom};
fn to_truck(circle: &Circle) -> TruckEntity { fn to_truck(circle: &Circle) -> TruckEntity {
let cx = circle.center.x; let cx = circle.center.x;
@@ -18,8 +18,8 @@ fn to_truck(circle: &Circle) -> TruckEntity {
let r = circle.radius; let r = circle.radius;
let normal = (circle.normal.x, circle.normal.y, circle.normal.z); let normal = (circle.normal.x, circle.normal.y, circle.normal.z);
let (ax, ay) = crate::scene::transform::ocs_axes(normal); let (ax, ay) = crate::scene::view::transform::ocs_axes(normal);
let (cwx, cwy, cwz) = crate::scene::transform::ocs_point_to_wcs((cx, cy, cz), normal); let (cwx, cwy, cwz) = crate::scene::view::transform::ocs_point_to_wcs((cx, cy, cz), normal);
// Circle points in WCS: centre_wcs ± r * Ax and centre_wcs ± r * Ay // Circle points in WCS: centre_wcs ± r * Ax and centre_wcs ± r * Ay
let pt = |da: (f64, f64, f64), db: (f64, f64, f64), s: f64| { let pt = |da: (f64, f64, f64), db: (f64, f64, f64), s: f64| {
@@ -182,8 +182,8 @@ fn apply_grip(circle: &mut Circle, grip_id: usize, apply: GripApply) {
} }
fn apply_transform(circle: &mut Circle, t: &EntityTransform) { fn apply_transform(circle: &mut Circle, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(circle, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(circle, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x, &mut entity.center.x,
&mut entity.center.y, &mut entity.center.y,
p1, p1,
+1 -1
View File
@@ -1,6 +1,6 @@
use std::cell::Cell; use std::cell::Cell;
use crate::scene::object::{GripDef, GripShape, PropValue, Property}; use crate::scene::model::object::{GripDef, GripShape, PropValue, Property};
/// Linear / angular unit format pulled from the document header so the /// Linear / angular unit format pulled from the document header so the
/// per-thread properties pipeline can format values consistently without /// per-thread properties pipeline can format values consistently without
+21 -21
View File
@@ -10,26 +10,26 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip, center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
}; };
use crate::entities::traits::{Grippable, PropertyEditable, Transformable}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
fn base_props(base: &DimensionBase) -> Vec<crate::scene::object::Property> { fn base_props(base: &DimensionBase) -> Vec<crate::scene::model::object::Property> {
vec![ vec![
crate::scene::object::Property { crate::scene::model::object::Property {
label: "Text".into(), label: "Text".into(),
field: "text", field: "text",
value: crate::scene::object::PropValue::EditText(base.text.clone()), value: crate::scene::model::object::PropValue::EditText(base.text.clone()),
}, },
crate::scene::object::Property { crate::scene::model::object::Property {
label: "User Text".into(), label: "User Text".into(),
field: "user_text", field: "user_text",
value: crate::scene::object::PropValue::EditText( value: crate::scene::model::object::PropValue::EditText(
base.user_text.clone().unwrap_or_default(), base.user_text.clone().unwrap_or_default(),
), ),
}, },
crate::scene::object::Property { crate::scene::model::object::Property {
label: "Style".into(), label: "Style".into(),
field: "style_name", field: "style_name",
value: crate::scene::object::PropValue::EditText(base.style_name.clone()), value: crate::scene::model::object::PropValue::EditText(base.style_name.clone()),
}, },
edit("Text X", "text_x", base.text_middle_point.x), edit("Text X", "text_x", base.text_middle_point.x),
edit("Text Y", "text_y", base.text_middle_point.y), edit("Text Y", "text_y", base.text_middle_point.y),
@@ -135,7 +135,7 @@ fn linear_like_props(
first: acadrust::types::Vector3, first: acadrust::types::Vector3,
second: acadrust::types::Vector3, second: acadrust::types::Vector3,
definition: acadrust::types::Vector3, definition: acadrust::types::Vector3,
) -> Vec<crate::scene::object::Property> { ) -> Vec<crate::scene::model::object::Property> {
vec![ vec![
edit("First X", "first_x", first.x), edit("First X", "first_x", first.x),
edit("First Y", "first_y", first.y), edit("First Y", "first_y", first.y),
@@ -152,7 +152,7 @@ fn linear_like_props(
fn radius_like_props( fn radius_like_props(
center: acadrust::types::Vector3, center: acadrust::types::Vector3,
point: acadrust::types::Vector3, point: acadrust::types::Vector3,
) -> Vec<crate::scene::object::Property> { ) -> Vec<crate::scene::model::object::Property> {
vec![ vec![
edit("Center X", "center_x", center.x), edit("Center X", "center_x", center.x),
edit("Center Y", "center_y", center.y), edit("Center Y", "center_y", center.y),
@@ -168,7 +168,7 @@ fn angular_props(
first: acadrust::types::Vector3, first: acadrust::types::Vector3,
second: acadrust::types::Vector3, second: acadrust::types::Vector3,
definition: acadrust::types::Vector3, definition: acadrust::types::Vector3,
) -> Vec<crate::scene::object::Property> { ) -> Vec<crate::scene::model::object::Property> {
vec![ vec![
edit("Vertex X", "vertex_x", vertex.x), edit("Vertex X", "vertex_x", vertex.x),
edit("Vertex Y", "vertex_y", vertex.y), edit("Vertex Y", "vertex_y", vertex.y),
@@ -555,7 +555,7 @@ fn scale_point(p: &mut acadrust::types::Vector3, center: Vec3, factor: f32) {
} }
fn mirror_point(p: &mut acadrust::types::Vector3, p1: Vec3, p2: Vec3) { fn mirror_point(p: &mut acadrust::types::Vector3, p1: Vec3, p2: Vec3) {
crate::scene::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2); crate::scene::view::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2);
} }
impl PropertyEditable for Dimension { impl PropertyEditable for Dimension {
@@ -713,8 +713,8 @@ impl Grippable for Dimension {
self.base_mut().actual_measurement = self.measurement(); self.base_mut().actual_measurement = self.measurement();
} }
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let (dim_line_grip, text_grip) = match self { let (dim_line_grip, text_grip) = match self {
Dimension::Linear(_) | Dimension::Aligned(_) => (2, 3), Dimension::Linear(_) | Dimension::Aligned(_) => (2, 3),
Dimension::Radius(_) | Dimension::Diameter(_) => (1, 2), Dimension::Radius(_) | Dimension::Diameter(_) => (1, 2),
@@ -775,8 +775,8 @@ impl Grippable for Dimension {
} }
} }
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
let (_dim_line_grip, text_grip) = match self { let (_dim_line_grip, text_grip) = match self {
Dimension::Linear(_) | Dimension::Aligned(_) => (2, 3), Dimension::Linear(_) | Dimension::Aligned(_) => (2, 3),
Dimension::Radius(_) | Dimension::Diameter(_) => (1, 2), Dimension::Radius(_) | Dimension::Diameter(_) => (1, 2),
@@ -827,18 +827,18 @@ impl Grippable for Dimension {
// definition. Shared dim machinery (`ArrowKind`, `DimGeom`, `append_arrow`, // definition. Shared dim machinery (`ArrowKind`, `DimGeom`, `append_arrow`,
// arrow blocks, colour resolution, `add_segment` / `add_polyline`, // arrow blocks, colour resolution, `add_segment` / `add_polyline`,
// `normalized_or`, `entity_z`, `offset_snap_pts`) lives in // `normalized_or`, `entity_z`, `offset_snap_pts`) lives in
// `scene::tessellate` and is reused by Leader / MultiLeader too. // `scene::convert::tessellate` and is reused by Leader / MultiLeader too.
use acadrust::entities::{MText, Text}; use acadrust::entities::{MText, Text};
use acadrust::tables::DimStyle; use acadrust::tables::DimStyle;
use acadrust::types::{Color as AcadColor, Vector3}; use acadrust::types::{Color as AcadColor, Vector3};
use acadrust::{CadDocument, EntityType, Handle}; use acadrust::{CadDocument, EntityType, Handle};
use crate::scene::tess_util::aci_to_rgba; use crate::scene::convert::tess_util::aci_to_rgba;
use crate::scene::tessellate::{ use crate::scene::convert::tessellate::{
add_polyline, add_segment, append_arrow, arrow_from_block, normalized_or, ArrowKind, DimGeom, add_polyline, add_segment, append_arrow, arrow_from_block, normalized_or, ArrowKind, DimGeom,
}; };
use crate::scene::wire_model::{SnapHint, WireModel}; use crate::scene::model::wire_model::{SnapHint, WireModel};
pub trait DimensionTess { pub trait DimensionTess {
fn tessellate( fn tessellate(
@@ -1338,7 +1338,7 @@ fn resolve_pattern_by_handle(
.find(|lt| lt.handle == handle) .find(|lt| lt.handle == handle)
.map(|lt| lt.name.clone()); .map(|lt| lt.name.clone());
match name { match name {
Some(n) => crate::scene::render::resolve_pattern(&doc.line_types, &n, scale), Some(n) => crate::scene::view::render::resolve_pattern(&doc.line_types, &n, scale),
None => (0.0, [0.0; 8]), None => (0.0, [0.0; 8]),
} }
} }
+6 -6
View File
@@ -5,9 +5,9 @@ use truck_modeling::{builder, BSplineCurve, Curve, Edge, KnotVec, Point3, Wire};
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip}; use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible; use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
const TAU: f64 = std::f64::consts::TAU; const TAU: f64 = std::f64::consts::TAU;
@@ -218,14 +218,14 @@ fn apply_grip(ell: &mut Ellipse, grip_id: usize, apply: GripApply) {
} }
fn apply_transform(ell: &mut Ellipse, t: &EntityTransform) { fn apply_transform(ell: &mut Ellipse, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(ell, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(ell, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x, &mut entity.center.x,
&mut entity.center.y, &mut entity.center.y,
p1, p1,
p2, p2,
); );
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.major_axis.x, &mut entity.major_axis.x,
&mut entity.major_axis.y, &mut entity.major_axis.y,
p1, p1,
+13 -13
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, parse_f64, ro_prop as ro}; use crate::entities::common::{center_grip, edit_prop as edit, parse_f64, ro_prop as ro};
use crate::entities::traits::{FallbackTess, Grippable, PropertyEditable, Transformable}; use crate::entities::traits::{FallbackTess, Grippable, PropertyEditable, Transformable};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property}; use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::tess_util::{arc_segments, arc_signed_span, wire_chord_tol, FallbackGeometry}; use crate::scene::convert::tess_util::{arc_segments, arc_signed_span, wire_chord_tol, FallbackGeometry};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
fn properties(h: &Hatch) -> PropSection { fn properties(h: &Hatch) -> PropSection {
let pattern_type = match h.pattern_type { let pattern_type = match h.pattern_type {
@@ -89,7 +89,7 @@ fn apply_geom_prop(h: &mut Hatch, field: &str, value: &str) {
} }
fn apply_transform(h: &mut Hatch, t: &EntityTransform) { fn apply_transform(h: &mut Hatch, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(h, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(h, t, |entity, p1, p2| {
// Delegate the mirror to acadrust's transform_hatch (via the Entity // Delegate the mirror to acadrust's transform_hatch (via the Entity
// trait): it flips the boundary-arc direction flags, re-mirrors the // trait): it flips the boundary-arc direction flags, re-mirrors the
// stored angles and preserves the stored sweep — including the // stored angles and preserves the stored sweep — including the
@@ -97,7 +97,7 @@ fn apply_transform(h: &mut Hatch, t: &EntityTransform) {
// hand-rolled angle-swap here was only valid for ccw boundary arcs on // hand-rolled angle-swap here was only valid for ccw boundary arcs on
// an axis-aligned mirror line and went stale the moment those // an axis-aligned mirror line and went stale the moment those
// conventions were fixed upstream. // conventions were fixed upstream.
let t = crate::scene::transform::reflection_about_xy_line(p1, p2); let t = crate::scene::view::transform::reflection_about_xy_line(p1, p2);
acadrust::entities::Entity::apply_transform(entity, &t); acadrust::entities::Entity::apply_transform(entity, &t);
}); });
} }
@@ -282,8 +282,8 @@ impl Grippable for Hatch {
} }
} }
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![ vec![
GripMenuItem { GripMenuItem {
label: "Stretch", label: "Stretch",
@@ -304,7 +304,7 @@ impl Grippable for Hatch {
] ]
} }
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Origin / Angle / Scale need a follow-up value — handled by // Origin / Angle / Scale need a follow-up value — handled by
// `apply_grip_menu_value`. // `apply_grip_menu_value`.
} }
@@ -312,9 +312,9 @@ impl Grippable for Hatch {
fn grip_menu_value_prompt( fn grip_menu_value_prompt(
&self, &self,
_grip_id: usize, _grip_id: usize,
action: crate::scene::object::GripMenuAction, action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> { ) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
match action { match action {
A::HatchAngle => Some("Angle (deg)"), A::HatchAngle => Some("Angle (deg)"),
A::HatchScale => Some("Scale"), A::HatchScale => Some("Scale"),
@@ -325,10 +325,10 @@ impl Grippable for Hatch {
fn apply_grip_menu_value( fn apply_grip_menu_value(
&mut self, &mut self,
_grip_id: usize, _grip_id: usize,
action: crate::scene::object::GripMenuAction, action: crate::scene::model::object::GripMenuAction,
value: f64, value: f64,
) { ) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
match action { match action {
A::HatchAngle => { A::HatchAngle => {
self.pattern_angle = value.to_radians(); self.pattern_angle = value.to_radians();
@@ -350,7 +350,7 @@ impl FallbackTess for Hatch {
// Convert a 2D OCS hatch boundary point to WCS, then subtract world_offset. // Convert a 2D OCS hatch boundary point to WCS, then subtract world_offset.
let to_wcs = |x: f64, y: f64| -> [f32; 3] { let to_wcs = |x: f64, y: f64| -> [f32; 3] {
let (wx, wy, wz) = let (wx, wy, wz) =
crate::scene::transform::ocs_point_to_wcs((x, y, self.elevation), normal); crate::scene::view::transform::ocs_point_to_wcs((x, y, self.elevation), normal);
[(wx - ox) as f32, (wy - oy) as f32, (wz - oz) as f32] [(wx - ox) as f32, (wy - oy) as f32, (wz - oz) as f32]
}; };
let mut pts: Vec<[f32; 3]> = Vec::new(); let mut pts: Vec<[f32; 3]> = Vec::new();
+8 -6
View File
@@ -6,9 +6,11 @@ use glam::Vec3;
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, parse_f64, ro_prop as ro, square_grip}; use crate::entities::common::{edit_prop as edit, parse_f64, ro_prop as ro, square_grip};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use crate::scene::{block_cache, render, tessellate}; use crate::scene::cache::block_cache;
use crate::scene::convert::tessellate;
use crate::scene::view::render;
fn grips(ins: &Insert) -> Vec<GripDef> { fn grips(ins: &Insert) -> Vec<GripDef> {
let p = glam::DVec3::new(ins.insert_point.x, ins.insert_point.y, ins.insert_point.z); let p = glam::DVec3::new(ins.insert_point.x, ins.insert_point.y, ins.insert_point.z);
@@ -63,7 +65,7 @@ fn apply_grip(ins: &mut Insert, _grip_id: usize, apply: GripApply) {
} }
fn apply_transform(ins: &mut Insert, t: &EntityTransform) { fn apply_transform(ins: &mut Insert, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(ins, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(ins, t, |entity, p1, p2| {
let dx = (p2.x - p1.x) as f64; let dx = (p2.x - p1.x) as f64;
let dy = (p2.y - p1.y) as f64; let dy = (p2.y - p1.y) as f64;
let len = (dx * dx + dy * dy).sqrt(); let len = (dx * dx + dy * dy).sqrt();
@@ -98,7 +100,7 @@ impl crate::entities::traits::FallbackTess for Insert {
fn fallback_geometry( fn fallback_geometry(
&self, &self,
world_offset: [f64; 3], world_offset: [f64; 3],
) -> crate::scene::tess_util::FallbackGeometry { ) -> crate::scene::convert::tess_util::FallbackGeometry {
let [ox, oy, oz] = world_offset; let [ox, oy, oz] = world_offset;
let ip = Vec3::new( let ip = Vec3::new(
(self.insert_point.x - ox) as f32, (self.insert_point.x - ox) as f32,
@@ -114,7 +116,7 @@ impl crate::entities::traits::FallbackTess for Insert {
]; ];
( (
pts, pts,
vec![(ip, crate::scene::wire_model::SnapHint::Insertion)], vec![(ip, crate::scene::model::wire_model::SnapHint::Insertion)],
vec![], vec![],
vec![], vec![],
) )
+16 -16
View File
@@ -5,9 +5,9 @@ use glam::Vec3;
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip}; use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible; use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property}; use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::TangentGeom; use crate::scene::model::wire_model::TangentGeom;
// ── TruckConvertible (used for snap/grip key-vertices) ───────────────────── // ── TruckConvertible (used for snap/grip key-vertices) ─────────────────────
@@ -428,17 +428,17 @@ fn apply_geom_prop(leader: &mut Leader, field: &str, value: &str) {
// ── Transform ────────────────────────────────────────────────────────────── // ── Transform ──────────────────────────────────────────────────────────────
fn apply_transform(leader: &mut Leader, t: &EntityTransform) { fn apply_transform(leader: &mut Leader, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(leader, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(leader, t, |entity, p1, p2| {
for v in &mut entity.vertices { for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2); crate::scene::view::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2);
} }
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.block_offset.x, &mut entity.block_offset.x,
&mut entity.block_offset.y, &mut entity.block_offset.y,
p1, p1,
p2, p2,
); );
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.annotation_offset.x, &mut entity.annotation_offset.x,
&mut entity.annotation_offset.y, &mut entity.annotation_offset.y,
p1, p1,
@@ -465,8 +465,8 @@ impl crate::entities::traits::Grippable for Leader {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) { fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply); apply_grip(self, grip_id, apply);
} }
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let n = self.vertices.len(); let n = self.vertices.len();
if grip_id == 0 { if grip_id == 0 {
// Arrow head — stretch only. // Arrow head — stretch only.
@@ -497,8 +497,8 @@ impl crate::entities::traits::Grippable for Leader {
}] }]
} }
} }
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len(); let n = self.vertices.len();
match action { match action {
A::AddVertex if grip_id < n => { A::AddVertex if grip_id < n => {
@@ -540,7 +540,7 @@ impl crate::entities::traits::Transformable for Leader {
/// Per-entity tessellation entry for `Leader`. Lives here so all leader /// Per-entity tessellation entry for `Leader`. Lives here so all leader
/// tess code stays alongside the entity definition. Cross-entity dim /// tess code stays alongside the entity definition. Cross-entity dim
/// machinery (arrow shapes, `DimGeom`) lives in `scene::tessellate` and /// machinery (arrow shapes, `DimGeom`) lives in `scene::convert::tessellate` and
/// is reused via the dim arrow emitter so the leader matches the active /// is reused via the dim arrow emitter so the leader matches the active
/// DIMSTYLE. /// DIMSTYLE.
pub trait LeaderTess { pub trait LeaderTess {
@@ -553,7 +553,7 @@ pub trait LeaderTess {
line_weight_px: f32, line_weight_px: f32,
world_offset: [f64; 3], world_offset: [f64; 3],
anno_scale: f32, anno_scale: f32,
) -> crate::scene::wire_model::WireModel; ) -> crate::scene::model::wire_model::WireModel;
} }
impl LeaderTess for Leader { impl LeaderTess for Leader {
@@ -566,9 +566,9 @@ impl LeaderTess for Leader {
line_weight_px: f32, line_weight_px: f32,
world_offset: [f64; 3], world_offset: [f64; 3],
anno_scale: f32, anno_scale: f32,
) -> crate::scene::wire_model::WireModel { ) -> crate::scene::model::wire_model::WireModel {
use crate::scene::tessellate::{append_arrow, arrow_from_block, ArrowKind, DimGeom}; use crate::scene::convert::tessellate::{append_arrow, arrow_from_block, ArrowKind, DimGeom};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
let color = if selected { let color = if selected {
WireModel::SELECTED WireModel::SELECTED
} else { } else {
+15 -15
View File
@@ -6,18 +6,18 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip, center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
}; };
use crate::entities::traits::TruckConvertible; use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::TangentGeom; use crate::scene::model::wire_model::TangentGeom;
fn to_truck(line: &Line) -> TruckEntity { fn to_truck(line: &Line) -> TruckEntity {
let normal = (line.normal.x, line.normal.y, line.normal.z); let normal = (line.normal.x, line.normal.y, line.normal.z);
let (sx, sy, sz) = crate::scene::transform::ocs_point_to_wcs( let (sx, sy, sz) = crate::scene::view::transform::ocs_point_to_wcs(
(line.start.x, line.start.y, line.start.z), (line.start.x, line.start.y, line.start.z),
normal, normal,
); );
let (ex, ey, ez) = let (ex, ey, ez) =
crate::scene::transform::ocs_point_to_wcs((line.end.x, line.end.y, line.end.z), normal); crate::scene::view::transform::ocs_point_to_wcs((line.end.x, line.end.y, line.end.z), normal);
let p0 = Point3::new(sx, sy, sz); let p0 = Point3::new(sx, sy, sz);
let p1 = Point3::new(ex, ey, ez); let p1 = Point3::new(ex, ey, ez);
let kv: Vec<[f64; 3]> = vec![[p0.x, p0.y, p0.z], [p1.x, p1.y, p1.z]]; let kv: Vec<[f64; 3]> = vec![[p0.x, p0.y, p0.z], [p1.x, p1.y, p1.z]];
@@ -134,13 +134,13 @@ fn apply_transform(line: &mut Line, t: &EntityTransform) {
)); ));
} }
EntityTransform::Rotate { center, angle_rad } => { EntityTransform::Rotate { center, angle_rad } => {
crate::scene::transform::apply_standard_transform(line, *center, *angle_rad); crate::scene::view::transform::apply_standard_transform(line, *center, *angle_rad);
} }
EntityTransform::Scale { center, factor } => { EntityTransform::Scale { center, factor } => {
crate::scene::transform::apply_standard_scale(line, *center, *factor); crate::scene::view::transform::apply_standard_scale(line, *center, *factor);
} }
EntityTransform::Mirror { p1, p2 } => { EntityTransform::Mirror { p1, p2 } => {
crate::scene::transform::mirror_xy_line(line, *p1, *p2); crate::scene::view::transform::mirror_xy_line(line, *p1, *p2);
} }
} }
} }
@@ -158,8 +158,8 @@ impl crate::entities::traits::Grippable for Line {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) { fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply); apply_grip(self, grip_id, apply);
} }
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
if grip_id == 2 { if grip_id == 2 {
vec![GripMenuItem { vec![GripMenuItem {
label: "Stretch", label: "Stretch",
@@ -178,7 +178,7 @@ impl crate::entities::traits::Grippable for Line {
] ]
} }
} }
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Lengthen needs a follow-up distance — handled by // Lengthen needs a follow-up distance — handled by
// `apply_grip_menu_value`. // `apply_grip_menu_value`.
} }
@@ -186,9 +186,9 @@ impl crate::entities::traits::Grippable for Line {
fn grip_menu_value_prompt( fn grip_menu_value_prompt(
&self, &self,
_grip_id: usize, _grip_id: usize,
action: crate::scene::object::GripMenuAction, action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> { ) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
match action { match action {
A::Lengthen => Some("Distance"), A::Lengthen => Some("Distance"),
_ => None, _ => None,
@@ -198,10 +198,10 @@ impl crate::entities::traits::Grippable for Line {
fn apply_grip_menu_value( fn apply_grip_menu_value(
&mut self, &mut self,
grip_id: usize, grip_id: usize,
action: crate::scene::object::GripMenuAction, action: crate::scene::model::object::GripMenuAction,
value: f64, value: f64,
) { ) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
if !matches!(action, A::Lengthen) { if !matches!(action, A::Lengthen) {
return; return;
} }
+13 -13
View File
@@ -6,9 +6,9 @@ use crate::entities::common::{
edit_prop as edit, parse_f64, rectangle_grip, ro_prop as ro, square_grip, edit_prop as edit, parse_f64, rectangle_grip, ro_prop as ro, square_grip,
}; };
use crate::entities::traits::TruckConvertible; use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::TangentGeom; use crate::scene::model::wire_model::TangentGeom;
const TAU: f64 = std::f64::consts::TAU; const TAU: f64 = std::f64::consts::TAU;
@@ -120,7 +120,7 @@ fn to_truck(pline: &LwPolyline) -> TruckEntity {
// Convert OCS (x, y, elevation) to WCS Point3. // Convert OCS (x, y, elevation) to WCS Point3.
let to_wcs = |x: f64, y: f64| -> (f64, f64, f64) { let to_wcs = |x: f64, y: f64| -> (f64, f64, f64) {
crate::scene::transform::ocs_point_to_wcs((x, y, elev), normal) crate::scene::view::transform::ocs_point_to_wcs((x, y, elev), normal)
}; };
let to_pt = |v: &LwVertex| -> Point3 { let to_pt = |v: &LwVertex| -> Point3 {
let (wx, wy, wz) = to_wcs(v.location.x, v.location.y); let (wx, wy, wz) = to_wcs(v.location.x, v.location.y);
@@ -418,9 +418,9 @@ fn apply_grip(pline: &mut LwPolyline, grip_id: usize, apply: GripApply) {
} }
fn apply_transform(pline: &mut LwPolyline, t: &EntityTransform) { fn apply_transform(pline: &mut LwPolyline, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(pline, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(pline, t, |entity, p1, p2| {
for v in &mut entity.vertices { for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(&mut v.location.x, &mut v.location.y, p1, p2); crate::scene::view::transform::reflect_xy_point(&mut v.location.x, &mut v.location.y, p1, p2);
// Bulge encodes which side the arc bows to; a reflection // Bulge encodes which side the arc bows to; a reflection
// reverses it or every curved segment flips to the wrong side. // reverses it or every curved segment flips to the wrong side.
v.bulge = -v.bulge; v.bulge = -v.bulge;
@@ -435,14 +435,14 @@ impl TruckConvertible for LwPolyline {
} }
impl crate::entities::traits::Grippable for LwPolyline { impl crate::entities::traits::Grippable for LwPolyline {
fn grips(&self) -> Vec<crate::scene::object::GripDef> { fn grips(&self) -> Vec<crate::scene::model::object::GripDef> {
grips(self) grips(self)
} }
fn apply_grip(&mut self, grip_id: usize, apply: crate::scene::object::GripApply) { fn apply_grip(&mut self, grip_id: usize, apply: crate::scene::model::object::GripApply) {
apply_grip(self, grip_id, apply); apply_grip(self, grip_id, apply);
} }
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let n = self.vertices.len(); let n = self.vertices.len();
if grip_id < n { if grip_id < n {
// Vertex grip. // Vertex grip.
@@ -490,8 +490,8 @@ impl crate::entities::traits::Grippable for LwPolyline {
convert, convert,
] ]
} }
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len(); let n = self.vertices.len();
match action { match action {
A::Stretch => {} A::Stretch => {}
@@ -546,7 +546,7 @@ impl crate::entities::traits::PropertyEditable for LwPolyline {
fn geometry_properties( fn geometry_properties(
&self, &self,
_text_style_names: &[String], _text_style_names: &[String],
) -> crate::scene::object::PropSection { ) -> crate::scene::model::object::PropSection {
properties(self) properties(self)
} }
fn apply_geom_prop(&mut self, field: &str, value: &str) { fn apply_geom_prop(&mut self, field: &str, value: &str) {
+11 -11
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{ro_prop as ro, square_grip}; use crate::entities::common::{ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
// ── Face3D ──────────────────────────────────────────────────────────────────── // ── Face3D ────────────────────────────────────────────────────────────────────
@@ -160,14 +160,14 @@ impl PropertyEditable for Face3D {
impl Transformable for Face3D { impl Transformable for Face3D {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for corner in [ for corner in [
&mut entity.first_corner, &mut entity.first_corner,
&mut entity.second_corner, &mut entity.second_corner,
&mut entity.third_corner, &mut entity.third_corner,
&mut entity.fourth_corner, &mut entity.fourth_corner,
] { ] {
crate::scene::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2); crate::scene::view::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2);
} }
}); });
} }
@@ -322,9 +322,9 @@ impl PropertyEditable for PolygonMesh {
impl Transformable for PolygonMesh { impl Transformable for PolygonMesh {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices { for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut v.location.x, &mut v.location.x,
&mut v.location.y, &mut v.location.y,
p1, p1,
@@ -472,9 +472,9 @@ impl PropertyEditable for PolyfaceMesh {
impl Transformable for PolyfaceMesh { impl Transformable for PolyfaceMesh {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices { for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut v.location.x, &mut v.location.x,
&mut v.location.y, &mut v.location.y,
p1, p1,
@@ -631,9 +631,9 @@ impl PropertyEditable for Mesh {
impl Transformable for Mesh { impl Transformable for Mesh {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices { for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2); crate::scene::view::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2);
} }
}); });
} }
+10 -10
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip}; use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property}; use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
impl TruckConvertible for MLine { impl TruckConvertible for MLine {
fn to_truck(&self, _document: &acadrust::CadDocument) -> Option<TruckEntity> { fn to_truck(&self, _document: &acadrust::CadDocument) -> Option<TruckEntity> {
@@ -149,8 +149,8 @@ impl Grippable for MLine {
} }
} }
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![ vec![
GripMenuItem { GripMenuItem {
label: "Stretch", label: "Stretch",
@@ -167,8 +167,8 @@ impl Grippable for MLine {
] ]
} }
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len(); let n = self.vertices.len();
match action { match action {
A::AddVertex if grip_id < n => { A::AddVertex if grip_id < n => {
@@ -274,16 +274,16 @@ impl PropertyEditable for MLine {
impl Transformable for MLine { impl Transformable for MLine {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices { for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut v.position.x, &mut v.position.x,
&mut v.position.y, &mut v.position.y,
p1, p1,
p2, p2,
); );
} }
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.start_point.x, &mut entity.start_point.x,
&mut entity.start_point.y, &mut entity.start_point.y,
p1, p1,
+12 -12
View File
@@ -7,9 +7,9 @@ use crate::entities::text_support::{
layout_mtext, resolve_text_style, GlyphBox, MTextRenderOpts, MTextVAnchor, layout_mtext, resolve_text_style, GlyphBox, MTextRenderOpts, MTextVAnchor,
}; };
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property}; use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
fn attachment_str(a: &AttachmentPoint) -> &'static str { fn attachment_str(a: &AttachmentPoint) -> &'static str {
match a { match a {
@@ -327,8 +327,8 @@ fn apply_grip(t: &mut MText, grip_id: usize, apply: GripApply) {
} }
fn apply_transform(t: &mut MText, tr: &EntityTransform) { fn apply_transform(t: &mut MText, tr: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x, &mut entity.insertion_point.x,
&mut entity.insertion_point.y, &mut entity.insertion_point.y,
p1, p1,
@@ -356,8 +356,8 @@ impl Grippable for MText {
apply_grip(self, grip_id, apply); apply_grip(self, grip_id, apply);
} }
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
if grip_id == 0 { if grip_id == 0 {
// Insertion point // Insertion point
vec![ vec![
@@ -383,7 +383,7 @@ impl Grippable for MText {
} }
} }
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Rotate needs a follow-up angle handled by // Rotate needs a follow-up angle handled by
// `apply_grip_menu_value`; Move-with-Text is the default drag. // `apply_grip_menu_value`; Move-with-Text is the default drag.
} }
@@ -391,9 +391,9 @@ impl Grippable for MText {
fn grip_menu_value_prompt( fn grip_menu_value_prompt(
&self, &self,
_grip_id: usize, _grip_id: usize,
action: crate::scene::object::GripMenuAction, action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> { ) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
match action { match action {
A::RotateText => Some("Rotation (deg)"), A::RotateText => Some("Rotation (deg)"),
_ => None, _ => None,
@@ -403,10 +403,10 @@ impl Grippable for MText {
fn apply_grip_menu_value( fn apply_grip_menu_value(
&mut self, &mut self,
_grip_id: usize, _grip_id: usize,
action: crate::scene::object::GripMenuAction, action: crate::scene::model::object::GripMenuAction,
value: f64, value: f64,
) { ) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
if matches!(action, A::RotateText) { if matches!(action, A::RotateText) {
self.rotation = value.to_radians(); self.rotation = value.to_radians();
} }
+21 -21
View File
@@ -31,9 +31,9 @@ use crate::entities::common::{
center_grip, edit_prop as edit, ro_prop as ro, square_grip, triangle_grip, center_grip, edit_prop as edit, ro_prop as ro, square_grip, triangle_grip,
}; };
use crate::entities::traits::TruckConvertible; use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property}; use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::{SnapHint, TangentGeom}; use crate::scene::model::wire_model::{SnapHint, TangentGeom};
// ── TruckConvertible ──────────────────────────────────────────────────────── // ── TruckConvertible ────────────────────────────────────────────────────────
@@ -840,7 +840,7 @@ fn parse_attachment(s: &str) -> TextAttachmentType {
// ── Transform ────────────────────────────────────────────────────────────── // ── Transform ──────────────────────────────────────────────────────────────
fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) { fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(ml, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(ml, t, |entity, p1, p2| {
// Reflect every point on the leader (line points, connection points, // Reflect every point on the leader (line points, connection points,
// break-point endpoints) AND every direction vector that drives the // break-point endpoints) AND every direction vector that drives the
// text orientation. Without the direction reflection text would keep // text orientation. Without the direction reflection text would keep
@@ -848,16 +848,16 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
for root in &mut entity.context.leader_roots { for root in &mut entity.context.leader_roots {
for line in &mut root.lines { for line in &mut root.lines {
for p in &mut line.points { for p in &mut line.points {
crate::scene::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2); crate::scene::view::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2);
} }
for bp in &mut line.break_points { for bp in &mut line.break_points {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut bp.start_point.x, &mut bp.start_point.x,
&mut bp.start_point.y, &mut bp.start_point.y,
p1, p1,
p2, p2,
); );
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut bp.end_point.x, &mut bp.end_point.x,
&mut bp.end_point.y, &mut bp.end_point.y,
p1, p1,
@@ -865,7 +865,7 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
); );
} }
} }
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut root.connection_point.x, &mut root.connection_point.x,
&mut root.connection_point.y, &mut root.connection_point.y,
p1, p1,
@@ -873,13 +873,13 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
); );
reflect_xy_direction(&mut root.direction.x, &mut root.direction.y, p1, p2); reflect_xy_direction(&mut root.direction.x, &mut root.direction.y, p1, p2);
for bp in &mut root.break_points { for bp in &mut root.break_points {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut bp.start_point.x, &mut bp.start_point.x,
&mut bp.start_point.y, &mut bp.start_point.y,
p1, p1,
p2, p2,
); );
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut bp.end_point.x, &mut bp.end_point.x,
&mut bp.end_point.y, &mut bp.end_point.y,
p1, p1,
@@ -887,7 +887,7 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
); );
} }
} }
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.context.text_location.x, &mut entity.context.text_location.x,
&mut entity.context.text_location.y, &mut entity.context.text_location.y,
p1, p1,
@@ -916,7 +916,7 @@ fn reflect_xy_direction(dx: &mut f64, dy: &mut f64, p1: Vec3, p2: Vec3) {
let p2_rel = Vec3::new(p2.x - p1.x, p2.y - p1.y, 0.0); let p2_rel = Vec3::new(p2.x - p1.x, p2.y - p1.y, 0.0);
let mut tip_x = *dx; let mut tip_x = *dx;
let mut tip_y = *dy; let mut tip_y = *dy;
crate::scene::transform::reflect_xy_point(&mut tip_x, &mut tip_y, zero, p2_rel); crate::scene::view::transform::reflect_xy_point(&mut tip_x, &mut tip_y, zero, p2_rel);
*dx = tip_x; *dx = tip_x;
*dy = tip_y; *dy = tip_y;
} }
@@ -936,8 +936,8 @@ impl crate::entities::traits::Grippable for MultiLeader {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) { fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply); apply_grip(self, grip_id, apply);
} }
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let n_vertices: usize = self let n_vertices: usize = self
.context .context
.leader_roots .leader_roots
@@ -984,8 +984,8 @@ impl crate::entities::traits::Grippable for MultiLeader {
] ]
} }
} }
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
// Locate the (root, line) and vertex position owning this grip id. // Locate the (root, line) and vertex position owning this grip id.
let mut idx = 0usize; let mut idx = 0usize;
let mut loc: Option<(usize, usize, acadrust::types::Vector3)> = None; let mut loc: Option<(usize, usize, acadrust::types::Vector3)> = None;
@@ -1063,7 +1063,7 @@ pub trait MultiLeaderTess {
world_offset: [f64; 3], world_offset: [f64; 3],
anno_scale: f32, anno_scale: f32,
world_per_pixel: Option<f32>, world_per_pixel: Option<f32>,
) -> Vec<crate::scene::wire_model::WireModel>; ) -> Vec<crate::scene::model::wire_model::WireModel>;
} }
impl MultiLeaderTess for MultiLeader { impl MultiLeaderTess for MultiLeader {
@@ -1077,11 +1077,11 @@ impl MultiLeaderTess for MultiLeader {
world_offset: [f64; 3], world_offset: [f64; 3],
anno_scale: f32, anno_scale: f32,
world_per_pixel: Option<f32>, world_per_pixel: Option<f32>,
) -> Vec<crate::scene::wire_model::WireModel> { ) -> Vec<crate::scene::model::wire_model::WireModel> {
use crate::scene::tessellate::{ use crate::scene::convert::tessellate::{
append_arrow, arrow_from_block, color_or_inherit, tessellate, ArrowKind, DimGeom, append_arrow, arrow_from_block, color_or_inherit, tessellate, ArrowKind, DimGeom,
}; };
use crate::scene::wire_model::{SnapHint, TangentGeom, WireModel}; use crate::scene::model::wire_model::{SnapHint, TangentGeom, WireModel};
use glam::Vec3; use glam::Vec3;
let ml = self; let ml = self;
// line_color falls back to the entity colour when the MultiLeader's own // line_color falls back to the entity colour when the MultiLeader's own
@@ -1110,7 +1110,7 @@ impl MultiLeaderTess for MultiLeader {
.map(|lt| lt.name.clone()); .map(|lt| lt.name.clone());
match name { match name {
Some(n) => { Some(n) => {
crate::scene::render::resolve_pattern(&document.line_types, &n, lt_scale) crate::scene::view::render::resolve_pattern(&document.line_types, &n, lt_scale)
} }
None => (0.0, [0.0; 8]), None => (0.0, [0.0; 8]),
} }
+4 -4
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip}; use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible; use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
fn to_truck(ole: &Ole2Frame) -> TruckEntity { fn to_truck(ole: &Ole2Frame) -> TruckEntity {
let x0 = ole.upper_left_corner.x; let x0 = ole.upper_left_corner.x;
@@ -184,7 +184,7 @@ impl crate::entities::traits::FallbackTess for Ole2Frame {
fn fallback_geometry( fn fallback_geometry(
&self, &self,
world_offset: [f64; 3], world_offset: [f64; 3],
) -> crate::scene::tess_util::FallbackGeometry { ) -> crate::scene::convert::tess_util::FallbackGeometry {
// OLE objects carry a bounding rectangle in model space. // OLE objects carry a bounding rectangle in model space.
// Render a simple X-through-rectangle placeholder. // Render a simple X-through-rectangle placeholder.
let [ox, oy, oz] = world_offset; let [ox, oy, oz] = world_offset;
+6 -6
View File
@@ -5,9 +5,9 @@ use truck_modeling::{builder, Point3};
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, parse_f64, square_grip}; use crate::entities::common::{edit_prop as edit, parse_f64, square_grip};
use crate::entities::traits::TruckConvertible; use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
/// Resolve PDSIZE (negative = % of viewport, 0 = 5% default, positive = world). /// Resolve PDSIZE (negative = % of viewport, 0 = 5% default, positive = world).
/// We don't know the viewport height at tessellation time, so percentages and /// We don't know the viewport height at tessellation time, so percentages and
@@ -93,7 +93,7 @@ fn point_glyph(cx: f64, cy: f64, z: f64, pdmode: i16, pdsize: f64) -> Vec<[f64;
fn to_truck(pt: &Point, document: &acadrust::CadDocument) -> TruckEntity { fn to_truck(pt: &Point, document: &acadrust::CadDocument) -> TruckEntity {
let normal = (pt.normal.x, pt.normal.y, pt.normal.z); let normal = (pt.normal.x, pt.normal.y, pt.normal.z);
let (wx, wy, wz) = crate::scene::transform::ocs_point_to_wcs( let (wx, wy, wz) = crate::scene::view::transform::ocs_point_to_wcs(
(pt.location.x, pt.location.y, pt.location.z), (pt.location.x, pt.location.y, pt.location.z),
normal, normal,
); );
@@ -175,8 +175,8 @@ fn apply_grip(pt: &mut Point, _grip_id: usize, apply: GripApply) {
} }
fn apply_transform(pt: &mut Point, t: &EntityTransform) { fn apply_transform(pt: &mut Point, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(pt, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(pt, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.location.x, &mut entity.location.x,
&mut entity.location.y, &mut entity.location.y,
p1, p1,
+22 -22
View File
@@ -4,9 +4,9 @@ use truck_modeling::{builder, Edge, Point3, Wire};
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip}; use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property}; use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::TangentGeom; use crate::scene::model::wire_model::TangentGeom;
// ── Polyline (old-style 3D heavy polyline) ──────────────────────────────────── // ── Polyline (old-style 3D heavy polyline) ────────────────────────────────────
@@ -69,8 +69,8 @@ impl Grippable for Polyline {
} }
} }
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![ vec![
GripMenuItem { GripMenuItem {
label: "Stretch", label: "Stretch",
@@ -87,8 +87,8 @@ impl Grippable for Polyline {
] ]
} }
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len(); let n = self.vertices.len();
match action { match action {
A::AddVertex if grip_id < n => { A::AddVertex if grip_id < n => {
@@ -148,9 +148,9 @@ impl PropertyEditable for Polyline {
impl Transformable for Polyline { impl Transformable for Polyline {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices { for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut v.location.x, &mut v.location.x,
&mut v.location.y, &mut v.location.y,
p1, p1,
@@ -184,7 +184,7 @@ fn tessellate_polyline2d(pl: &Polyline2D) -> TruckEntity {
let mut key_verts: Vec<[f64; 3]> = Vec::new(); let mut key_verts: Vec<[f64; 3]> = Vec::new();
let to_wcs = |x: f64, y: f64| -> (f64, f64, f64) { let to_wcs = |x: f64, y: f64| -> (f64, f64, f64) {
crate::scene::transform::ocs_point_to_wcs((x, y, elev), normal) crate::scene::view::transform::ocs_point_to_wcs((x, y, elev), normal)
}; };
let to_pt = |v: &acadrust::entities::Vertex2D| -> Point3 { let to_pt = |v: &acadrust::entities::Vertex2D| -> Point3 {
let (wx, wy, wz) = to_wcs(v.location.x, v.location.y); let (wx, wy, wz) = to_wcs(v.location.x, v.location.y);
@@ -338,8 +338,8 @@ impl Grippable for Polyline2D {
} }
} }
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![ vec![
GripMenuItem { GripMenuItem {
label: "Stretch", label: "Stretch",
@@ -356,8 +356,8 @@ impl Grippable for Polyline2D {
] ]
} }
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len(); let n = self.vertices.len();
let elev = self.elevation; let elev = self.elevation;
match action { match action {
@@ -467,9 +467,9 @@ impl PropertyEditable for Polyline2D {
impl Transformable for Polyline2D { impl Transformable for Polyline2D {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices { for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut v.location.x, &mut v.location.x,
&mut v.location.y, &mut v.location.y,
p1, p1,
@@ -556,8 +556,8 @@ impl Grippable for Polyline3D {
} }
} }
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![ vec![
GripMenuItem { GripMenuItem {
label: "Stretch", label: "Stretch",
@@ -574,8 +574,8 @@ impl Grippable for Polyline3D {
] ]
} }
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len(); let n = self.vertices.len();
match action { match action {
A::AddVertex if grip_id < n => { A::AddVertex if grip_id < n => {
@@ -669,9 +669,9 @@ impl PropertyEditable for Polyline3D {
impl Transformable for Polyline3D { impl Transformable for Polyline3D {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices { for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut v.position.x, &mut v.position.x,
&mut v.position.y, &mut v.position.y,
p1, p1,
+6 -6
View File
@@ -3,8 +3,8 @@ use acadrust::entities::{RasterImage, Wipeout};
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip}; use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property}; use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
// ── Shared geometry helpers ─────────────────────────────────────────────────── // ── Shared geometry helpers ───────────────────────────────────────────────────
@@ -235,8 +235,8 @@ impl PropertyEditable for RasterImage {
impl Transformable for RasterImage { impl Transformable for RasterImage {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x, &mut entity.insertion_point.x,
&mut entity.insertion_point.y, &mut entity.insertion_point.y,
p1, p1,
@@ -496,8 +496,8 @@ impl PropertyEditable for Wipeout {
impl Transformable for Wipeout { impl Transformable for Wipeout {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x, &mut entity.insertion_point.x,
&mut entity.insertion_point.y, &mut entity.insertion_point.y,
p1, p1,
+6 -6
View File
@@ -3,8 +3,8 @@ use acadrust::entities::{Ray, XLine};
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, square_grip}; use crate::entities::common::{center_grip, edit_prop as edit, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
/// Display length used when rendering semi-infinite / infinite lines. /// Display length used when rendering semi-infinite / infinite lines.
const DISPLAY_EXTENT: f64 = 1_000_000.0; const DISPLAY_EXTENT: f64 = 1_000_000.0;
@@ -126,8 +126,8 @@ impl PropertyEditable for Ray {
impl Transformable for Ray { impl Transformable for Ray {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.base_point.x, &mut entity.base_point.x,
&mut entity.base_point.y, &mut entity.base_point.y,
p1, p1,
@@ -263,8 +263,8 @@ impl PropertyEditable for XLine {
impl Transformable for XLine { impl Transformable for XLine {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.base_point.x, &mut entity.base_point.x,
&mut entity.base_point.y, &mut entity.base_point.y,
p1, p1,
+4 -4
View File
@@ -11,10 +11,10 @@ use glam::Vec3;
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip}; use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::transform; use crate::scene::view::transform;
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
// ── Marker geometry ─────────────────────────────────────────────────────────── // ── Marker geometry ───────────────────────────────────────────────────────────
+5 -5
View File
@@ -10,9 +10,9 @@ use glam::Vec3;
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, square_grip}; use crate::entities::common::{edit_prop as edit, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
fn v3(v: &acadrust::types::Vector3) -> [f64; 3] { fn v3(v: &acadrust::types::Vector3) -> [f64; 3] {
[v.x, v.y, v.z] [v.x, v.y, v.z]
@@ -147,14 +147,14 @@ impl PropertyEditable for Solid {
impl Transformable for Solid { impl Transformable for Solid {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for corner in [ for corner in [
&mut entity.first_corner, &mut entity.first_corner,
&mut entity.second_corner, &mut entity.second_corner,
&mut entity.third_corner, &mut entity.third_corner,
&mut entity.fourth_corner, &mut entity.fourth_corner,
] { ] {
crate::scene::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2); crate::scene::view::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2);
} }
}); });
} }
+3 -3
View File
@@ -11,7 +11,7 @@ use glam::Vec3;
use crate::entities::common::{center_grip, ro_prop as ro}; use crate::entities::common::{center_grip, ro_prop as ro};
use crate::entities::traits::{Grippable, PropertyEditable}; use crate::entities::traits::{Grippable, PropertyEditable};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
// ── shared helpers ──────────────────────────────────────────────────────────── // ── shared helpers ────────────────────────────────────────────────────────────
@@ -260,8 +260,8 @@ impl PropertyEditable for Body {
// to repeat a three-arm `match entity` block at every callsite — the // to repeat a three-arm `match entity` block at every callsite — the
// helpers below collapse those to a single call. // helpers below collapse those to a single call.
use crate::scene::mesh_model::MeshLodSet; use crate::scene::model::mesh_model::MeshLodSet;
use crate::scene::solid3d_tess; use crate::scene::convert::solid3d_tess;
use acadrust::{types::Vector3, EntityType}; use acadrust::{types::Vector3, EntityType};
/// `point_of_reference` of an ACIS-backed volume entity, if applicable. /// `point_of_reference` of an ACIS-backed volume entity, if applicable.
+9 -9
View File
@@ -7,8 +7,8 @@ use truck_modeling::{
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{ro_prop as ro, square_grip}; use crate::entities::common::{ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible; use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
fn to_truck(spl: &Spline) -> TruckEntity { fn to_truck(spl: &Spline) -> TruckEntity {
let n = spl.control_points.len(); let n = spl.control_points.len();
@@ -141,12 +141,12 @@ fn apply_grip(spline: &mut Spline, grip_id: usize, apply: GripApply) {
} }
fn apply_transform(spline: &mut Spline, t: &EntityTransform) { fn apply_transform(spline: &mut Spline, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(spline, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(spline, t, |entity, p1, p2| {
for cp in &mut entity.control_points { for cp in &mut entity.control_points {
crate::scene::transform::reflect_xy_point(&mut cp.x, &mut cp.y, p1, p2); crate::scene::view::transform::reflect_xy_point(&mut cp.x, &mut cp.y, p1, p2);
} }
for fp in &mut entity.fit_points { for fp in &mut entity.fit_points {
crate::scene::transform::reflect_xy_point(&mut fp.x, &mut fp.y, p1, p2); crate::scene::view::transform::reflect_xy_point(&mut fp.x, &mut fp.y, p1, p2);
} }
}); });
} }
@@ -164,8 +164,8 @@ impl crate::entities::traits::Grippable for Spline {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) { fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply); apply_grip(self, grip_id, apply);
} }
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![ vec![
GripMenuItem { GripMenuItem {
label: "Stretch", label: "Stretch",
@@ -185,8 +185,8 @@ impl crate::entities::traits::Grippable for Spline {
}, },
] ]
} }
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
let n = self.control_points.len(); let n = self.control_points.len();
let min_cv = (self.degree as usize).saturating_add(1).max(2); let min_cv = (self.degree as usize).saturating_add(1).max(2);
match action { match action {
+7 -7
View File
@@ -7,10 +7,10 @@ use crate::entities::text_support::{
layout_mtext, MTextRenderOpts, MTextVAnchor, ResolvedTextStyle, layout_mtext, MTextRenderOpts, MTextVAnchor, ResolvedTextStyle,
}; };
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::transform; use crate::scene::view::transform;
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
fn v3(v: &acadrust::types::Vector3) -> Vec3 { fn v3(v: &acadrust::types::Vector3) -> Vec3 {
Vec3::new(v.x as f32, v.y as f32, v.z as f32) Vec3::new(v.x as f32, v.y as f32, v.z as f32)
@@ -335,9 +335,9 @@ pub fn tessellate_table(
entity_color: [f32; 4], entity_color: [f32; 4],
line_weight_px: f32, line_weight_px: f32,
world_offset: [f64; 3], world_offset: [f64; 3],
) -> Vec<crate::scene::wire_model::WireModel> { ) -> Vec<crate::scene::model::wire_model::WireModel> {
use crate::scene::tess_util::aci_to_rgba; use crate::scene::convert::tess_util::aci_to_rgba;
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use acadrust::types::Color; use acadrust::types::Color;
use rustc_hash::FxHashMap as HashMap; use rustc_hash::FxHashMap as HashMap;
+15 -15
View File
@@ -7,10 +7,10 @@ use crate::entities::text_support::{
resolve_dxf_special_chars, resolve_text_style, text_local_bounds, resolve_dxf_special_chars, resolve_text_style, text_local_bounds,
}; };
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TextStroke, TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::lff; use crate::scene::text::lff;
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property}; use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
fn text_halign_str(a: &acadrust::entities::TextHorizontalAlignment) -> &'static str { fn text_halign_str(a: &acadrust::entities::TextHorizontalAlignment) -> &'static str {
use acadrust::entities::TextHorizontalAlignment::*; use acadrust::entities::TextHorizontalAlignment::*;
@@ -50,7 +50,7 @@ fn sync_text_alignment_point(t: &mut Text) {
fn to_truck(t: &Text, document: &acadrust::CadDocument) -> TruckEntity { fn to_truck(t: &Text, document: &acadrust::CadDocument) -> TruckEntity {
let normal = (t.normal.x, t.normal.y, t.normal.z); let normal = (t.normal.x, t.normal.y, t.normal.z);
let (wsx, wsy, wsz) = crate::scene::transform::ocs_point_to_wcs( let (wsx, wsy, wsz) = crate::scene::view::transform::ocs_point_to_wcs(
( (
t.insertion_point.x, t.insertion_point.x,
t.insertion_point.y, t.insertion_point.y,
@@ -287,15 +287,15 @@ fn apply_grip(t: &mut Text, _grip_id: usize, apply: GripApply) {
} }
fn apply_transform(t: &mut Text, tr: &EntityTransform) { fn apply_transform(t: &mut Text, tr: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x, &mut entity.insertion_point.x,
&mut entity.insertion_point.y, &mut entity.insertion_point.y,
p1, p1,
p2, p2,
); );
if let Some(ref mut a) = entity.alignment_point { if let Some(ref mut a) = entity.alignment_point {
crate::scene::transform::reflect_xy_point(&mut a.x, &mut a.y, p1, p2); crate::scene::view::transform::reflect_xy_point(&mut a.x, &mut a.y, p1, p2);
} }
let dx = (p2.x - p1.x) as f64; let dx = (p2.x - p1.x) as f64;
let dy = (p2.y - p1.y) as f64; let dy = (p2.y - p1.y) as f64;
@@ -320,8 +320,8 @@ impl Grippable for Text {
apply_grip(self, grip_id, apply); apply_grip(self, grip_id, apply);
} }
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> { fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem}; use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![ vec![
GripMenuItem { GripMenuItem {
label: "Stretch", label: "Stretch",
@@ -338,7 +338,7 @@ impl Grippable for Text {
] ]
} }
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) { fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Move-with-Text falls through to Stretch (single grip moves // Move-with-Text falls through to Stretch (single grip moves
// the whole text); Rotate needs a follow-up angle handled by // the whole text); Rotate needs a follow-up angle handled by
// `apply_grip_menu_value`. // `apply_grip_menu_value`.
@@ -347,9 +347,9 @@ impl Grippable for Text {
fn grip_menu_value_prompt( fn grip_menu_value_prompt(
&self, &self,
_grip_id: usize, _grip_id: usize,
action: crate::scene::object::GripMenuAction, action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> { ) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
match action { match action {
A::RotateText => Some("Rotation (deg)"), A::RotateText => Some("Rotation (deg)"),
_ => None, _ => None,
@@ -359,10 +359,10 @@ impl Grippable for Text {
fn apply_grip_menu_value( fn apply_grip_menu_value(
&mut self, &mut self,
_grip_id: usize, _grip_id: usize,
action: crate::scene::object::GripMenuAction, action: crate::scene::model::object::GripMenuAction,
value: f64, value: f64,
) { ) {
use crate::scene::object::GripMenuAction as A; use crate::scene::model::object::GripMenuAction as A;
if matches!(action, A::RotateText) { if matches!(action, A::RotateText) {
self.rotation = value.to_radians(); self.rotation = value.to_radians();
} }
+3 -3
View File
@@ -1,9 +1,9 @@
use acadrust::types::aci_table::aci_to_rgb; use acadrust::types::aci_table::aci_to_rgb;
use acadrust::{CadDocument, EntityType}; use acadrust::{CadDocument, EntityType};
use crate::scene::acad_to_truck::TextStroke; use crate::scene::convert::acad_to_truck::TextStroke;
use crate::scene::font_face::Face; use crate::scene::text::font_face::Face;
use crate::scene::lff; use crate::scene::text::lff;
pub struct ResolvedTextStyle { pub struct ResolvedTextStyle {
pub font_name: String, pub font_name: String,
+5 -4
View File
@@ -4,10 +4,11 @@ use glam::Vec3;
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip}; use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TextStroke, TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
use crate::scene::{lff, transform}; use crate::scene::text::lff;
use crate::scene::view::transform;
// ── GDT text parser ─────────────────────────────────────────────────────────── // ── GDT text parser ───────────────────────────────────────────────────────────
+9 -9
View File
@@ -1,11 +1,11 @@
use acadrust::{CadDocument, EntityType}; use acadrust::{CadDocument, EntityType};
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::scene::acad_to_truck::TruckEntity; use crate::scene::convert::acad_to_truck::TruckEntity;
use crate::scene::object::{ use crate::scene::model::object::{
GripApply, GripDef, GripMenuAction, GripMenuItem, PropSection, GripApply, GripDef, GripMenuAction, GripMenuItem, PropSection,
}; };
use crate::scene::tess_util::FallbackGeometry; use crate::scene::convert::tess_util::FallbackGeometry;
pub trait TruckConvertible { pub trait TruckConvertible {
fn to_truck(&self, document: &CadDocument) -> Option<TruckEntity>; fn to_truck(&self, document: &CadDocument) -> Option<TruckEntity>;
@@ -192,13 +192,13 @@ macro_rules! dispatch {
macro_rules! impl_entity_basics { macro_rules! impl_entity_basics {
($T:ty) => { ($T:ty) => {
impl $crate::entities::traits::Grippable for $T { impl $crate::entities::traits::Grippable for $T {
fn grips(&self) -> Vec<$crate::scene::object::GripDef> { fn grips(&self) -> Vec<$crate::scene::model::object::GripDef> {
grips(self) grips(self)
} }
fn apply_grip( fn apply_grip(
&mut self, &mut self,
grip_id: usize, grip_id: usize,
apply: $crate::scene::object::GripApply, apply: $crate::scene::model::object::GripApply,
) { ) {
apply_grip(self, grip_id, apply); apply_grip(self, grip_id, apply);
} }
@@ -207,7 +207,7 @@ macro_rules! impl_entity_basics {
fn geometry_properties( fn geometry_properties(
&self, &self,
_text_style_names: &[String], _text_style_names: &[String],
) -> $crate::scene::object::PropSection { ) -> $crate::scene::model::object::PropSection {
properties(self) properties(self)
} }
fn apply_geom_prop(&mut self, field: &str, value: &str) { fn apply_geom_prop(&mut self, field: &str, value: &str) {
@@ -229,13 +229,13 @@ macro_rules! impl_entity_basics {
macro_rules! impl_entity_basics_with_text_styles { macro_rules! impl_entity_basics_with_text_styles {
($T:ty) => { ($T:ty) => {
impl $crate::entities::traits::Grippable for $T { impl $crate::entities::traits::Grippable for $T {
fn grips(&self) -> Vec<$crate::scene::object::GripDef> { fn grips(&self) -> Vec<$crate::scene::model::object::GripDef> {
grips(self) grips(self)
} }
fn apply_grip( fn apply_grip(
&mut self, &mut self,
grip_id: usize, grip_id: usize,
apply: $crate::scene::object::GripApply, apply: $crate::scene::model::object::GripApply,
) { ) {
apply_grip(self, grip_id, apply); apply_grip(self, grip_id, apply);
} }
@@ -244,7 +244,7 @@ macro_rules! impl_entity_basics_with_text_styles {
fn geometry_properties( fn geometry_properties(
&self, &self,
text_style_names: &[String], text_style_names: &[String],
) -> $crate::scene::object::PropSection { ) -> $crate::scene::model::object::PropSection {
properties(self, text_style_names) properties(self, text_style_names)
} }
fn apply_geom_prop(&mut self, field: &str, value: &str) { fn apply_geom_prop(&mut self, field: &str, value: &str) {
+4 -4
View File
@@ -10,9 +10,9 @@ use glam::Vec3;
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip}; use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible}; use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject}; use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection}; use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint; use crate::scene::model::wire_model::SnapHint;
// ── Helpers ─────────────────────────────────────────────────────────────────── // ── Helpers ───────────────────────────────────────────────────────────────────
@@ -224,7 +224,7 @@ impl PropertyEditable for Underlay {
impl Transformable for Underlay { impl Transformable for Underlay {
fn apply_transform(&mut self, t: &EntityTransform) { fn apply_transform(&mut self, t: &EntityTransform) {
use crate::scene::transform::reflect_xy_point; use crate::scene::view::transform::reflect_xy_point;
match t { match t {
EntityTransform::Translate(d) => { EntityTransform::Translate(d) => {
self.insertion_point.x += d.x as f64; self.insertion_point.x += d.x as f64;
+4 -4
View File
@@ -5,7 +5,7 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip, center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
}; };
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property}; use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
// ── Standard scale options ──────────────────────────────────────────────── // ── Standard scale options ────────────────────────────────────────────────
@@ -533,8 +533,8 @@ fn apply_grip(vp: &mut Viewport, grip_id: usize, apply: GripApply) {
} }
fn apply_transform(vp: &mut Viewport, t: &EntityTransform) { fn apply_transform(vp: &mut Viewport, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(vp, t, |entity, p1, p2| { crate::scene::view::transform::apply_standard_entity_transform(vp, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point( crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x, &mut entity.center.x,
&mut entity.center.y, &mut entity.center.y,
p1, p1,
@@ -549,7 +549,7 @@ impl crate::entities::traits::FallbackTess for Viewport {
fn fallback_geometry( fn fallback_geometry(
&self, &self,
world_offset: [f64; 3], world_offset: [f64; 3],
) -> crate::scene::tess_util::FallbackGeometry { ) -> crate::scene::convert::tess_util::FallbackGeometry {
let [ox, oy, oz] = world_offset; let [ox, oy, oz] = world_offset;
let cx = (self.center.x - ox) as f32; let cx = (self.center.x - ox) as f32;
let cy = (self.center.y - oy) as f32; let cy = (self.center.y - oy) as f32;
+1 -1
View File
@@ -4,7 +4,7 @@
// Quads are split into two triangles. // Quads are split into two triangles.
// Only the first object/group is imported (no multi-object support needed). // Only the first object/group is imported (no multi-object support needed).
use crate::scene::mesh_model::MeshModel; use crate::scene::model::mesh_model::MeshModel;
/// Parse OBJ text into a MeshModel. /// Parse OBJ text into a MeshModel.
/// Returns `None` if the file has no usable geometry. /// Returns `None` if the file has no usable geometry.
+1 -1
View File
@@ -9,7 +9,7 @@
// drawing origin at the paper origin. // drawing origin at the paper origin.
use crate::io::plot_style::PlotStyleTable; use crate::io::plot_style::PlotStyleTable;
use crate::scene::hatch_model::{HatchModel, HatchPattern}; use crate::scene::model::hatch_model::{HatchModel, HatchPattern};
use crate::scene::WireModel; use crate::scene::WireModel;
use printpdf::{ use printpdf::{
Color, Line, LineCapStyle, LineJoinStyle, LinePoint, Mm, Op, PaintMode, PdfDocument, PdfPage, Color, Line, LineCapStyle, LineJoinStyle, LinePoint, Mm, Op, PaintMode, PdfDocument, PdfPage,
+1 -1
View File
@@ -9,7 +9,7 @@
use crate::io::pdf_export; use crate::io::pdf_export;
use crate::io::plot_style::PlotStyleTable; use crate::io::plot_style::PlotStyleTable;
use crate::scene::hatch_model::HatchModel; use crate::scene::model::hatch_model::HatchModel;
use crate::scene::WireModel; use crate::scene::WireModel;
/// Render `wires` (plus hatch / wipeout fills) to a temp PDF and dispatch it /// Render `wires` (plus hatch / wipeout fills) to a temp PDF and dispatch it
+1 -1
View File
@@ -12,7 +12,7 @@
// This produces larger-than-optimal files but is universally importable by // This produces larger-than-optimal files but is universally importable by
// CAD systems that accept AP203. // CAD systems that accept AP203.
use crate::scene::mesh_model::MeshModel; use crate::scene::model::mesh_model::MeshModel;
use std::fmt::Write as FmtWrite; use std::fmt::Write as FmtWrite;
/// Build a STEP AP203 text representation from a slice of mesh models. /// Build a STEP AP203 text representation from a slice of mesh models.
+1 -1
View File
@@ -11,7 +11,7 @@
use std::io::Write; use std::io::Write;
use crate::scene::mesh_model::MeshModel; use crate::scene::model::mesh_model::MeshModel;
/// Build a binary STL byte buffer from a slice of mesh models. /// Build a binary STL byte buffer from a slice of mesh models.
/// Returns `None` if there are no triangles to export. /// Returns `None` if there are no triangles to export.
+1 -1
View File
@@ -7,7 +7,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_aligned.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_aligned.svg"));
+1 -1
View File
@@ -4,7 +4,7 @@ use acadrust::EntityType;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_angular.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_angular.svg"));
+1 -1
View File
@@ -7,7 +7,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_diameter.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_diameter.svg"));
+1 -1
View File
@@ -13,7 +13,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_baseline.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_baseline.svg"));
+1 -1
View File
@@ -13,7 +13,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_continue.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_continue.svg"));
+1 -1
View File
@@ -9,7 +9,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_jog.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_jog.svg"));
+1 -1
View File
@@ -9,7 +9,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_tedit.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_tedit.svg"));
+1 -1
View File
@@ -17,7 +17,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/leader.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/leader.svg"));
+1 -1
View File
@@ -4,7 +4,7 @@ use acadrust::EntityType;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_linear.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_linear.svg"));
+1 -1
View File
@@ -12,7 +12,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/mleader.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/mleader.svg"));
+1 -1
View File
@@ -12,7 +12,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
// ── MLEADERADD ──────────────────────────────────────────────────────────────── // ── MLEADERADD ────────────────────────────────────────────────────────────────
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/mtext.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/mtext.svg"));
+1 -1
View File
@@ -15,7 +15,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub fn tool() -> ToolDef { pub fn tool() -> ToolDef {
ToolDef { ToolDef {
+1 -1
View File
@@ -13,7 +13,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/qdim.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/qdim.svg"));
+1 -1
View File
@@ -4,7 +4,7 @@ use acadrust::EntityType;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_radius.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_radius.svg"));
+1 -1
View File
@@ -14,7 +14,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/table.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/table.svg"));
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/text.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/text.svg"));
+1 -1
View File
@@ -11,7 +11,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/tolerance.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/tolerance.svg"));
+1 -1
View File
@@ -17,7 +17,7 @@ use acadrust::Handle;
use glam::Vec3; use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub struct PasteCommand { pub struct PasteCommand {
/// Wire models of the clipboard entities (used for preview). /// Wire models of the clipboard entities (used for preview).
+1 -1
View File
@@ -17,7 +17,7 @@ use acadrust::{Arc as CadArc, EntityType};
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::IconKind; use crate::modules::IconKind;
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
const TAU: f32 = std::f32::consts::TAU; const TAU: f32 = std::f32::consts::TAU;
+1 -1
View File
@@ -12,7 +12,7 @@ use acadrust::EntityType;
use glam::Vec3; use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
enum Step { enum Step {
Tag, Tag,
+1 -1
View File
@@ -14,7 +14,7 @@ use acadrust::{Circle, EntityType};
use crate::command::{CadCommand, CmdResult, DynField, TangentObject}; use crate::command::{CadCommand, CmdResult, DynField, TangentObject};
use crate::modules::home::defaults; use crate::modules::home::defaults;
use crate::modules::IconKind; use crate::modules::IconKind;
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
const TAU: f32 = std::f32::consts::TAU; const TAU: f32 = std::f32::consts::TAU;
+1 -1
View File
@@ -10,7 +10,7 @@ use acadrust::{Ellipse, EntityType};
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::IconKind; use crate::modules::IconKind;
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
fn parse_f32(text: &str) -> Option<f32> { fn parse_f32(text: &str) -> Option<f32> {
+3 -3
View File
@@ -11,8 +11,8 @@
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::IconKind; use crate::modules::IconKind;
use crate::scene::hatch_model::{HatchModel, HatchPattern, PatFamily}; use crate::scene::model::hatch_model::{HatchModel, HatchPattern, PatFamily};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
// ── Icons ────────────────────────────────────────────────────────────────── // ── Icons ──────────────────────────────────────────────────────────────────
@@ -92,7 +92,7 @@ impl HatchCommand {
fn make_hatch(&self, boundary: Vec<[f32; 2]>) -> HatchModel { fn make_hatch(&self, boundary: Vec<[f32; 2]>) -> HatchModel {
// Default: ANSI31 from catalog; fallback to a single 45° family. // Default: ANSI31 from catalog; fallback to a single 45° family.
let pat_name = "ANSI31"; let pat_name = "ANSI31";
let families = crate::scene::hatch_patterns::find(pat_name) let families = crate::scene::model::hatch_patterns::find(pat_name)
.and_then(|e| { .and_then(|e| {
if let HatchPattern::Pattern(f) = &e.gpu { if let HatchPattern::Pattern(f) = &e.gpu {
Some(f.clone()) Some(f.clone())
+1 -1
View File
@@ -11,7 +11,7 @@ use acadrust::{EntityType, Line};
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
// ── Ribbon definition ───────────────────────────────────────────────────── // ── Ribbon definition ─────────────────────────────────────────────────────
+1 -1
View File
@@ -11,7 +11,7 @@ use acadrust::EntityType;
use glam::Vec3; use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub struct MlineCommand { pub struct MlineCommand {
points: Vec<Vec3>, points: Vec<Vec3>,
+1 -1
View File
@@ -8,7 +8,7 @@ use acadrust::{EntityType, Point as CadPoint};
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
#[allow(dead_code)] #[allow(dead_code)]
+1 -1
View File
@@ -16,7 +16,7 @@ use glam::{Vec2, Vec3};
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ────────────────────────────────────────────────────── // ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -12,7 +12,7 @@ use acadrust::EntityType;
use glam::Vec3; use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub struct ImageCommand { pub struct ImageCommand {
file_path: String, file_path: String,
+1 -1
View File
@@ -9,7 +9,7 @@ use acadrust::types::Vector3;
use acadrust::EntityType; use acadrust::EntityType;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
const DISPLAY_EXTENT: f32 = 1_000_000.0; const DISPLAY_EXTENT: f32 = 1_000_000.0;
+1 -1
View File
@@ -11,7 +11,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../../assets/icons/revcloud.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../../assets/icons/revcloud.svg"));
+1 -1
View File
@@ -16,7 +16,7 @@ use acadrust::{EntityType, LwPolyline};
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::IconKind; use crate::modules::IconKind;
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
const TAU: f32 = std::f32::consts::TAU; const TAU: f32 = std::f32::consts::TAU;
+1 -1
View File
@@ -8,7 +8,7 @@ use acadrust::{EntityType, Spline};
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
use glam::Vec3; use glam::Vec3;
#[allow(dead_code)] #[allow(dead_code)]
+1 -1
View File
@@ -11,7 +11,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../../assets/icons/wipeout.svg")); pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../../assets/icons/wipeout.svg"));
+1 -1
View File
@@ -17,7 +17,7 @@ use acadrust::Handle;
use glam::Vec3; use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub struct GroupCommand { pub struct GroupCommand {
handles: Vec<Handle>, handles: Vec<Handle>,
+1 -1
View File
@@ -17,7 +17,7 @@ use acadrust::Handle;
use glam::Vec3; use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub struct UngroupCommand; pub struct UngroupCommand;
+1 -1
View File
@@ -4,7 +4,7 @@
use glam::Vec3; use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub struct AreaCommand { pub struct AreaCommand {
points: Vec<Vec3>, points: Vec<Vec3>,
+1 -1
View File
@@ -3,7 +3,7 @@
use glam::Vec3; use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub struct DistCommand { pub struct DistCommand {
first: Option<Vec3>, first: Option<Vec3>,
+1 -1
View File
@@ -19,7 +19,7 @@ use acadrust::Handle;
use glam::Vec3; use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub struct LayMatchCommand { pub struct LayMatchCommand {
dest_handles: Vec<Handle>, dest_handles: Vec<Handle>,
+4 -4
View File
@@ -19,7 +19,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, EntityTransform}; use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::home::defaults; use crate::modules::home::defaults;
use crate::modules::IconKind; use crate::modules::IconKind;
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
// ── Dropdown constants ───────────────────────────────────────────────────── // ── Dropdown constants ─────────────────────────────────────────────────────
@@ -395,7 +395,7 @@ use std::f32::consts::TAU as FTAU;
/// chord and ignored the extrusion, so arc-segment paths came out mirrored. /// chord and ignored the extrusion, so arc-segment paths came out mirrored.
fn lw_dense_pts(p: &acadrust::entities::LwPolyline) -> Vec<Vec3> { fn lw_dense_pts(p: &acadrust::entities::LwPolyline) -> Vec<Vec3> {
use crate::entities::common::BulgeArc; use crate::entities::common::BulgeArc;
use crate::scene::transform::ocs_point_to_wcs; use crate::scene::view::transform::ocs_point_to_wcs;
let verts = &p.vertices; let verts = &p.vertices;
if verts.is_empty() { if verts.is_empty() {
@@ -547,7 +547,7 @@ impl ArrayPathCommand {
// (normal = -Z) are traced on the same side the renderer draws, // (normal = -Z) are traced on the same side the renderer draws,
// matching `entities::arc::to_truck`. Sampling the raw centre + // matching `entities::arc::to_truck`. Sampling the raw centre +
// angle ignores the extrusion and lands on the mirrored arc. // angle ignores the extrusion and lands on the mirrored arc.
use crate::scene::transform::{ocs_axes, ocs_point_to_wcs}; use crate::scene::view::transform::{ocs_axes, ocs_point_to_wcs};
let normal = (a.normal.x, a.normal.y, a.normal.z); let normal = (a.normal.x, a.normal.y, a.normal.z);
let (ax, ay) = ocs_axes(normal); let (ax, ay) = ocs_axes(normal);
let (cx, cy, cz) = let (cx, cy, cz) =
@@ -570,7 +570,7 @@ impl ArrayPathCommand {
.collect() .collect()
} }
EntityType::Circle(c) => { EntityType::Circle(c) => {
use crate::scene::transform::{ocs_axes, ocs_point_to_wcs}; use crate::scene::view::transform::{ocs_axes, ocs_point_to_wcs};
let normal = (c.normal.x, c.normal.y, c.normal.z); let normal = (c.normal.x, c.normal.y, c.normal.z);
let (ax, ay) = ocs_axes(normal); let (ax, ay) = ocs_axes(normal);
let (cx, cy, cz) = let (cx, cy, cz) =
+1 -1
View File
@@ -10,7 +10,7 @@ use acadrust::EntityType;
use glam::Vec3; use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub struct AtteditCommand { pub struct AtteditCommand {
step: Step, step: Step,
+1 -1
View File
@@ -20,7 +20,7 @@ use truck_modeling::base::{BoundedCurve, Cut};
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ────────────────────────────────────────────────────── // ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -10,7 +10,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, EntityTransform}; use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ────────────────────────────────────────────────────── // ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -19,7 +19,7 @@ const TAU: f64 = std::f64::consts::TAU;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::home::defaults; use crate::modules::home::defaults;
use crate::modules::IconKind; use crate::modules::IconKind;
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
// ── Dropdown constants ───────────────────────────────────────────────────── // ── Dropdown constants ─────────────────────────────────────────────────────
+1 -1
View File
@@ -13,7 +13,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, EntityTransform}; use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub fn tool() -> ToolDef { pub fn tool() -> ToolDef {
ToolDef { ToolDef {
+1 -1
View File
@@ -23,7 +23,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::home::defaults; use crate::modules::home::defaults;
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ────────────────────────────────────────────────────── // ── Ribbon definition ──────────────────────────────────────────────────────
+2 -2
View File
@@ -128,7 +128,7 @@ impl CadCommand for RefCloseCommand {
/// Order: scale → rotate (around origin) → translate. /// Order: scale → rotate (around origin) → translate.
pub fn apply_insert_transform(entity: &mut EntityType, session: &RefEditSession) { pub fn apply_insert_transform(entity: &mut EntityType, session: &RefEditSession) {
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::scene::dispatch; use crate::scene::view::dispatch;
let origin = Vec3::ZERO; let origin = Vec3::ZERO;
@@ -170,7 +170,7 @@ pub fn apply_insert_transform(entity: &mut EntityType, session: &RefEditSession)
/// Order: un-translate → un-rotate → un-scale. /// Order: un-translate → un-rotate → un-scale.
pub fn apply_insert_inverse_transform(entity: &mut EntityType, session: &RefEditSession) { pub fn apply_insert_inverse_transform(entity: &mut EntityType, session: &RefEditSession) {
use crate::command::EntityTransform; use crate::command::EntityTransform;
use crate::scene::dispatch; use crate::scene::view::dispatch;
let origin = Vec3::ZERO; let origin = Vec3::ZERO;
+1 -1
View File
@@ -12,7 +12,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, DynField, EntityTransform}; use crate::command::{CadCommand, CmdResult, DynField, EntityTransform};
use crate::modules::home::defaults; use crate::modules::home::defaults;
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ────────────────────────────────────────────────────── // ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -18,7 +18,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, EntityTransform}; use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::home::defaults; use crate::modules::home::defaults;
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
#[allow(dead_code)] #[allow(dead_code)]
pub fn tool() -> ToolDef { pub fn tool() -> ToolDef {
+1 -1
View File
@@ -14,7 +14,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
#[allow(dead_code)] #[allow(dead_code)]
pub fn tool() -> ToolDef { pub fn tool() -> ToolDef {
+1 -1
View File
@@ -20,7 +20,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ────────────────────────────────────────────────────── // ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -10,7 +10,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, EntityTransform}; use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ────────────────────────────────────────────────────── // ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -25,7 +25,7 @@ use crate::modules::home::modify::spline_ops::{
t_to_rel, t_to_rel,
}; };
use crate::modules::IconKind; use crate::modules::IconKind;
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
// ── Dropdown constants ───────────────────────────────────────────────────── // ── Dropdown constants ─────────────────────────────────────────────────────
+1 -1
View File
@@ -17,7 +17,7 @@ use acadrust::Handle;
use glam::Vec3; use glam::Vec3;
use crate::command::{CadCommand, CmdResult}; use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel; use crate::scene::model::wire_model::WireModel;
pub struct MatchPropCommand { pub struct MatchPropCommand {
/// Source handle; NULL until phase 1 is complete. /// Source handle; NULL until phase 1 is complete.
Loaded 100 of 160 files, more files were not shown because too many files have changed in this diff. Show more