Skip to content

Commit 18c7950

Browse files
committed
doc site update
1 parent 14dfb96 commit 18c7950

20 files changed

Lines changed: 238 additions & 593 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,4 @@ example-local-build/**/public/ui/
8484

8585
# Auto generated version files
8686
**/version.ts
87+
**/version.js

docs/.vitepress/config.ts

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,29 @@ function loadTypedocSidebar() {
2222
export default defineConfig({
2323
// Build static site even if some cross-package API links are unresolved in early builds
2424
ignoreDeadLinks: true,
25-
// base: '/immersive-web-sdk/',
2625
lang: 'en-US',
2726
title: 'Immersive Web SDK',
2827
description:
2928
'WebXR framework with ECS, input, locomotion, spatial UI, and tools.',
3029

30+
head: [
31+
[
32+
'script',
33+
{
34+
async: '',
35+
src: 'https://www.googletagmanager.com/gtag/js?id=G-V03QDNGKY3',
36+
},
37+
],
38+
[
39+
'script',
40+
{},
41+
`window.dataLayer = window.dataLayer || [];
42+
function gtag(){dataLayer.push(arguments);}
43+
gtag('js', new Date());
44+
gtag('config', 'G-V03QDNGKY3');`,
45+
],
46+
],
47+
3148
themeConfig: {
3249
logo: {
3350
light: '/logo-light.svg',
@@ -126,7 +143,6 @@ export default defineConfig({
126143
{ text: 'System', link: '/concepts/ecs/systems' },
127144
{ text: 'Queries', link: '/concepts/ecs/queries' },
128145
{ text: 'Lifecycle', link: '/concepts/ecs/lifecycle' },
129-
{ text: 'Config & Signals', link: '/concepts/ecs/config-signals' },
130146
{ text: 'Patterns & Tips', link: '/concepts/ecs/patterns' },
131147
{ text: 'Architecture', link: '/concepts/ecs/architecture' },
132148
],
@@ -139,7 +155,6 @@ export default defineConfig({
139155
text: 'Interop: ECS ↔ Three.js',
140156
link: '/concepts/three-basics/interop-ecs-three',
141157
},
142-
{ text: 'Scene Graph', link: '/concepts/three-basics/scene-graph' },
143158
{
144159
text: 'Transforms & 3D Math',
145160
link: '/concepts/three-basics/transforms-math',
@@ -148,22 +163,6 @@ export default defineConfig({
148163
text: 'Meshes, Geometry & Materials',
149164
link: '/concepts/three-basics/meshes-geometry-materials',
150165
},
151-
{
152-
text: 'Cameras & Projections',
153-
link: '/concepts/three-basics/cameras',
154-
},
155-
{
156-
text: 'Lights & Environment',
157-
link: '/concepts/three-basics/lights-environment',
158-
},
159-
{
160-
text: 'Raycasting & Input',
161-
link: '/concepts/three-basics/raycasting-input',
162-
},
163-
{
164-
text: 'Rendering & Performance',
165-
link: '/concepts/three-basics/rendering-performance',
166-
},
167166
],
168167
},
169168
{

docs/concepts/ecs/config-signals.md

Lines changed: 0 additions & 51 deletions
This file was deleted.

docs/concepts/ecs/entity.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,16 @@ const persistent = world.createTransformEntity(undefined, { persistent: true });
2323
## Object3D Attachment
2424

2525
```ts
26-
const o = new (await import('@iwsdk/core')).Object3D();
27-
const withMesh = world.createTransformEntity(o);
26+
import { Mesh, BoxGeometry, MeshStandardMaterial } from '@iwsdk/core';
27+
28+
const geometry = new BoxGeometry(1, 1, 1);
29+
const material = new MeshStandardMaterial({ color: 0x00ff00 });
30+
const mesh = new Mesh(geometry, material);
31+
32+
const entity = world.createTransformEntity(mesh);
2833
```
2934

30-
`createTransformEntity` ensures `object3D` is detached when the entity is released.
35+
`createTransformEntity` is the recommended way to attach Three.js objects to entities. It ensures `object3D` is properly managed and detached when the entity is released.
3136

3237
## Component Operations
3338

docs/concepts/ecs/index.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ This is a practical, from‑zero introduction to Entity‑Component‑System (EC
1313
- [System](/concepts/ecs/systems)
1414
- [Queries](/concepts/ecs/queries)
1515
- [Lifecycle](/concepts/ecs/lifecycle)
16-
- [Config & Signals](/concepts/ecs/config-signals)
1716
- [Patterns & Tips](/concepts/ecs/patterns)
1817

1918
IWSDK’s ECS is powered by the elics runtime. IWSDK layers WebXR, Three.js scene ownership, and convenient helpers on top, but the core mental model is the same.
@@ -45,7 +44,6 @@ IWSDK’s ECS is powered by the elics runtime. IWSDK layers WebXR, Three.js scen
4544

4645
- [Queries](/concepts/ecs/queries): live, efficient sets of entities that update automatically as components change. Support complex filtering with value predicates.
4746
- [Lifecycle](/concepts/ecs/lifecycle): understand when things happen — world boot sequence, system initialization, per-frame execution order, and cleanup.
48-
- [Config & Signals](/concepts/ecs/config-signals): reactive configuration that allows runtime tuning of system behavior from UI or debugging tools.
4947
- [Patterns & Tips](/concepts/ecs/patterns): proven composition patterns, performance optimizations, and debugging techniques for production use.
5048

5149
## Quick start: a complete feature in ~40 lines
@@ -360,7 +358,6 @@ export class InteractiveGlowSystem extends createSystem(
360358
- [Component](/concepts/ecs/components) — schemas, enums, vectors, defaults.
361359
- [System](/concepts/ecs/systems) — queries, lifecycle, config, cleanup.
362360
- [Queries](/concepts/ecs/queries) — required/excluded, qualify/disqualify events.
363-
- [Config & Signals](/concepts/ecs/config-signals) — reactive tuning at runtime.
364361
- [Patterns & Tips](/concepts/ecs/patterns) — common patterns, pitfalls, and performance notes.
365362
- [Architecture](/concepts/ecs/architecture) — deep dive into performance, memory layout, and WebXR integration.
366363

docs/concepts/ecs/systems.md

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,50 @@ export class MySystem extends createSystem(
5757

5858
## Config Signals
5959

60-
Each config key is a `Signal<T>` at `this.config.key`. Use `.value` to set, `.peek()` to read without tracking, and `.subscribe()` to react.
60+
System config values are reactive signals powered by `@preact/signals`. Each config key is a `Signal<T>` at `this.config.key`.
6161

6262
```ts
63-
this.config.speed.value = 3;
64-
this.config.speed.subscribe((v) => console.log('now', v));
63+
export class CameraShake extends createSystem(
64+
{},
65+
{
66+
intensity: { type: Types.Float32, default: 0 },
67+
decayPerSecond: { type: Types.Float32, default: 1 },
68+
},
69+
) {
70+
update(dt: number) {
71+
const i = this.config.intensity.peek();
72+
if (i <= 0) return;
73+
// apply random offset scaled by i
74+
this.camera.position.x += (Math.random() - 0.5) * 0.01 * i;
75+
this.config.intensity.value = Math.max(
76+
0,
77+
i - this.config.decayPerSecond.peek() * dt,
78+
);
79+
}
80+
}
81+
```
82+
83+
### Reading vs Tracking
84+
85+
- `.value` — set and track.
86+
- `.peek()` — read without tracking to avoid incidental subscriptions.
87+
- `.subscribe(fn)` — run when the value changes.
88+
89+
```ts
90+
const unsubscribe = this.config.intensity.subscribe((v) => console.log(v));
91+
// later
92+
unsubscribe();
93+
```
94+
95+
### UI ↔ ECS Wiring
96+
97+
Config signals are ideal for developer tools and UI controls:
98+
99+
```ts
100+
// debugging slider
101+
document.getElementById('intensity')!.addEventListener('input', (e) => {
102+
this.config.intensity.value = Number((e.target as HTMLInputElement).value);
103+
});
65104
```
66105

67106
## Creating/Destroying Entities in Systems

docs/concepts/three-basics/cameras.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

docs/concepts/three-basics/index.md

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,44 +48,26 @@ Entity 12 Object3D
4848
- [Transforms & 3D Math](/concepts/three-basics/transforms-math) — position, rotation, scale in 3D space
4949
- [Meshes, Geometry & Materials](/concepts/three-basics/meshes-geometry-materials) — the building blocks of 3D objects
5050

51-
**Important Concepts:**
52-
53-
- [Scene Graph](/concepts/three-basics/scene-graph) — how objects relate to each other in 3D hierarchies
54-
- [Cameras & Projections](/concepts/three-basics/cameras) — how 3D space appears on 2D screens
55-
- [Lights & Environment](/concepts/three-basics/lights-environment) — illuminating your 3D world
56-
57-
**Advanced Topics:**
58-
59-
- [Raycasting & Input](/concepts/three-basics/raycasting-input) — detecting what users point at or touch
60-
- [Rendering & Performance](/concepts/three-basics/rendering-performance) — keeping 90fps in VR/AR
61-
6251
## Quick Start: Your First 3D Object
6352

6453
Here's how ECS and Three.js work together in IWSDK:
6554

6655
```ts
67-
import {
68-
World,
69-
Object3D,
70-
BoxGeometry,
71-
MeshStandardMaterial,
72-
} from '@iwsdk/core';
56+
import { World, Mesh, BoxGeometry, MeshStandardMaterial } from '@iwsdk/core';
7357

7458
// 1) IWSDK creates renderer, scene, camera automatically
7559
const world = await World.create(container);
7660

7761
// 2) Create a mesh using Three.js classes
7862
const geometry = new BoxGeometry(1, 1, 1);
7963
const material = new MeshStandardMaterial({ color: 0x00ff00 });
80-
const mesh = new Object3D();
81-
mesh.add(new Mesh(geometry, material));
64+
const mesh = new Mesh(geometry, material);
8265

8366
// 3) Create an entity and attach the Three.js object
8467
const boxEntity = world.createTransformEntity(mesh);
8568

86-
// 4) ECS data controls the Three.js visuals automatically
87-
const transform = boxEntity.getComponent(Transform)!;
88-
transform.position = [2, 1, 0]; // Box moves in 3D space
69+
// 4) Position the object in 3D space
70+
boxEntity.object3D.position.set(2, 1, 0);
8971
```
9072

9173
**What happened?**

0 commit comments

Comments
 (0)