forgecad 0.10.1 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/assets/{AdminPage-DcCnj0qo.js → AdminPage-CHY6ZN-p.js} +1 -1
  2. package/dist/assets/{BenchmarkPage-BVEpJSVk.js → BenchmarkPage-BcRT5iGN.js} +1 -1
  3. package/dist/assets/{BlogPage-DHaGP50_.js → BlogPage-BssBbnb-.js} +1 -1
  4. package/dist/assets/{DocsPage-CDoxHkz8.js → DocsPage-DsvdiRNK.js} +1 -1
  5. package/dist/assets/{EditorApp-BJ0Dloyh.js → EditorApp-Bfd3jbtC.js} +18 -16
  6. package/dist/assets/{EmbedViewer-CRKZbY0y.js → EmbedViewer-D5t8WamV.js} +3 -3
  7. package/dist/assets/{LandingPageProofDriven-BxHkYRE7.js → LandingPageProofDriven-DbN7o-Be.js} +1 -1
  8. package/dist/assets/{LegalPage-B-u6FrVv.js → LegalPage-DNGrrY0p.js} +1 -1
  9. package/dist/assets/{PricingPage-CzpZ6-Ce.js → PricingPage-Nczr3pRz.js} +1 -1
  10. package/dist/assets/{SettingsPage-CIZSSAd0.js → SettingsPage-DZlyu4d4.js} +1 -1
  11. package/dist/assets/{app-DaTMg3nH.js → app-C9ct2hRD.js} +1154 -368
  12. package/dist/assets/{scalar-sampling-budget-prBw_s8t.js → backendInit-ymjonyQp.js} +84920 -78304
  13. package/dist/assets/cli/{render-DPf4AYJK.js → render-B_0lQwKU.js} +35 -179
  14. package/dist/assets/{constructionHistoryWorker-AwMMWSxg.js → constructionHistoryWorker-CZ42Dksy.js} +8058 -1225
  15. package/dist/assets/{evalWorker-CjZZWRWW.js → evalWorker-C2pm8LHP.js} +21596 -14770
  16. package/dist/assets/{forgecad_geometry-Dgceylq9.js → forgecad_geometry-BlMtqluF.js} +120 -1
  17. package/dist/assets/{forgecad_geometry_bg-dD4RNQF1.wasm → forgecad_geometry_bg-BllP_WiL.wasm} +0 -0
  18. package/dist/assets/{inspectWorker-CZsCFtQT.js → inspectWorker-D5T5VbfK.js} +31375 -32603
  19. package/dist/assets/{jointPose-DzQOViQH.js → jointPose-4r8ed8_5.js} +1 -1
  20. package/dist/assets/{manifold-K1SkarlQ.js → manifold-5PP1eGLN.js} +1 -1
  21. package/dist/assets/{manifold-DgXo0T5P.js → manifold-C4r6B-XY.js} +2 -2
  22. package/dist/assets/{manifold-BYlzU521.js → manifold-DjBkyIc8.js} +1 -1
  23. package/dist/assets/{reportWorker-B9nWwSrB.js → reportWorker-CwenM7wB.js} +45719 -44425
  24. package/dist/cli/render.html +1 -1
  25. package/dist/docs/index.html +1 -1
  26. package/dist/docs-raw/CLI.md +27 -15
  27. package/dist/docs-raw/generated/assembly.md +1 -1
  28. package/dist/docs-raw/generated/concepts.md +1 -1
  29. package/dist/docs-raw/generated/core.md +1 -1
  30. package/dist/docs-raw/generated/lib.md +1 -1
  31. package/dist/docs-raw/generated/sdf.md +2 -2
  32. package/dist/docs-raw/guides/simready-quickstart.md +3 -1
  33. package/dist/index.html +1 -1
  34. package/dist/sitemap.xml +15 -15
  35. package/dist-cli/{check-compiler-II7NLPAB.js → check-compiler-SP7FAL7R.js} +1 -1
  36. package/dist-cli/{check-query-propagation-7462TR3R.js → check-query-propagation-BRLSHP22.js} +1 -1
  37. package/dist-cli/{chunk-UWTJCGXF.js → chunk-RQQ42YCP.js} +50429 -43409
  38. package/dist-cli/forgecad.js +3017 -1390
  39. package/dist-cli/{forgecad_geometry-QOQIIP53.js → forgecad_geometry-7TVSNVUB.js} +119 -0
  40. package/dist-cli/forgecad_geometry_bg.wasm +0 -0
  41. package/dist-skill/CONTEXT.md +13 -13
  42. package/dist-skill/docs/API/core/concepts.md +1 -1
  43. package/dist-skill/docs/CLI.md +27 -15
  44. package/dist-skill/docs/generated/assembly.md +1 -1
  45. package/dist-skill/docs/generated/core.md +1 -1
  46. package/dist-skill/docs/generated/lib.md +1 -1
  47. package/dist-skill/docs/generated/sdf.md +2 -2
  48. package/examples/api/gyroid-voronoi-blend.forge.js +1 -1
  49. package/examples/api/organic-noise-sculpture.forge.js +1 -1
  50. package/examples/api/sdf-circular-array-knurling.forge.js +1 -1
  51. package/examples/api/{sdf-custom-raymarch.forge.js → sdf-custom-field-mesh-preview.forge.js} +3 -4
  52. package/examples/api/sdf-materialize-tree.forge.js +2 -2
  53. package/examples/api/sdf-plain-return.forge.js +3 -2
  54. package/examples/api/sdf-shapes.forge.js +2 -2
  55. package/examples/api/sdf-surface-basket-weave.forge.js +2 -2
  56. package/examples/generative/twisted-lattice-tower.forge.js +1 -1
  57. package/examples/generative/voronoi-lampshade.forge.js +1 -1
  58. package/package.json +2 -2
  59. package/dist/assets/manifold-CzYf_iub.js +0 -3023
