@layoutit/polycss-vue 0.2.6 → 0.2.8
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.
- package/README.md +54 -7
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +48 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +2 -2
- package/dist/three.cjs +1 -0
- package/dist/three.d.cts +526 -0
- package/dist/three.d.ts +526 -0
- package/dist/three.js +1 -0
- package/package.json +14 -2
package/README.md
CHANGED
|
@@ -21,7 +21,6 @@ npm install @layoutit/polycss-vue
|
|
|
21
21
|
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
25
24
|
You can also load PolyCSS directly from a CDN. Here is a minimal custom-element scene:
|
|
26
25
|
|
|
27
26
|
```html
|
|
@@ -39,7 +38,7 @@ You can also load PolyCSS directly from a CDN. Here is a minimal custom-element
|
|
|
39
38
|
|
|
40
39
|
## Framework Components
|
|
41
40
|
|
|
42
|
-
React and Vue expose the same component model. `<PolyCamera>` owns the viewpoint, `<PolyScene>` owns lighting and
|
|
41
|
+
React and Vue expose the same component model. `<PolyCamera>` owns the viewpoint, `<PolyScene>` owns lighting and options, and `<PolyMesh>` loads or receives polygon data.
|
|
43
42
|
|
|
44
43
|
```tsx
|
|
45
44
|
import { PolyCamera, PolyScene, PolyOrbitControls, PolyMesh } from "@layoutit/polycss-react";
|
|
@@ -56,6 +55,54 @@ export default function App() {
|
|
|
56
55
|
}
|
|
57
56
|
```
|
|
58
57
|
|
|
58
|
+
## Three.js Parity API
|
|
59
|
+
|
|
60
|
+
When porting Three.js scenes or generating code with an agent, use the explicit
|
|
61
|
+
`*/three` subpaths:
|
|
62
|
+
|
|
63
|
+
- `@layoutit/polycss-core/three`
|
|
64
|
+
- `@layoutit/polycss/three`
|
|
65
|
+
- `@layoutit/polycss-react/three`
|
|
66
|
+
- `@layoutit/polycss-vue/three`
|
|
67
|
+
|
|
68
|
+
They expose Three-like `PerspectiveCamera`, `OrthographicCamera`, `Object3D`,
|
|
69
|
+
`Vector3`, `DirectionalLight`, `PointLight`, `AmbientLight`, radians for object
|
|
70
|
+
rotations, Y-up authoring coordinates, and `camera.position` + `camera.lookAt(...)`
|
|
71
|
+
framing. The adapters convert into native PolyCSS coordinates with a right-handed
|
|
72
|
+
axis map, so the apparent object size, projection, orientation, depth ordering,
|
|
73
|
+
and light direction line up with Three.js scene math while still rendering
|
|
74
|
+
through the DOM.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { PolyScene } from "@layoutit/polycss-react";
|
|
78
|
+
import {
|
|
79
|
+
DirectionalLight,
|
|
80
|
+
PolyThreeMesh,
|
|
81
|
+
PolyThreePerspectiveCamera,
|
|
82
|
+
} from "@layoutit/polycss-react/three";
|
|
83
|
+
|
|
84
|
+
const sun = new DirectionalLight("#ffffff", 1);
|
|
85
|
+
sun.position.set(3, 5, 4);
|
|
86
|
+
sun.target.position.set(0, 0, 0);
|
|
87
|
+
|
|
88
|
+
export function App() {
|
|
89
|
+
return (
|
|
90
|
+
<PolyThreePerspectiveCamera
|
|
91
|
+
fov={50}
|
|
92
|
+
aspect={16 / 9}
|
|
93
|
+
position={[3, 2, 5]}
|
|
94
|
+
lookAt={[0, 0, 0]}
|
|
95
|
+
>
|
|
96
|
+
<PolyScene directionalLight={sun.toPolyDirectionalLight()}>
|
|
97
|
+
<PolyThreeMesh src="/models/cube.glb" rotation={[0, Math.PI / 4, 0]} />
|
|
98
|
+
</PolyScene>
|
|
99
|
+
</PolyThreePerspectiveCamera>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Full reference: [polycss.com/api/three-parity](https://polycss.com/api/three-parity).
|
|
105
|
+
|
|
59
106
|
## API Reference
|
|
60
107
|
|
|
61
108
|
### PolyCamera
|
|
@@ -69,7 +116,7 @@ export default function App() {
|
|
|
69
116
|
### PolyScene
|
|
70
117
|
|
|
71
118
|
- `polygons` renders a static `Polygon[]` directly.
|
|
72
|
-
- `directionalLight` and `ambientLight` control scene lighting.
|
|
119
|
+
- `directionalLight`, `pointLights` (direction-only, baked mode; optional per-light `castShadow`), and `ambientLight` control scene lighting.
|
|
73
120
|
- `textureLighting` chooses `"baked"` or `"dynamic"`.
|
|
74
121
|
- `textureQuality` controls atlas raster budget.
|
|
75
122
|
- `strategies` can disable selected render strategies for diagnostics.
|
|
@@ -84,7 +131,6 @@ export default function App() {
|
|
|
84
131
|
- `autoCenter` shifts the mesh bbox center to local origin.
|
|
85
132
|
- `meshResolution` chooses `"lossy"` (default) or `"lossless"` optimization. STL imports use the conservative lossless path in both modes.
|
|
86
133
|
- `castShadow` emits CSS-projected shadows in dynamic lighting mode.
|
|
87
|
-
- Tooling can reuse `buildPolyMeshTransform`, `buildPolySceneTransform`, `worldPositionToPolyCss`, `worldDirectionToPolyCss`, `worldDirectionalLightToPolyCss`, `worldDistanceToPolyCss`, `polyCssDistanceToWorld`, and `polyCssPositionToWorld` for renderer-compatible transforms and world/CSS conversions.
|
|
88
134
|
|
|
89
135
|
### Controls
|
|
90
136
|
|
|
@@ -188,10 +234,11 @@ Each visible polygon is emitted as one leaf element; the renderer chooses the le
|
|
|
188
234
|
|
|
189
235
|
## Made with PolyCSS
|
|
190
236
|
|
|
191
|
-
[
|
|
192
|
-
-> A CSS
|
|
237
|
+
[cssQuake](https://cssquake.com)
|
|
238
|
+
-> A CSS port of Quake (1996)
|
|
239
|
+
|
|
240
|
+
<img width="1280" height="720" alt="quake" src="https://github.com/user-attachments/assets/6d9d809c-857a-4a39-b5cf-733ead2661ec" />
|
|
193
241
|
|
|
194
|
-
<img width="1000" height="600" alt="layoutit-voxels" src="https://polycss.com/layoutit-voxels.png" />
|
|
195
242
|
|
|
196
243
|
[Layoutit Terra](https://terra.layoutit.com)
|
|
197
244
|
-> A CSS Terrain Generator
|