Unified API: camera wraps scene, ortho default, 11 primitive components#17
Merged
Conversation
…nger owns camera state
createPolyScene now requires { camera } — a handle from createPolyCamera,
createPolyOrthographicCamera, or createPolyPerspectiveCamera. Camera fields
(rotX, rotY, zoom, distance, target, perspective) are removed from
PolySceneOptions. scene.camera exposes the handle; scene.applyCamera()
re-applies the transform after camera.update(). All controls and tests updated.
<poly-scene> walks up the DOM tree for a camera ancestor element; if none is
found it creates an implicit orthographic camera from its own camera attrs
for backward compatibility.
… API - Three framework tabs: poly-camera > poly-scene > poly-box pattern (custom elements), PolyCamera > PolyScene > PolyBox (React, Vue) - Hero script replaced: createPolyCamera + createPolyScene + boxPolygons cube, no /apple.glb fetch; camera.setOptions() drives the auto-rotate - Getting-started lede updated to mention poly-camera / createPolyCamera
poly-camera.mdx: PolyCamera is now orthographic (not perspective alias);
rewrite perspective-vs-ortho table, prop tables, all examples; remove
perspective=false pattern; all vanilla examples use poly-camera > poly-scene.
poly-scene.mdx: drop camera-on-scene description; all vanilla tabs now show
poly-camera wrapping poly-scene; Scene with Camera and Lighting switches
PolyCamera perspective={1000} to PolyPerspectiveCamera.
poly-controls.mdx: prose updated to say camera owns state; imperative example
uses createPolyCamera + createPolyScene({camera}); all poly-scene rot-x=...
snippets replaced with poly-camera > poly-scene nesting.
…e API
introduction.mdx: quick-taste snippet uses poly-camera > poly-scene; mentions
poly-camera in custom elements list.
quickstart.mdx: explanation rewritten; all three tabs use camera-wraps-scene;
perspective removed from PolyCamera (PolyCamera is now ortho default).
core-concepts.mdx: Camera section rewritten; vanilla example uses poly-camera;
entry points mention createPolyCamera; PolyCamera is correctly described.
projections.mdx: intro sentence corrected; all vanilla poly-scene rot-x=...
examples replaced with poly-camera / poly-perspective-camera wrappers; React
tabs use PolyPerspectiveCamera for perspective examples; camera-angles section
uses poly-camera.
shapes.mdx: poly-polygon vanilla tab uses poly-camera wrapper; interactive
example uses poly-camera; two createPolyScene(host, {rotX}) calls updated to
createPolyCamera + createPolyScene(host, {camera}).
…ene API
textures.mdx: vanilla loading example uses poly-camera > poly-scene wrapper.
headless.mdx: createPolyOrbitControls example uses createPolyCamera + createPolyScene({camera});
custom elements section lists poly-camera and shows correct nesting.
…poly-tetrahedron, poly-icosahedron, poly-dodecahedron, poly-cylinder, poly-cone, poly-torus custom elements
…trahedron, PolyIcosahedron, PolyDodecahedron, PolyCylinder, PolyCone, PolyTorus shape components
…ahedron, PolyIcosahedron, PolyDodecahedron, PolyCylinder, PolyCone, PolyTorus shape components
React/Vue snippets now wrap <PolyScene> in <PolyCamera> or
<PolyPerspectiveCamera>. Vanilla HTML uses <poly-camera> /
<poly-perspective-camera> wrapping <poly-scene>. Imperative generator
path uses createPolyCamera/createPolyPerspectiveCamera + passes {camera}
to createPolyScene — drops rotX/rotY/perspective from scene options.
Controls are emitted inside <PolyScene> when animate or interactive is on.
The old docs said controls used scene.setOptions({rotX,rotY,...}). The
real surface is scene.camera.update({...}) + scene.applyCamera().
textures.mdx: createPolyScene imperative example was missing createPolyCamera
and the required {camera} option. performance.mdx: poly-scene snippet was
bare without a wrapping poly-camera element.
…and core-concepts
…, shapes, performance)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unifies the polycss API shape across vanilla JS, custom elements, React, and Vue. Same tree, same names, same defaults — one mental model.
Highlights
<PolyCamera>is now orthographic (was perspective). polycss optimizes for iso/voxel/diagrammatic scenes; ortho is the better default.<PolyPerspectiveCamera>stays available for perspective.<poly-scene rot-x>andcreatePolyScene({ rotX })are removed; the scene reads camera state from a wrapping camera component/element/handle.PolyBox,PolyPlane,PolyRing,PolyOctahedron,PolyTetrahedron,PolyIcosahedron,PolyDodecahedron,PolyCylinder,PolyCone,PolyTorus,PolySphere. Each wraps the matching*Polygons()core helper — no shape-specific logic in the framework layers.meshResolutionpromoted to a top-level<PolyMesh>prop (was buried inparseOptions).<poly-first-person-controls>registered (was missing).Test plan
pnpm test— 1691 tests across 4 packagespnpm build:packages— clean DTS for all 4pnpm build:website— clean/galleryand confirm Primitives bucket renders Box, Plane, Ring, Octahedron, Tetrahedron, Icosahedron, Dodecahedron, Cylinder, Cone, Torus, Sphere.