@@ -1,8 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { D as DoubleSide, cE as initSolverWasm, cD as initKernel, S as Scene, cF as BoxGeometry, bW as MeshStandardMaterial, a4 as BackSide, b7 as PointLight, M as Mesh, aa as MeshBasicMaterial, cG as localAabbPlaneRelation, h as Vector2, cH as ShapeUtils, cI as analyzePhysicalConnectivity, g as Vector3, $ as Matrix4, cJ as Frustum, G as Box3, a0 as MathUtils, cK as meshContactDataFor, cL as AabbSpatialIndex, cM as detectPhysicalContact, cN as resolveThicknessInspectionOptions, R as Raycaster, cO as thicknessColor, cP as thicknessClass, a$ as BufferAttribute, cQ as roughnessClassForAngle, cR as resolveRoughnessInspectionOptions, cS as roughnessColorForAngle, cT as roughnessScoreForAngle, cU as activateBackend, e as Color, ba as COMPARISON_COLORS, ay as resolveForgeRenderStyle, by as getRenderStylePreset, ax as setParamOverrides, bl as runScript, cn as scanProxyGridForBounds, cV as Group, be as shapeToGeometry, bm as MeshPhysicalMaterial, bw as AdditiveBlending, bB as scanMaterialShellColor, cW as createScanProxyGeometry, aO as LineBasicMaterial, bA as NormalBlending, bn as LineSegments, aN as BufferGeometry, P as PerspectiveCamera, ck as DEFAULT_VIEW_CONFIG, bs as worldAuthorPlaneToLocal, cX as resolveSectionHatchMetrics, cv as buildGeometryComparisonPointCloud, ct as triangleSoupFromMeshes, O as OrthographicCamera, k as ShaderMaterial, bH as ZEBRA_STRIPE_FRAGMENT_SHADER, bI as ZEBRA_STRIPE_VERTEX_SHADER, bC as ZEBRA_STRIPE_SOFTNESS, bD as ZEBRA_STRIPE_SCALE, bE as ZEBRA_LIGHT_COLOR, bF as ZEBRA_DARK_COLOR, bG as ZEBRA_ACCENT_COLOR, bx as geometryWithVisibleVertexColors, cY as intersectWithPlane, cZ as setActiveBackend, W as WebGLRenderer, A as ACESFilmicToneMapping, c as SRGBColorSpace, c_ as parseCameraCliSpec, c$ as PMREMGenerator, b0 as CanvasTexture, b1 as Object3D, b2 as FogExp2, b3 as Fog, b4 as AmbientLight, b8 as DirectionalLight, b5 as HemisphereLight, aI as findJointAnimationClip, p as Plane, bL as SURFACE_FIELD_FRAGMENT_SHADER, bM as SURFACE_FIELD_VERTEX_SHADER, bK as scanMaterialLayerStyles, bJ as SCAN_PROXY_LAYER_STYLES, Y as Vector4, bZ as SDF_RAYMARCH_PROXY_VERTEX_SHADER, bY as buildSdfRaymarchFragmentShader, aJ as resolveJointAnimation, aK as resolveJointViewValues, bR as ROUGHNESS_COLORS, d0 as PointsMaterial, d1 as Points, b9 as heatPointsForSide, d2 as analyzeCollisionIntersections, d3 as serializeCollisionFinding, d4 as summarizeThicknessSamples, bQ as THICKNESS_GRADIENT_COLORS, d5 as THICKNESS_COLORS, b6 as SpotLight, c1 as CylinderGeometry, d6 as TorusGeometry, bO as CatmullRomCurve3, bP as TubeGeometry, cz as resolveScalarSceneSampleBudget, bf as buildComparisonHeatPatchGeometry, bg as EdgesGeometry, d7 as SphereGeometry, d8 as ConeGeometry, bb as comparisonHeatDepthTest, bc as comparisonHeatEdgeOpacity, bd as comparisonHeatPatchOpacity, cB as comparisonCandidateContextOpacity, d9 as DEFAULT_COMPARISON_CANDIDATE_OPACITY } from "../scalar-sampling-budget-prBw_s8t.js";
5
- import { m as mergeViewportRenderSceneStates, v as validateJointOverrides, b as buildBaseJointValues, p as parseRenderSceneCliSpec, g as getSceneObjectTreePath } from "../jointPose-DzQOViQH.js";
4
+ import { D as DoubleSide, a as Scene, bx as BoxGeometry, c2 as MeshStandardMaterial, a5 as BackSide, b8 as PointLight, M as Mesh, ab as MeshBasicMaterial, cJ as localAabbPlaneRelation, i as Vector2, cK as ShapeUtils, cL as analyzePhysicalConnectivity, h as Vector3, a0 as Matrix4, cM as Frustum, J as Box3, a1 as MathUtils, cN as meshContactDataFor, cO as AabbSpatialIndex, cP as detectPhysicalContact, cQ as resolveThicknessInspectionOptions, R as Raycaster, cR as thicknessColor, cS as thicknessClass, b0 as BufferAttribute, cT as roughnessClassForAngle, cU as resolveRoughnessInspectionOptions, cV as roughnessColorForAngle, cW as roughnessScoreForAngle, cI as initBackendForEvaluation, f as Color, bb as COMPARISON_COLORS, az as resolveForgeRenderStyle, bG as getRenderStylePreset, ay as setParamOverrides, bm as runScript, cs as scanProxyGridForBounds, cX as Group, bf as shapeToGeometry, bn as MeshPhysicalMaterial, bE as AdditiveBlending, bJ as scanMaterialShellColor, cY as createScanProxyGeometry, aP as LineBasicMaterial, bI as NormalBlending, bo as LineSegments, P as PerspectiveCamera, cp as DEFAULT_VIEW_CONFIG, bt as worldAuthorPlaneToLocal, cZ as resolveSectionHatchMetrics, cA as buildGeometryComparisonPointCloud, cy as triangleSoupFromMeshes, O as OrthographicCamera, l as ShaderMaterial, bP as ZEBRA_STRIPE_FRAGMENT_SHADER, bQ as ZEBRA_STRIPE_VERTEX_SHADER, bK as ZEBRA_STRIPE_SOFTNESS, bL as ZEBRA_STRIPE_SCALE, bM as ZEBRA_LIGHT_COLOR, bN as ZEBRA_DARK_COLOR, bO as ZEBRA_ACCENT_COLOR, bF as geometryWithVisibleVertexColors, c_ as intersectWithPlane, c$ as setActiveBackend, W as WebGLRenderer, A as ACESFilmicToneMapping, d as SRGBColorSpace, d0 as parseCameraCliSpec, d1 as PMREMGenerator, b1 as CanvasTexture, b2 as Object3D, b3 as FogExp2, b4 as Fog, b5 as AmbientLight, b9 as DirectionalLight, b6 as HemisphereLight, aJ as findJointAnimationClip, q as Plane, bT as SURFACE_FIELD_FRAGMENT_SHADER, bU as SURFACE_FIELD_VERTEX_SHADER, bS as scanMaterialLayerStyles, bR as SCAN_PROXY_LAYER_STYLES, aK as resolveJointAnimation, aL as resolveJointViewValues, aO as BufferGeometry, bZ as ROUGHNESS_COLORS, d2 as PointsMaterial, d3 as Points, ba as heatPointsForSide, d4 as analyzeCollisionIntersections, d5 as serializeCollisionFinding, d6 as summarizeThicknessSamples, bY as THICKNESS_GRADIENT_COLORS, d7 as THICKNESS_COLORS, b7 as SpotLight, c6 as CylinderGeometry, d8 as TorusGeometry, bW as CatmullRomCurve3, bX as TubeGeometry, cE as resolveScalarSceneSampleBudget, bg as buildComparisonHeatPatchGeometry, bh as EdgesGeometry, d9 as SphereGeometry, da as ConeGeometry, bc as comparisonHeatDepthTest, bd as comparisonHeatEdgeOpacity, be as comparisonHeatPatchOpacity, cG as comparisonCandidateContextOpacity, db as DEFAULT_COMPARISON_CANDIDATE_OPACITY } from "../backendInit-ymjonyQp.js";
5
+ import { m as mergeViewportRenderSceneStates, v as validateJointOverrides, b as buildBaseJointValues, p as parseRenderSceneCliSpec, g as getSceneObjectTreePath } from "../jointPose-4r8ed8_5.js";
6
6
  const CAD_MATERIAL_PROPS = {
7
7
  color: 6003669,
8
8
  metalness: 0.05,
@@ -18,10 +18,6 @@ const EDGE_MATERIAL_PROPS = {
18
18
  transparent: true,
19
19
  opacity: 0.6
20
20
  };
21
- async function init() {
22
- await initSolverWasm();
23
- await initKernel();
24
- }
25
21
  class RoomEnvironment extends Scene {
26
22
  constructor() {
27
23
  super();
@@ -2011,7 +2007,7 @@ function summarizeSceneGeometry(entries) {
2011
2007
  const max = [-Infinity, -Infinity, -Infinity];
2012
2008
  let volume = 0;
2013
2009
  for (const entry of entries) {
2014
- const bb = entry.shape ? entry.shape.boundingBox() : entry.sdf ? padSdfBounds(entry.sdf.bounds) : null;
2010
+ const bb = entry.shape ? entry.shape.boundingBox() : null;
2015
2011
  if (!bb) continue;
2016
2012
  for (let axis = 0; axis < 3; axis += 1) {
2017
2013
  min[axis] = Math.min(min[axis], bb.min[axis]);
@@ -2030,14 +2026,6 @@ function summarizeSceneGeometry(entries) {
2030
2026
  }
2031
2027
  return { bbox: { min, max }, volume };
2032
2028
  }
2033
- function padSdfBounds(bounds) {
2034
- const diagonal = Math.hypot(bounds.max[0] - bounds.min[0], bounds.max[1] - bounds.min[1], bounds.max[2] - bounds.min[2]);
2035
- const pad = Math.max(1, diagonal * 0.04);
2036
- return {
2037
- min: [bounds.min[0] - pad, bounds.min[1] - pad, bounds.min[2] - pad],
2038
- max: [bounds.max[0] + pad, bounds.max[1] + pad, bounds.max[2] + pad]
2039
- };
2040
- }
2041
2029
  function rendererContextKeyFor(pixelRatio) {
2042
2030
  const antialias = pixelRatio <= 1.25;
2043
2031
  return `aa:${antialias ? "1" : "0"};preserve:0;logDepth:0`;
@@ -2115,98 +2103,6 @@ function getStudioEnvironment(r) {
2115
2103
  pmrem.dispose();
2116
2104
  return studioEnvTexture;
2117
2105
  }
2118
- const BLACK_RGB = [0, 0, 0];
2119
- const MAX_SDF_CLIP_PLANES = 8;
2120
- function clamp01(value) {
2121
- return Math.min(1, Math.max(0, value));
2122
- }
2123
- function colorToRgb(value, fallback = "#5b9bd5") {
2124
- const color = new Color(value || fallback);
2125
- return [color.r, color.g, color.b];
2126
- }
2127
- function setSdfClipPlaneUniforms(target, clippingPlanes) {
2128
- const count = Math.min(clippingPlanes.length, MAX_SDF_CLIP_PLANES);
2129
- for (let i = 0; i < MAX_SDF_CLIP_PLANES; i += 1) {
2130
- const plane = clippingPlanes[i];
2131
- target[i].set((plane == null ? void 0 : plane.normal.x) ?? 0, (plane == null ? void 0 : plane.normal.y) ?? 0, (plane == null ? void 0 : plane.normal.z) ?? 0, (plane == null ? void 0 : plane.constant) ?? 0);
2132
- }
2133
- return count;
2134
- }
2135
- function createSdfRaymarchRuntime(entry, clippingPlanes) {
2136
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2137
- if (!entry.sdf) {
2138
- throw new Error("Internal render error: createSdfRaymarchRuntime() requires an SDF entry.");
2139
- }
2140
- const sdf = entry.sdf;
2141
- const bounds = padSdfBounds(sdf.bounds);
2142
- const materialAlpha = ((_a = sdf.materialProps) == null ? void 0 : _a.opacity) ?? 1;
2143
- const leaf = {
2144
- node: sdf.node,
2145
- color: colorToRgb(entry.color ?? sdf.colorHex),
2146
- alpha: clamp01(Math.min(entry.opacity, materialAlpha)),
2147
- emissive: ((_b = sdf.materialProps) == null ? void 0 : _b.emissive) ? colorToRgb(sdf.materialProps.emissive, "#000000") : BLACK_RGB,
2148
- emissiveIntensity: ((_c = sdf.materialProps) == null ? void 0 : _c.emissiveIntensity) ?? 0,
2149
- metalness: clamp01(((_d = sdf.materialProps) == null ? void 0 : _d.metalness) ?? 0.05),
2150
- roughness: clamp01(((_e = sdf.materialProps) == null ? void 0 : _e.roughness) ?? 0.35),
2151
- clearcoat: clamp01(((_f = sdf.materialProps) == null ? void 0 : _f.clearcoat) ?? 0.1),
2152
- clearcoatRoughness: clamp01(((_g = sdf.materialProps) == null ? void 0 : _g.clearcoatRoughness) ?? 0.4),
2153
- transmission: clamp01(((_h = sdf.materialProps) == null ? void 0 : _h.transmission) ?? 0),
2154
- reflectivity: clamp01(((_i = sdf.materialProps) == null ? void 0 : _i.reflectivity) ?? 0.5)
2155
- };
2156
- const clipPlaneUniforms = Array.from({ length: MAX_SDF_CLIP_PLANES }, () => new Vector4());
2157
- const material = new ShaderMaterial({
2158
- vertexShader: SDF_RAYMARCH_PROXY_VERTEX_SHADER,
2159
- fragmentShader: buildSdfRaymarchFragmentShader([leaf]),
2160
- side: BackSide,
2161
- transparent: leaf.alpha < 1 || leaf.transmission > 0,
2162
- depthTest: true,
2163
- depthWrite: leaf.alpha >= 1 && leaf.transmission <= 0,
2164
- uniforms: {
2165
- uCameraMatrixWorld: { value: new Matrix4() },
2166
- uViewProjectionMatrix: { value: new Matrix4() },
2167
- uSceneMin: { value: new Vector3() },
2168
- uSceneMax: { value: new Vector3() },
2169
- uClipPlaneCount: { value: 0 },
2170
- uClipPlanes: { value: clipPlaneUniforms },
2171
- uHoverLeafIndex: { value: -1 },
2172
- uHoverColor: { value: new Vector3() },
2173
- uHoverIntensity: { value: 0 },
2174
- uIsOrthographic: { value: 0 }
2175
- }
2176
- });
2177
- const size = [
2178
- Math.max(bounds.max[0] - bounds.min[0], 1e-3),
2179
- Math.max(bounds.max[1] - bounds.min[1], 1e-3),
2180
- Math.max(bounds.max[2] - bounds.min[2], 1e-3)
2181
- ];
2182
- const center = [
2183
- (bounds.min[0] + bounds.max[0]) * 0.5,
2184
- (bounds.min[1] + bounds.max[1]) * 0.5,
2185
- (bounds.min[2] + bounds.max[2]) * 0.5
2186
- ];
2187
- const mesh = new Mesh(new BoxGeometry(...size), material);
2188
- mesh.position.set(center[0], center[1], center[2]);
2189
- mesh.frustumCulled = false;
2190
- return {
2191
- mesh,
2192
- material,
2193
- runtime: { bounds, material, clippingPlanes, clipPlaneUniforms }
2194
- };
2195
- }
2196
- function updateSdfRaymarchUniforms(session) {
2197
- const viewProjection = new Matrix4().multiplyMatrices(session.camera.projectionMatrix, session.camera.matrixWorldInverse);
2198
- const isOrthographic = session.camera.isOrthographicCamera ? 1 : 0;
2199
- for (const renderable of session.renderables) {
2200
- const sdf = renderable.sdfRaymarch;
2201
- if (!sdf) continue;
2202
- sdf.material.uniforms.uCameraMatrixWorld.value.copy(session.camera.matrixWorld);
2203
- sdf.material.uniforms.uViewProjectionMatrix.value.copy(viewProjection);
2204
- sdf.material.uniforms.uSceneMin.value.set(sdf.bounds.min[0], sdf.bounds.min[1], sdf.bounds.min[2]);
2205
- sdf.material.uniforms.uSceneMax.value.set(sdf.bounds.max[0], sdf.bounds.max[1], sdf.bounds.max[2]);
2206
- sdf.material.uniforms.uClipPlaneCount.value = setSdfClipPlaneUniforms(sdf.clipPlaneUniforms, sdf.clippingPlanes);
2207
- sdf.material.uniforms.uIsOrthographic.value = isOrthographic;
2208
- }
2209
- }
2210
2106
  function applyDirectionCamera(session, dir, distanceOverride) {
2211
2107
  const d = normalizeCameraDirection(dir);
2212
2108
  const fov = session.camera instanceof PerspectiveCamera ? session.camera.fov : 45;
@@ -2222,7 +2118,6 @@ function applyDirectionCamera(session, dir, distanceOverride) {
2222
2118
  }
2223
2119
  function renderCurrentRgb(session) {
2224
2120
  const r = getRenderer(session.size, session.pixelRatio);
2225
- updateSdfRaymarchUniforms(session);
2226
2121
  r.render(session.scene, session.camera);
2227
2122
  return captureRenderedPng(session.size);
2228
2123
  }
@@ -2423,7 +2318,6 @@ function renderSessionCoverageImageData(session, color) {
2423
2318
  () => withSolidOnlyVisibility(
2424
2319
  session,
2425
2320
  () => withTemporarySceneBackground(session, new Color(0), () => {
2426
- updateSdfRaymarchUniforms(session);
2427
2321
  r.clear(true, true, true);
2428
2322
  r.render(session.scene, session.camera);
2429
2323
  return captureRenderedImageData(session.size);
@@ -2737,7 +2631,6 @@ function renderCurrentDepth(session) {
2737
2631
  const png = withSolidOnlyVisibility(
2738
2632
  session,
2739
2633
  () => withTemporarySceneBackground(session, new Color(0), () => {
2740
- updateSdfRaymarchUniforms(session);
2741
2634
  r.render(session.scene, session.camera);
2742
2635
  return captureRenderedPng(session.size);
2743
2636
  })
@@ -2774,7 +2667,6 @@ function renderCurrentNormals(session) {
2774
2667
  return withSolidOnlyVisibility(
2775
2668
  session,
2776
2669
  () => withTemporarySceneBackground(session, new Color(0), () => {
2777
- updateSdfRaymarchUniforms(session);
2778
2670
  r.render(session.scene, session.camera);
2779
2671
  return captureRenderedPng(session.size);
2780
2672
  })
@@ -2805,7 +2697,6 @@ function renderCurrentZebra(session) {
2805
2697
  return withSolidOnlyVisibility(
2806
2698
  session,
2807
2699
  () => withTemporarySceneBackground(session, new Color(0), () => {
2808
- updateSdfRaymarchUniforms(session);
2809
2700
  r.render(session.scene, session.camera);
2810
2701
  return captureRenderedPng(session.size);
2811
2702
  })
@@ -2899,7 +2790,6 @@ function renderCurrentMask(session) {
2899
2790
  const png = withSolidOnlyVisibility(
2900
2791
  session,
2901
2792
  () => withTemporarySceneBackground(session, new Color(0), () => {
2902
- updateSdfRaymarchUniforms(session);
2903
2793
  r.render(session.scene, session.camera);
2904
2794
  return captureRenderedPng(session.size);
2905
2795
  })
@@ -3202,7 +3092,6 @@ function renderCurrentRig(session) {
3202
3092
  session.scene.add(group);
3203
3093
  try {
3204
3094
  const png = withTemporarySceneBackground(session, new Color(132105), () => {
3205
- updateSdfRaymarchUniforms(session);
3206
3095
  r.render(session.scene, session.camera);
3207
3096
  return captureRenderedPng(session.size);
3208
3097
  });
@@ -3243,9 +3132,7 @@ function baseObjectIdForConnectivityEntry(entryId, renderableIds) {
3243
3132
  }
3244
3133
  function buildThicknessRaycastConnectivityContext(session) {
3245
3134
  const report = analyzeSessionConnectivity(session);
3246
- const renderableById = new Map(
3247
- session.renderables.filter((renderable) => !renderable.sdfRaymarch).map((renderable) => [renderable.id, renderable])
3248
- );
3135
+ const renderableById = new Map(session.renderables.map((renderable) => [renderable.id, renderable]));
3249
3136
  const renderableIds = new Set(renderableById.keys());
3250
3137
  const neighborIdsByObjectId = /* @__PURE__ */ new Map();
3251
3138
  for (const edge of report.edges) {
@@ -3326,7 +3213,6 @@ function renderCurrentConnectivity(session, rawReport) {
3326
3213
  const png = withSolidOnlyVisibility(
3327
3214
  session,
3328
3215
  () => withTemporarySceneBackground(session, new Color(0), () => {
3329
- updateSdfRaymarchUniforms(session);
3330
3216
  r.render(session.scene, session.camera);
3331
3217
  return captureRenderedPng(session.size);
3332
3218
  })
@@ -3420,7 +3306,6 @@ function renderCurrentDistance(session) {
3420
3306
  const png = withSolidOnlyVisibility(
3421
3307
  session,
3422
3308
  () => withTemporarySceneBackground(session, new Color(0), () => {
3423
- updateSdfRaymarchUniforms(session);
3424
3309
  r.render(session.scene, session.camera);
3425
3310
  return captureRenderedPng(session.size);
3426
3311
  })
@@ -3551,7 +3436,6 @@ function renderCurrentFloating(session) {
3551
3436
  });
3552
3437
  try {
3553
3438
  const png = withTemporarySceneBackground(session, new Color(0), () => {
3554
- updateSdfRaymarchUniforms(session);
3555
3439
  r.render(session.scene, session.camera);
3556
3440
  return captureRenderedPng(session.size);
3557
3441
  });
@@ -3669,7 +3553,6 @@ function renderCurrentCollisions(session) {
3669
3553
  const png = withSolidOnlyVisibility(
3670
3554
  session,
3671
3555
  () => withTemporarySceneBackground(session, new Color(0), () => {
3672
- updateSdfRaymarchUniforms(session);
3673
3556
  r.render(session.scene, session.camera);
3674
3557
  return captureRenderedPng(session.size);
3675
3558
  })
@@ -3692,7 +3575,7 @@ function inspectionOptionsKey(value) {
3692
3575
  return JSON.stringify(value ?? {});
3693
3576
  }
3694
3577
  function scalarInspectableObjectCount(session) {
3695
- return session.renderables.filter((renderable) => !renderable.sdfRaymarch).length;
3578
+ return session.renderables.length;
3696
3579
  }
3697
3580
  function withSceneSampleBudget(session, options, explicitMaxSamplesPerObject) {
3698
3581
  const sampleBudget = resolveScalarSceneSampleBudget({
@@ -3774,7 +3657,6 @@ function renderScalarPointOverlays(session, overlays) {
3774
3657
  return withSolidOnlyVisibility(
3775
3658
  session,
3776
3659
  () => withTemporarySceneBackground(session, new Color(0), () => {
3777
- updateSdfRaymarchUniforms(session);
3778
3660
  r.render(session.scene, session.camera);
3779
3661
  return captureRenderedPng(session.size);
3780
3662
  })
@@ -3805,10 +3687,6 @@ function getSessionThicknessInspection(session, rawOptions) {
3805
3687
  const raycastConnectivity = buildThicknessRaycastConnectivityContext(session);
3806
3688
  session.renderables.forEach((renderable, index) => {
3807
3689
  const sourceObject = byId.get(renderable.id);
3808
- if (renderable.sdfRaymarch) {
3809
- warnings.push(`${renderable.name}: SDF raymarch objects are not included in mesh thickness inspection.`);
3810
- return;
3811
- }
3812
3690
  const analysis = analyzeThicknessGeometry(renderable.solid.geometry, options, {
3813
3691
  connectedGeometries: connectedThicknessGeometriesFor(raycastConnectivity, renderable)
3814
3692
  });
@@ -3906,10 +3784,6 @@ function getSessionRoughnessInspection(session, rawOptions) {
3906
3784
  const points = [];
3907
3785
  const overlays = [];
3908
3786
  session.renderables.forEach((renderable, index) => {
3909
- if (renderable.sdfRaymarch) {
3910
- warnings.push(`${renderable.name}: SDF raymarch objects are not included in mesh roughness inspection.`);
3911
- return;
3912
- }
3913
3787
  const analysis = analyzeRoughnessGeometry(renderable.solid.geometry, options);
3914
3788
  const bbox = bboxFromGeometry(analysis.geometry);
3915
3789
  const sourceObject = byId.get(renderable.id);
@@ -5007,7 +4881,6 @@ function renderCaptureFrame(session, opts) {
5007
4881
  captureMark("capsMs");
5008
4882
  const r = getRenderer(session.size, session.pixelRatio);
5009
4883
  session.scene.updateMatrixWorld(true);
5010
- updateSdfRaymarchUniforms(session);
5011
4884
  r.render(session.scene, session.camera);
5012
4885
  captureMark("renderMs");
5013
4886
  const png = captureRenderedImage(session.size, (opts == null ? void 0 : opts.imageFormat) === "jpeg" ? "jpeg" : "png", (opts == null ? void 0 : opts.jpegQuality) ?? 0.96);
@@ -5143,20 +5016,32 @@ function createSession(code, opts) {
5143
5016
  }
5144
5017
  const focus = (opts == null ? void 0 : opts.focus) ?? null;
5145
5018
  const hide = (opts == null ? void 0 : opts.hide) ?? null;
5146
- const objs = result.objects.map((obj) => {
5019
+ const mappedEntries = result.objects.map((obj) => {
5147
5020
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
5148
5021
  return {
5149
5022
  source: obj,
5150
5023
  shape: obj.shape || (obj.sketch ? obj.sketch.extrude(1) : null),
5151
- sdf: obj.sdf ?? null,
5152
5024
  color: ((_b2 = (_a2 = requestedSceneState == null ? void 0 : requestedSceneState.objects) == null ? void 0 : _a2[obj.id]) == null ? void 0 : _b2.color) ?? obj.color,
5153
5025
  materialProps: obj.materialProps,
5154
5026
  opacity: MathUtils.clamp(((_d2 = (_c2 = requestedSceneState == null ? void 0 : requestedSceneState.objects) == null ? void 0 : _c2[obj.id]) == null ? void 0 : _d2.opacity) ?? ((_e2 = obj.materialProps) == null ? void 0 : _e2.opacity) ?? 1, 0, 1),
5155
5027
  visible: ((_g2 = (_f2 = requestedSceneState == null ? void 0 : requestedSceneState.objects) == null ? void 0 : _f2[obj.id]) == null ? void 0 : _g2.visible) !== false && isFocusVisible(obj, focus, hide)
5156
5028
  };
5157
- }).filter((entry) => entry.shape != null || entry.sdf != null);
5029
+ });
5030
+ const sdfOnlyNames = mappedEntries.filter((entry) => entry.shape == null && entry.visible && entry.source.sdf).map((entry) => entry.source.name);
5031
+ if (sdfOnlyNames.length > 0) {
5032
+ return {
5033
+ ok: false,
5034
+ error: `CLI rendering is mesh-based and cannot raymarch raw SDF fields. ${sdfOnlyNames.length} object(s) returned raw SDFs without mesh geometry: ${sdfOnlyNames.map((name) => `"${name}"`).join(", ")}.
5035
+ Fix one:
5036
+ - Mesh the field in-script: return toShape(mySdf) (or mySdf.toShape())
5037
+ - Export the raw field instead: forgecad export implicit <model.forge.js>`
5038
+ };
5039
+ }
5040
+ const objs = mappedEntries.filter(
5041
+ (entry) => entry.shape != null
5042
+ );
5158
5043
  if (objs.length === 0) {
5159
- return { ok: false, error: "No renderable shape or SDF returned" };
5044
+ return { ok: false, error: "No mesh-backed renderable shape returned" };
5160
5045
  }
5161
5046
  const visibleObjs = objs.filter((entry) => entry.visible);
5162
5047
  if (visibleObjs.length === 0) {
@@ -5166,8 +5051,7 @@ function createSession(code, opts) {
5166
5051
  totalObjects: result.objects.length,
5167
5052
  renderableObjects: objs.length,
5168
5053
  visibleObjects: visibleObjs.length,
5169
- shapeObjects: visibleObjs.filter((entry) => entry.shape != null).length,
5170
- sdfObjects: visibleObjs.filter((entry) => entry.sdf != null).length
5054
+ shapeObjects: visibleObjs.filter((entry) => entry.shape != null).length
5171
5055
  });
5172
5056
  const boundsObjs = selectRenderSceneBoundsEntries(objs);
5173
5057
  const objectVisibility = new Map(objs.map((entry) => [entry.source.id, entry.visible]));
@@ -5361,8 +5245,7 @@ function createSession(code, opts) {
5361
5245
  total: visibleObjs.length,
5362
5246
  id: obj.source.id,
5363
5247
  name: objectLabel,
5364
- hasShape: Boolean(obj.shape),
5365
- hasSdf: Boolean(obj.sdf)
5248
+ hasShape: Boolean(obj.shape)
5366
5249
  });
5367
5250
  const applicableCutPlanes = activeCutPlanes.filter((cutPlane) => !isObjectExcludedFromCutPlane(obj.source, cutPlane)).map(toClippingPlane);
5368
5251
  if (sweep && !isObjectExcludedFromCutPlane(obj.source, { normal: sweep.normal, offset: sweep.from })) {
@@ -5377,9 +5260,8 @@ function createSession(code, opts) {
5377
5260
  let shell;
5378
5261
  let scanProxy;
5379
5262
  let wireMaterial;
5380
- let sdfRaymarch;
5381
5263
  let sectionMesh = null;
5382
- if (obj.shape) {
5264
+ {
5383
5265
  const geometryStart = performance.now();
5384
5266
  const geo = shapeToGeometry(obj.shape);
5385
5267
  debug("renderable:geometry", {
@@ -5489,27 +5371,6 @@ function createSession(code, opts) {
5489
5371
  });
5490
5372
  wire = new LineSegments(geo.edges, wireMaterial);
5491
5373
  sectionMesh = sweep ? buildSectionMeshPayload(obj.source.id, obj.shape, debug, objectLabel) : null;
5492
- } else if (obj.sdf) {
5493
- const sdfStart = performance.now();
5494
- const sdfRenderable = createSdfRaymarchRuntime(obj, applicableCutPlanes);
5495
- debug("renderable:sdf", {
5496
- index: renderableIndex + 1,
5497
- id: obj.source.id,
5498
- name: objectLabel,
5499
- ms: Number((performance.now() - sdfStart).toFixed(1))
5500
- });
5501
- solid = sdfRenderable.mesh;
5502
- solidMaterial = sdfRenderable.material;
5503
- sdfRaymarch = sdfRenderable.runtime;
5504
- wireMaterial = new LineBasicMaterial({
5505
- ...EDGE_MATERIAL_PROPS,
5506
- color: parseColor(obj.color, EDGE_MATERIAL_PROPS.color),
5507
- transparent: true,
5508
- opacity: 0
5509
- });
5510
- wire = new LineSegments(new BufferGeometry(), wireMaterial);
5511
- } else {
5512
- continue;
5513
5374
  }
5514
5375
  root.add(solid);
5515
5376
  if (shell) root.add(shell);
@@ -5533,8 +5394,7 @@ function createSession(code, opts) {
5533
5394
  sourceColor: obj.color ?? "#5b9bd5",
5534
5395
  opacity: obj.opacity,
5535
5396
  sectionMesh,
5536
- sectionCapGroup,
5537
- ...sdfRaymarch ? { sdfRaymarch } : {}
5397
+ sectionCapGroup
5538
5398
  });
5539
5399
  }
5540
5400
  const renderableById = new Map(renderables.map((renderable) => [renderable.id, renderable]));
@@ -5637,8 +5497,7 @@ function createSession(code, opts) {
5637
5497
  debug("session:ready");
5638
5498
  return { ok: true, session };
5639
5499
  }
5640
- async function setup() {
5641
- await init();
5500
+ function setup() {
5642
5501
  setActiveBackend(CLI_DEFAULT_BACKEND);
5643
5502
  window.__forgeCaptureCapabilities = CAPTURE_RUNTIME_CAPABILITIES;
5644
5503
  window.__forgeReady = true;
@@ -5666,9 +5525,8 @@ window.__forgeRender = async (code, opts) => {
5666
5525
  const requestedChannelList = (opts == null ? void 0 : opts.channels) ?? ["rgb"];
5667
5526
  const requestedChannels = new Set(requestedChannelList);
5668
5527
  await emitInspectProgress(opts, { type: "session-start" });
5669
- if (opts == null ? void 0 : opts.activeBackend) {
5670
- await activateBackend(opts.activeBackend);
5671
- }
5528
+ const activeBackend = (opts == null ? void 0 : opts.activeBackend) ?? CLI_DEFAULT_BACKEND;
5529
+ await initBackendForEvaluation(activeBackend);
5672
5530
  const built = createSession(code, {
5673
5531
  size: (opts == null ? void 0 : opts.size) || 1024,
5674
5532
  pixelRatio: (opts == null ? void 0 : opts.pixelRatio) || 1,
@@ -5676,7 +5534,7 @@ window.__forgeRender = async (code, opts) => {
5676
5534
  allFiles: opts == null ? void 0 : opts.allFiles,
5677
5535
  binaryFiles: opts == null ? void 0 : opts.binaryFiles,
5678
5536
  fileName: opts == null ? void 0 : opts.fileName,
5679
- activeBackend: opts == null ? void 0 : opts.activeBackend,
5537
+ activeBackend,
5680
5538
  background: opts == null ? void 0 : opts.background,
5681
5539
  camera: opts == null ? void 0 : opts.camera,
5682
5540
  cameraSpec: opts == null ? void 0 : opts.cameraSpec,
@@ -5708,9 +5566,8 @@ window.__forgeRender = async (code, opts) => {
5708
5566
  disposeSession(session);
5709
5567
  return { ok: false, error: "comparison evidence requires --compare-with <reference> or compareWith(path) in the model." };
5710
5568
  }
5711
- if (comparisonReference.activeBackend) {
5712
- await activateBackend(comparisonReference.activeBackend);
5713
- }
5569
+ const comparisonBackend = comparisonReference.activeBackend ?? activeBackend;
5570
+ await initBackendForEvaluation(comparisonBackend);
5714
5571
  const referenceBuilt = createSession(comparisonReference.code, {
5715
5572
  size: (opts == null ? void 0 : opts.size) || 1024,
5716
5573
  pixelRatio: (opts == null ? void 0 : opts.pixelRatio) || 1,
@@ -5718,7 +5575,7 @@ window.__forgeRender = async (code, opts) => {
5718
5575
  allFiles: comparisonReference.allFiles,
5719
5576
  binaryFiles: comparisonReference.binaryFiles,
5720
5577
  fileName: comparisonReference.fileName,
5721
- activeBackend: comparisonReference.activeBackend ?? (opts == null ? void 0 : opts.activeBackend),
5578
+ activeBackend: comparisonBackend,
5722
5579
  background: opts == null ? void 0 : opts.background,
5723
5580
  renderStyle: opts == null ? void 0 : opts.renderStyle,
5724
5581
  scanGranularity: opts == null ? void 0 : opts.scanGranularity,
@@ -6054,10 +5911,9 @@ window.__forgeRender = async (code, opts) => {
6054
5911
  window.__forgeCaptureInit = async (code, opts) => {
6055
5912
  var _a;
6056
5913
  destroyCaptureSession();
6057
- if (opts == null ? void 0 : opts.activeBackend) {
6058
- await activateBackend(opts.activeBackend);
6059
- }
6060
- const built = createSession(code, opts);
5914
+ const activeBackend = (opts == null ? void 0 : opts.activeBackend) ?? CLI_DEFAULT_BACKEND;
5915
+ await initBackendForEvaluation(activeBackend);
5916
+ const built = createSession(code, { ...opts, activeBackend });
6061
5917
  if (!built.ok) {
6062
5918
  return built;
6063
5919
  }