Skip to content

CAD GPU Manual Transfer

jinho.park.s3 edited this page Oct 8, 2026 · 2 revisions

CAD → GPU transfer: native geometry to an actual mesh

2026-10-08 — Own CAD results to GPU and Loader

Owner-authorized dual delivery. Planner monitors existing Execute GPU, Execute CAD and Execute Loader through the single existing monitor; current cadence and notification preferences stay unchanged. On a completed own CAD change, send exact clean native SHA/immutable parent/API/limits/actual build and source evidence to both consumers once. After sole GPU integration, send exact integrated SHA/current consumer availability to Loader once. Native completion, GPU integration and Loader target adoption are recorded separately; unchanged active work is not repeatedly woken.

Loader owns the new private @barocss/cad-interop package (656); current exports copyCadPreviewPacket, prepareCadPreviewMesh(input,unitsPerMillimeter), encodeCadPreviewGlb. PreviewPacket v0 declares mm/right-handed-Y-up/CCW, original Surface identity/revision/native UV; conversion creates owned display buffers with explicit unit mapping. GLB/Float32 is approximate display geometry, not authoritative native CAD/B-Rep/manufacturing exchange. Native U/V is application data, not automatically normalized texture UV. Own CAD/GPU engines remain authoritative; requested external rendering consumers do not replace either engine.

Loader reports an actual original CAD Surface packet accepted by existing GPU and new package and GLB parsed by actual Three GLTFLoader. Final exact clean package commit/current receipts and sole-GPU integration are pending. Do not infer actual Babylon/Pixi3D load support or hole-face adaptation from that regular Surface flow. Keep already collected tests/validator observations; no new broad repeat campaign.

Native653 a42a0c193d2864b6ca2f211500b0426edf550c98 material-hole mesh (native completion) was delivered once to both GPU and Loader. SoleGPU serial integration follows active654 safe checkpoint; actual Loader mesh-to-adapter adoption remains pending. Original binary64 SurfaceD1/UV/normals and true native Line paths must remain distinct from display triangles/bridges. Loader may stage a bounded adapter after integrated availability, retaining native limits/refusal evidence. CAD655 ray query is active, future exact completion and integrated availability will use the same two-consumer feed.

GPU alone serially reconciles product/shared/root/lock/static/policy commits. Loader reports minimal root/lock delta for GPU handoff and preserves CAD/GPU internal contracts. All development remains local/private; eventual npm publication requires separate authorization. Release0.12.2/inherited render manifest/kiosk/user states unchanged. Broader validation deferred; not-certified/topologyCertified:false/solid:false.

Manual index · CAD ↔ GPU transfer

Availability

Integrated actual source→native surface→packet→GPU path, plus separate six-face box preview. Both engine inputs remain independent.

Last checked: 2026-10-06. Both packages remain private experimental. API snippets use built local ES modules. Save Node snippets at the repository root after building the relevant package. Browser snippets require their stated host/canvas context.

Procedure and example

  1. Evaluate/tessellate the original accepted CAD Surface.
  2. Keep positions in mm, original UV, CCW indices/normals/bounds and source identity/revision.
  3. Select explicit mm-to-scene scale/translation/display/camera.
  4. Validate/compile the real packet in GPU, then mount/update a dedicated mesh renderer.
  5. Retain source/native/packet/options/actual frame identity. Export from original native geometry.
import {tessellateSurface} from './packages/barocss-cad/dist/index.js';
import {compileGpu} from './packages/barocss-gpu/dist/index.js';
const surface = {
  kind: 'surface', id: 'patch', degreeU: 1, degreeV: 1,
  knotsU: [0,0,1,1], knotsV: [0,0,1,1],
  controlPoints: [[[0,0,0],[0,5,0]],[[10,0,0],[10,5,0]]],
  weights: [[1,1],[1,1]],
};
const {packet,report}=tessellateSurface(surface,{countU:3,countV:3,revision:1});
const options={mmToSceneUnit:.1,translate:[-.5,-.25,0],
  color:[.9,.4,.1],background:[.06,.12,.19]};
const result=compileGpu({kind:'mesh',packet,options});
if(!result.ok) throw new Error(result.diagnostics[0].message);
console.log(packet.surfaceId,packet.positions.length/3,result.execution.kind,report.certified);

Expected patch,9 vertices,indexed-mesh,certified false. This CPU example verifies transfer preparation; actual rendered pixels require the browser renderer. Actual #504/#526 browser lineage separately proves the supported integrated consumers.

Coordinate and topology contract

No hidden axis rotation: native XYZ are kept under right-handed-y-up packet convention. A tool may author a shape along Z; that does not infer a different up axis. Uniform positive scale and translation are explicit GPU options. Camera changes view only. Positions/normals use flat XYZ arrays; parameters use UV pairs; index(i,j)=i*countV+j. Cell triangles are (a,b,c),(b,d,c) for increasing U/V. Normals are averaged triangle preview normals; sampled bounds differ from control-point or certified surface bounds.

The six-face native box uses actual source/FaceBundle/shell/solid provenance and24 vertices/12 triangles with recorded per-face ranges. It does not weld into a generic topological GPU solid. Packet composite identity must not be mistaken for a native Surface ID when saving a project.

Errors and lifetime

Tessellation rejects collapsed triangles or cancelling/incompatible normals; GPU rejects malformed/bad-winding or Float32-collapsed packets. Host adoption is atomic across source/native/packet/report/GPU state. Invalid candidates retain accepted data/frame if context remains usable. Dispose the old renderer/context on successful example replacement; context loss requires remounting.

IGES comes from original NURBS geometry. Triangles, PNGs and sampled deviation are not editable CAD intent or closed-solid proof. Independent analytic fixtures can test individual packages but cannot stand in for real CAD-output-to-GPU interoperability evidence.

Evidence and related work

#504 actual transfer · #526 actual six-face box · CAD preview · GPU packet.

Clone this wiki locally