Commit Graph
105 Commits
Author SHA1 Message Date
Hakan SevenandClaude Opus 5.5 f6455b22eb fix(view): Zoom Extents and All frame a drawing placed at survey coordinates (#1829)
A block whose content is only 3D solids leaves a marker wire carrying
its insertion snap, and that point counted as drawing extent: a
georeferenced block inserted at the origin made ZOOM E frame the
origin and the model together, 860 km wide. Extents now skip those
markers; the solids count through their meshes. The marker's snap also
took the insertion point straight from the OCS, so a mirrored insert's
snap sat on the far side of the origin.

ZOOM All fitted the limits alone. In a 3D view it is now Zoom
Extents, and in plan it frames the limits together with the extents.

Instanced solids summed their rotated point and translation in f32
before meeting the eye, which cost up to half a metre at survey
coordinates; the large terms now cancel first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-16 02:11:16 +03:00
Hakan SevenandClaude Opus 5.5 38d81bf838 feat(selection): highlight opacity and extra width (#1823)
Options > Selection gains "Selection highlight opacity" and "Selection
highlight extra width". Below full opacity the object's own colour
shows through the highlight. The selection overlay draws with its own
copy of the frame uniforms: transparency on, and every line widened by
the extra width. Drawings opened at startup now get the selection
colour settings too; they used to keep the defaults until a setting
changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-16 01:07:23 +03:00
Hakan SevenandClaude Opus 5.5 19cc2e1073 fix(render): colour-7 solid edges contrast with a layout's paper
A solid's edges and silhouettes were drawn in its face colour, and the
edge shader read that from the material instead of the edge vertices.
Colour 7 is white, so in Wireframe 2D a solid vanished white-on-white in
a layout viewport (and on a light model background), while wires and
block solids already turned black there. Solids now keep a separate
edge colour, colour 7 turned against the background they are drawn on,
and the edge shader uses the edge vertices' colour again, which also
brings back visual-style edge colours. Shaded faces keep their colour
so they still read as lit. (#1446)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 21:07:05 +03:00
Hakan Seven 03445a540d Merge pull request #1722 from ramox81/codex/view-background
# Conflicts:
#	locales/ar-SA/opencadstudio.ftl
#	locales/bg-BG/opencadstudio.ftl
#	locales/cs-CZ/opencadstudio.ftl
#	locales/de-DE/opencadstudio.ftl
#	locales/el-GR/opencadstudio.ftl
#	locales/en-US/opencadstudio.ftl
#	locales/es-ES/opencadstudio.ftl
#	locales/fi-FI/opencadstudio.ftl
#	locales/fr-FR/opencadstudio.ftl
#	locales/hi-IN/opencadstudio.ftl
#	locales/hu-HU/opencadstudio.ftl
#	locales/it-IT/opencadstudio.ftl
#	locales/ja-JP/opencadstudio.ftl
#	locales/ko-KR/opencadstudio.ftl
#	locales/lo-LA/opencadstudio.ftl
#	locales/nl-NL/opencadstudio.ftl
#	locales/pl-PL/opencadstudio.ftl
#	locales/pt-BR/opencadstudio.ftl
#	locales/ru-RU/opencadstudio.ftl
#	locales/tr-TR/opencadstudio.ftl
#	locales/zh-CN/opencadstudio.ftl
#	locales/zh-TW/opencadstudio.ftl
2026-10-13 07:44:01 +03:00
gianlucafiore 1074c81f52 fix: increase bounded screen draw-order depth resolution for overlapping block wipeouts 2026-10-12 18:07:48 -03:00
ramox81andClaude Opus 5.5 9ef8f4bedf View backgrounds: reference blend, image adjust, layouts, cleanup, style name
- Gradients: the middle colour sits (horizon - 0.5) viewport widths from the
  centre and blends over height viewport heights each side; two colours
  blend over a viewport height each side.
- Image backgrounds: offset in device pixels (right, down), negative scale
  mirrors, fitted with aspect ratio covers the viewport; the dialog keeps an
  image's offset and scale.
- Layouts: a model-space view restored on a sheet asks for the viewport,
  enters it and gives it the view's camera, background and visual style;
  inside a viewport the view goes there; a paper-space view's background is
  kept on the sheet viewport but not drawn; floating viewports draw their
  background.
- Background objects no view or viewport uses any more are erased; a view
  without a background restored where the viewport already is leaves the
  viewport's background.
- The viewport's named visual style (Realistic, ...) shows by name and the
  render-mode picker records its style on the viewport record.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 17:31:01 +03:00
ramox81andClaude Opus 5.5 7a0e08129f Draw a centred image background at its pixel size
An image background not fitted to the screen keeps its own pixel size
(times its scale), centred on the viewport and moved by its offset, as
the reference draws it; tiling repeats it from there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 12:04:52 +03:00
ramox81andClaude Opus 5.5 bd4029fb50 Blend gradient backgrounds linearly; two colours over twice the view
Measured against the reference: a two-colour gradient reaches its end
colours a viewport beyond the edges, and the bands blend linearly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 11:51:39 +03:00
ramox81andClaude Opus 5.5 46daf03bc9 Draw gradient backgrounds as the reference does
The rotation is stored in degrees and turns the bottom-to-top direction
counter-clockwise, measured in pixels; a two-colour gradient blends from
the bottom colour to the top one across the whole viewport.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 11:37:53 +03:00
Hakan SevenandClaude Opus 5.5 f4c0dc451d fix(linetype): arcs scale their dash elements with the pattern
Circle and ellipse shaders scaled the pattern length by the linetype
scale (PSLTSCALE in a viewport, annotation scale in model) but not the
dash and gap elements, so a dashed arc broke into dots.

Fixes #1644

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 08:34:49 +03:00
Hakan SevenandClaude Opus 5.5 de6e27304d perf(layers): toggle layer visibility without re-tessellating
Turning a 141k-entity layer off/on took 1.5-5 s; it now takes ~0.6-0.9 s.

- Off/freeze toggles go through invalidate_layer_visibility: entities on
  the layer keep their tessellation memo (visibility gates them before
  tessellation); only block users re-expand. No mesh recolor.
- The resident patch reuses a surviving memo entry instead of
  re-tessellating, guarded by the same display-context hash as the full
  build.
- The patch looked up `layout.order` linearly per re-shown entity, which
  made turning a big layer back on quadratic.
- recolor_meshes_for_handles resolved materials for handles with no mesh.
- Wire arena: a hidden slab keeps its instances and sets a `hidden` flag
  in its consts (collapsed in the vertex shader); an unchanged re-show only
  clears the flag. Const writes are batched into merged spans.
- The `layer_visible` automation action indexed the document's layer
  table instead of the sortable panel rows the Layer* messages use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 15:53:27 +03:00
Hakan SevenandClaude Opus 5.5 d6dfd0d46d fix(render): miter the joints of wide polyline bands
Each band segment was a rectangle ending square at its vertex, so the
outer corner of every joint showed a notch. Every segment end now carries
the tangent of half its turn, and the shader slides that end's corners
onto the joint's bisector so neighbours meet in a miter. Turns sharper
than the limit keep butt ends. Constant-width runs inside a polyline split
around its arcs no longer count as tapered, which had kept them unmitred.

Fixes #1565

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-04 20:44:08 +03:00
ramox81andClaude Opus 5.5 15c0da8b79 Point clouds: measured lighting, highlighted extents box, gizmo shaft grab
- Lighting follows the view: the default source is a key light from the
  upper left and a fill light from the lower right over an ambient term,
  the other source one light from above; POINTCLOUDLIGHTING 1 lights the
  front faces, 2 both.
- A selected or hovered point cloud shows its extents box.
- A move-gizmo arrow can be grabbed along its shaft; the grab offset is
  taken on the press, so click-and-place and typed distances start from
  the insertion point.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-30 17:21:33 +03:00
ramox81andClaude Opus 5.5 b69ae291bb Point clouds: lighting, 2D visual style, real-time density
Points carry their world normal: POINTCLOUDLIGHTING lights them in the
shaded visual styles (1 lit from both sides, 2 with back faces dark),
from the view (POINTCLOUDLIGHTSOURCE 0) or the default lights (1).
The 2D wireframe style draws no cloud points: a found cloud shows its
extents and "Point clouds are not displayed in 2D visual style.",
or nothing with POINTCLOUD2DVSDISPLAY 1. While the view moves only
POINTCLOUDRTDENSITY per cent of the points are drawn; the points are
stored in an order where every leading part samples the whole cloud.
The colour map dialog lists its schemes by name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-30 14:54:03 +03:00
ramox81andClaude Opus 5.5 e9c4e501db Point clouds: drawn from their scans, placed, cropped and attached as the reference does
Scans (.rcs) and projects (.rcp) are read and their points drawn as
screen-sized dots, coloured by the cloud's stylization. The cloud's
placement carries its scale and rotation; its extents and crops stay in
the scan's coordinates. A missing scan shows the extents with the saved
path. -POINTCLOUDATTACH / POINTCLOUDATTACH, POINTCLOUDCROP and the
POINTCLOUD* settings follow the reference's prompts and messages, the
Properties list is the reference's, and a locked cloud is left alone by
edits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-29 17:08:46 +03:00
Hakan SevenandClaude Opus 5.5 80372abf2c fix(render): transparency toggle also governs hatches, text and fills
Only the wire shaders read transparency_enable; hatch (solid, gradient
and pattern), text and 3D/fill-triangle fragments always drew the
entity's alpha, so turning Show Transparency off left them see-through.

Fixes #1529

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-29 09:09:42 +03:00
ramox81andClaude Opus 5.5 5de0ce069f Image shader: fully transparent pixels are discarded
A transparent pixel wrote depth, hiding lines and objects under the image
that were drawn after it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-28 13:17:31 +03:00
ramox81andClaude Opus 5.5 5ca7becd97 Raster images: transparency off draws pixels opaque; TRANSPARENCY command
An image's transparency flag decides whether transparent pixels show what
is behind the image or draw in their stored colour: the image pass and PDF
plots now follow it (it was ignored, so every PNG alpha showed through).
TRANSPARENCY selects images and asks for the mode, defaulting to the first
image's current one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-28 11:23:19 +03:00
Christopher Overbeck e52e565b1f fix(renderer): keep draw-order offsets within clipping planes 2026-09-15 12:36:05 -05:00
Hakan Seven 07acd1284c Render procedural checker materials correctly 2026-09-13 01:50:42 +03:00
Hakan Seven d07e8cf7d4 Fix wipeout rotation and block frame width 2026-09-11 20:38:00 +03:00
ramox81 61e5271055 Keep wipeout frames continuous 2026-09-11 17:27:34 +03:00
Karim Jerbi 0ad31ece6f fix(render): correct polyline segment widths, flat arc end caps, and zero-width endpoints 2026-09-10 12:43:25 +01:00
Karim Jerbi ed177cbf25 Host wide polyline quads on their 3D plane instead of billboarding in screen space 2026-09-09 14:23:10 +01:00
Karim Jerbi 76e1610dcc fix(render): render wide polyline segments as flat 2D rectangles instead of rounded pill shapes 2026-09-09 13:44:57 +01:00
Karim Jerbi 9bbc5c3182 feat(render): render thick and tapered analytical arcs directly on GPU
- Repurpose CircleInstance center_high.w and params.w for start_width and end_width (preserving exact 128-byte stride)
- Route wide polylines, tapered polylines with bulges, and donuts through split_mixed_polyline into GPU analytical arc instances
- Compute physical annular bands, width tapers, and round end caps in circle.wgsl using world-space distances to prevent 3D perspective foreshortening distortion
- Expand bounding quad margins dynamically with grazing-angle compensation to eliminate clipping
- Relax pick_tris check in wire classification and partition routines so wide entities retain CPU picking while drawing analytically
- Add unit and hardware GPU integration tests, including tilted 3D perspective rendering verification
2026-09-09 13:02:02 +01:00
Karim Jerbi 0425f979f9 feat(render): GPU analytical rendering for circles, arcs, and ellipses
- Render planar circles, circular arcs, ellipses, and elliptical arcs analytically via GPU-instanced screen-space quads and WGSL shaders.
- Implement exact arc sweep clamping with round end caps matching the CAD wire shader.
- Implement robust Newton-Raphson closest-point solver for ellipses with isotropic screen-space derivative anti-aliasing.
- Integrate into wire pipeline and PersistentWireArena upload paths.
- Remove unused mesh_volume_centroid function in doc_api.
2026-09-07 13:50:12 +01:00
Hakan Seven bf4614856c Merge PR #1023: preserve minified text strokes
Keep adaptive sampling in both text shaders with compact sampling loops. Validate shader derivatives and existing text rendering, including GPU pipeline creation.

Closes #964
2026-09-06 21:04:14 +03:00
codallos 995b25ae51 Fix SDF text minification artifacts 2026-09-05 22:30:16 -06:00
PanosandClaude Opus 5 6599b82776 perf: store block-wire segments once instead of six times
The layout-switch OOM names its buffer: `Buffer with 'block_wire.vertices'
label is invalid`, right after `uncaptured wgpu error #1 … Out of Memory`.
That buffer is the largest thing this renderer allocates, and five sixths
of it is duplication.

A segment reaches the shader once per corner of its quad, and the packed
path satisfies that by writing the whole 60-byte record six times —
360 bytes a segment — with `vs_main` recovering the corner from
`vertex_index % 6`. Six identical copies, on a 2 GB card.

`block_wire_storage.wgsl` puts the segments in a read-only storage buffer
indexed by `vertex_index / 6` instead, so each record is stored once. The
geometry vertex buffer disappears; the placements move to slot 0 and the
segments arrive through the definition's bind group, which becomes
per-chunk because each chunk binds its own slice.

This is the pattern `wire_indexed.wgsl` already uses for per-wire
constants, down to the capability gate: `supports_wire_storage` asks for
exactly one vertex-stage storage binding, which is exactly what this
needs. Where it is false — WebGL, the forced compatibility renderer — the
packed shader and its vertex buffer are built as before.

`Segment` is declared with scalar members rather than `vec3<f32>`, which
would align to 16 in storage and reintroduce the padding this removes. A
test validates the shader through naga and asserts the struct's stride
equals `size_of::<BlockWireVertex>()`, because a layout mismatch would
otherwise surface only as garbage geometry on a real device.

`block-wire-geometry` reports the bytes uploaded and what the packed path
would have taken, so the saving is measured rather than assumed.

The cache value becomes `Arc<Vec<BlockGeometryChunk>>` while keeping the
translation-aware key from #1006 — both modes still have to invalidate
when the base instance moves, because the records hold its world
coordinates either way. `const_bgl` and the mode are decided together
when the pipeline is built, so they travel as one `BlockWireTarget`
rather than pushing `from_wires` past the argument limit.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-05 18:53:09 +03:00
Hakan Seven 2cd1d36661 fix(render): match model lineweight preview curve 2026-09-02 23:28:34 +03:00
Hakan Seven edbc4d8ff8 fix(render): correct lineweight display scaling
Remove the global display boost and scale paper-space lineweights with the current sheet zoom across wire, block-wire, and hatch paths.

Fixes #962
2026-09-02 22:32:53 +03:00
Hakan Seven fd801fac1b fix(hatch): render weighted pattern strokes
Show styled boundaries only while selected.\n\nRefs #821
2026-08-25 22:44:51 +03:00
Hakan Seven 7293bec1b9 fix(point): preserve relative marker sizing
Keep rendering, picking, block transforms, and plotted output on the
same viewport-relative PDSIZE geometry without overloading wire width
fields.
2026-08-22 22:22:01 +03:00
ramox81 c5fe70627a Honor point display geometry and sizing 2026-08-22 17:18:30 +03:00
Hakan Seven 44efb8fd53 feat(frame): complete frame controls
Preserve frame geometry for selection while separating viewport and plot visibility across supported reference entities.

Refs #642
2026-08-20 23:37:02 +03:00
Hakan Seven 5b9fffdfba fix(hatch): clip fill with kernel mesh
Resolve boundary topology before rendering so corner-aligned pattern rows cannot flip shader parity. Chunk indexed geometry to device buffer limits and retain the texture compatibility transport.

Refs #489
2026-08-13 00:29:03 +03:00
Hakan Seven 5e8221f8f1 perf(render): keep solid meshes resident
Keep all solid geometry GPU-resident during navigation. Use vertex-rate instancing, compact untextured vertices, vertex-cache ordering, and cached silhouette sources without culling geometry.
2026-08-12 16:02:10 +03:00
Hakan Seven 15ab027d70 fix(scene): preserve viewport settings
Reuse full VPort records during camera and tile synchronization so
navigation cannot replace file-defined display state with defaults.

Honor image, ground, IBL, and sun-backed sky parameters in
background rendering.
2026-08-12 13:11:12 +03:00
Hakan Seven 4fd9b98da4 perf(render): instance block geometry
Share source buffers across block placements and render nested content with GPU instance transforms.\n\nChunk silhouettes and compact mesh material data so large drawings stay under device buffer limits and remain responsive.
2026-08-12 02:33:10 +03:00
Hakan Seven a1f64d7663 fix(render): restore solid surface rendering
Keep viewport styles from disabling selected shaded modes.\n\nPack mesh shader inputs to stay within WebGL limits.
2026-08-11 15:44:40 +03:00
Hakan Seven c45daeffb6 feat(render): add scene environment pipeline 2026-08-05 23:42:18 +03:00
Hakan Seven b667eeeb05 refactor(render): unify scene rendering paths
Route model, paper, viewport and nested block content through one traversal while preserving leaf renderers. Carry decoded material state into mesh shading and harden solid geometry conversion.
2026-08-05 21:44:59 +03:00
Hakan Seven 53cf31f33d feat(web): unify fonts and refine viewcube
Preload one language-aware font resource across the interface, drawing text, and navigation labels.\n\nRender the navigation cube, ring, outlines, and labels through a 4x MSAA target.
2026-08-03 15:28:51 +03:00
Hakan Seven 8e2b67bfa5 fix(hatch): delay complex pattern LOD
Keep every pattern family visible until all projected spacings
become sub-pixel, then switch the hatch to solid.

Refs #569
2026-07-29 16:50:16 +03:00
Hakan Seven d80637cda7 refactor(hatch): unify capability backends
Keep storage and texture transports behind one renderer lifecycle so Pipeline no longer branches by backend.
2026-07-29 13:40:46 +03:00
Hakan Seven 93b9a840ff refactor(renderer): select paths by GPU limits
Keep storage fast paths on capable adapters and use packed or texture fallbacks only when device limits require them.\n\nCompact mesh-edge varyings to avoid WebGL shader rejection.
2026-07-29 12:49:41 +03:00
Hakan Seven 4887a53d66 perf(render): batch and cull mesh instances
Share repeated block geometry across GPU instances.\n\nPatch changed mesh chunks and cull large batches with indirect draws.
2026-07-27 01:11:21 +03:00
Hakan Seven 6fb68d1c7c feat(scene): integrate DWG object data 2026-07-26 23:38:38 +03:00
Hakan Seven eb23715605 feat(scene): integrate standard DWG data 2026-07-26 22:30:14 +03:00