forked from 1b-agent/opencadstudio-upstream
refactor(scene/mod.rs): pull entity-specific helpers into entities/
Five chunks moved out of the 5965-line scene/mod.rs to live with the entities they belong to: - wide_lwpolyline_fills → entities/lwpolyline.rs::wide_fills - wide_polyline2d_fills → entities/polyline.rs::wide_fills - polyline_segment_fill → entities/common.rs (shared by both above) - text_obb_corners_native + text_baseline_points + text_greek_obb_tris → entities/text_support.rs (handles Text/MText/Attribute alike) - append_insert_attribute_wires → entities/insert.rs Net: scene/mod.rs 5965 → 5404 lines (~560 lines extracted). Three helpers in scene/render.rs / scene/block_cache.rs widened from pub(super) to pub(crate) so the relocated functions can still reach them. scene::entity_aabb also widened for the same reason. scene::tessellate_entity_dim_text stays put — it's a thin wrapper around the private tessellate_entity dispatcher and moving it would require exposing tessellate_entity's full signature across the crate. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
1 parent
64d8b2117d
commit
40180e9089
8 files changed
+566
-573
No files matched your search
+2
-2
@@ -279,7 +279,7 @@ pub(super) fn render_style_for(
|
||||
/// Like `render_style_for` but resolves ByBlock properties by inheriting from
|
||||
/// the INSERT entity's already-resolved style. Call this for exploded block
|
||||
/// sub-entities so that ByBlock color/linetype/lineweight propagate correctly.
|
||||
pub(super) fn render_style_for_block_sub(
|
||||
pub(crate) fn render_style_for_block_sub(
|
||||
document: &CadDocument,
|
||||
e: &EntityType,
|
||||
insert_color: [f32; 4],
|
||||
@@ -314,7 +314,7 @@ pub(super) fn render_style_for_block_sub(
|
||||
/// Adapt white→black or black→white based on background luminance.
|
||||
/// White entities on light backgrounds become black, black entities on dark
|
||||
/// backgrounds become white. All other colors pass through unchanged.
|
||||
pub(super) fn adapt_to_bg(color: [f32; 4], bg: [f32; 4]) -> [f32; 4] {
|
||||
pub(crate) fn adapt_to_bg(color: [f32; 4], bg: [f32; 4]) -> [f32; 4] {
|
||||
let lum = 0.299 * bg[0] + 0.587 * bg[1] + 0.114 * bg[2];
|
||||
let is_white = color[0] > 0.95 && color[1] > 0.95 && color[2] > 0.95;
|
||||
let is_black = color[0] < 0.05 && color[1] < 0.05 && color[2] < 0.05;
|
||||
|
||||
Reference in new issue
Block a user