fix(render): annotative scale representations + model-space linetype scale

Two rendering defects surfaced on the budweiser benchmark drawings, both
tied to a drawing's annotation scale.

Annotative scale representations. A drawing may materialise each annotation
scale as its own object (here a block insert per scale, on a "0 @ <scale>"
layer, each carrying a per-object AcDbContextData bound to one scale).
Nothing filtered them, so every scale drew at once — a 1× copy stacked
under a 10× one. Add annotative::annotative_offscale and apply it in the
three paths that expand block content: the wire block-defn cache, the
resident/top-level visibility gate (model space only — paper viewports use
their per-viewport frozen scale layers), and the exploded-insert hatch/fill
walk (filtered before normalize strips the handle). An object is shown when
a representation matches the current scale; the off-scale ones are hidden.
When the current scale is unsupported by any representation, fall back to
the base "1:1" copy instead of hiding everything (the object must not
vanish) or showing everything (the copies must not stack).

Model-space linetype scale. PSLTSCALE (a paper-space flag) was applied to
model-space linetypes via the annotation scale, so a drawing saved at e.g.
CANNOSCALE 10:1 drew its linetypes 10× off. Thread a `paper_space` flag
through tessellate_entity and gate the PSLTSCALE factor on it, so it only
scales linetypes for content shown inside a paper-space viewport; model
space keeps LTSCALE × CELTSCALE.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-23 21:24:56 +03:00
1 parent 5e2b67c642
commit d54fb9e2aa
5 files changed
+113 -2

No files matched your search

+14 -2
View File
@@ -325,6 +325,7 @@ pub(crate) fn tessellate_entity_dim_text(
None,
view_aabb,
world_per_pixel,
false,
);
for w in &mut wires {
// Synth dim text carries no real entity colour — paint everything
@@ -351,6 +352,11 @@ pub(crate) fn tessellate_entity(
view_aabb: Option<[f32; 4]>,
// World units per screen pixel for LOD culling. `None` = no LOD.
world_per_pixel: Option<f32>,
// True only when tessellating content shown INSIDE a paper-space viewport,
// where PSLTSCALE scales linetypes by the viewport scale. Model-space (and
// paper-sheet) rendering passes false: a drawing's annotation scale must
// not resize model-space linetypes (that is MSLTSCALE, off here).
paper_space: bool,
) -> Vec<WireModel> {
let h = e.common().handle;
let sel = selected.contains(&h);
@@ -501,8 +507,12 @@ pub(crate) fn tessellate_entity(
let entity_color = fade_if_locked(document, e, entity_color, bg_color);
let lt_scale = document.header.linetype_scale as f32 * e.common().linetype_scale as f32;
let lt_name = view::render::linetype_name_for(document, e);
// PSLTSCALE: scale linetype dashes by viewport anno_scale so they appear uniform in paper space.
let pslt_factor = if document.header.paper_space_linetype_scaling {
// PSLTSCALE: scale linetype dashes by the viewport scale so they appear
// uniform in paper space. Only applies to content shown inside a paper-space
// viewport (`paper_space`); model space uses LTSCALE × CELTSCALE unscaled by
// the annotation scale, otherwise a drawing at e.g. CANNOSCALE 10:1 draws
// its linetypes 10× off.
let pslt_factor = if paper_space && document.header.paper_space_linetype_scaling {
anno_scale
} else {
1.0
@@ -760,6 +770,7 @@ pub(crate) fn tessellate_entity(
block_cache,
view_aabb,
world_per_pixel,
paper_space,
);
for mut w in sub_wires {
w.name = h.value().to_string();
@@ -921,6 +932,7 @@ pub(crate) fn tessellate_entity(
block_cache,
view_aabb,
world_per_pixel,
paper_space,
);
for mut w in sub_wires {
w.name = h.value().to_string();