v1.0.2 — Point-cloud rendering pipeline (closes #28)
Highlights
Adds a Metal point-sprite rendering pipeline so ViewportBody.vertices can be drawn as visible disc-masked points, gated by a new BodyPrimitiveKind.point discriminator. Closes #28.
This unblocks OCCTMCP's add_scene_primitive(pointCloud) to lift its 256-point cap and switch from sphere-compound synthesis to PointConverter.pointsToBody (already shipped in OCCTSwiftTools v1.0.1).
What's new
ViewportBody
- New
BodyPrimitiveKindenum (.mesh / .point / .wire) — named to avoid collision with the existing pick-resultPrimitiveKind(.face/.edge/.vertex). - New fields:
primitiveKind(default.mesh),pointRadius(default0.05, world units),vertexColors(default[]). boundingBoxnow falls back toverticeswhenvertexDatais empty, so cloud bodies frame correctly for shadow /CameraState.fit(to:).- All defaults preserve full source compatibility — every existing
ViewportBody.initcall site continues to construct.meshbodies unchanged.
Renderer
visiblePointPipelineadded to bothViewportRenderer(live MTKView) andOffscreenRenderer(headless). MSAA, premultiplied-alpha blending.- World-space point radius projected to screen pixels via
pxPerWorldFactor / clipPosition.w— single formula handles both perspective and orthographic.[[point_size]]clamped to[1, 64](Apple GPU upper limit). - Mesh + wireframe paths skip
.pointbodies; the new pass walks them once after the main body loop.
Picking
Unchanged. The existing point-sprite pick pass already runs on body.vertices and tags hits with kind=2 — .point bodies are pickable out of the box.
Source compatibility
| Change | Compatibility |
|---|---|
BodyPrimitiveKind enum |
Additive |
ViewportBody.primitiveKind |
Defaulted to .mesh — additive |
ViewportBody.pointRadius |
Defaulted to 0.05 — additive |
ViewportBody.vertexColors |
Defaulted to [] — additive |
_BodyPrimitiveKind re-export |
Additive |
Existing ViewportBody.init parameters |
Unchanged order |
No deprecations. No removals. No required changes for downstream consumers, including the demo app and OCCTMCP.
Pinning
| Component | Version |
|---|---|
| OCCTSwift (transitive in demo) | 1.0.1 |
| OCCTSwiftTools (demo) | 1.0.0 |
| OCCT family | 8.0.0 GA |
| Swift | 6.0+ |
| iOS | 18+ |
| macOS | 15+ |
Tests
- 61/61 passing (was 57; +4 new in
ViewportPointCloudRenderingTests). - Acceptance test: 10k-point cloud renders with verified non-background pixel coverage.
- Per-vertex colour override + mismatched-length fallback covered.
- Existing demo smoke + measurement overlay tests unchanged.
Pull request
Issue
Closes #28.