@iwsdk/create 0.4.2 → 0.5.0
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 +103 -41
- package/dist/cli.js +1003 -3418
- package/dist/guidance/agents/.agents/skills/iwsdk-debug/SKILL.md +96 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-depth-occlusion/SKILL.md +135 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-grab/SKILL.md +129 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-physics/SKILL.md +92 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-physics/references/component-reference.md +154 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-physics/references/tuning-and-config.md +88 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-physics/references/workflows.md +303 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/SKILL.md +364 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/references/api-reference.md +1489 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/references/build-milestones.md +241 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/references/design-deck.md +101 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/references/grounding.md +176 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/references/ideation.md +156 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/references/verification.md +199 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-ray/SKILL.md +159 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/SKILL.md +255 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/agents/openai.yaml +5 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/references/asset-authoring.md +295 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/references/composition-patterns.md +243 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/references/image-intake.md +191 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/references/review-and-stop.md +99 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/references/scene-format.md +458 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/references/text-intake.md +82 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-ui/SKILL.md +208 -0
- package/dist/guidance/claude/.claude/agents/iwsdk-project-code-reviewer.md +450 -0
- package/dist/guidance/claude/.claude/rules/assets-and-manifest.md +55 -0
- package/dist/guidance/claude/.claude/rules/ecs-api.md +102 -0
- package/dist/guidance/claude/.claude/rules/scene-json.md +64 -0
- package/dist/guidance/claude/.claude/rules/uikitml.md +60 -0
- package/dist/guidance/claude/.claude/settings.json +19 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-debug/SKILL.md +96 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-depth-occlusion/SKILL.md +135 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-grab/SKILL.md +129 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-physics/SKILL.md +92 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-physics/references/component-reference.md +154 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-physics/references/tuning-and-config.md +88 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-physics/references/workflows.md +303 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/SKILL.md +364 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/references/api-reference.md +1489 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/references/build-milestones.md +241 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/references/design-deck.md +101 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/references/grounding.md +176 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/references/ideation.md +156 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/references/verification.md +199 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-ray/SKILL.md +159 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/SKILL.md +255 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/agents/openai.yaml +5 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/references/asset-authoring.md +295 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/references/composition-patterns.md +243 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/references/image-intake.md +191 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/references/review-and-stop.md +99 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/references/scene-format.md +458 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/references/text-intake.md +82 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-ui/SKILL.md +208 -0
- package/dist/guidance/claude/CLAUDE.md +142 -0
- package/dist/guidance/codex/.codex/config.toml +2 -0
- package/dist/guidance/common/AGENTS.md +151 -0
- package/dist/guidance/copilot/.github/instructions/assets-and-manifest.instructions.md +52 -0
- package/dist/guidance/copilot/.github/instructions/ecs-api.instructions.md +100 -0
- package/dist/guidance/copilot/.github/instructions/scene-json.instructions.md +63 -0
- package/dist/guidance/copilot/.github/instructions/uikitml.instructions.md +59 -0
- package/dist/guidance/cursor/.cursor/rules/assets-and-manifest.mdc +57 -0
- package/dist/guidance/cursor/.cursor/rules/ecs-api.mdc +104 -0
- package/dist/guidance/cursor/.cursor/rules/scene-json.mdc +66 -0
- package/dist/guidance/cursor/.cursor/rules/uikitml.mdc +62 -0
- package/dist/guidance/scoped-agents/public/scenes/AGENTS.md +63 -0
- package/dist/guidance/scoped-agents/public/ui/AGENTS.md +59 -0
- package/dist/guidance/scoped-agents/src/AGENTS.md +149 -0
- package/dist/template/common/README.md +13 -0
- package/dist/template/common/gitignore.template +45 -0
- package/dist/template/common/index.html +16 -0
- package/dist/template/common/nvmrc.template +1 -0
- package/dist/template/common/public/audio/chime.mp3 +0 -0
- package/dist/template/common/public/gltf/webxr-banner/banner.gltf +68 -0
- package/dist/template/common/public/textures/webxr.png +0 -0
- package/dist/template/common/public/ui/welcome.uikitml +98 -0
- package/dist/template/common/src/assets.ts +54 -0
- package/dist/template/common/src/components.ts +11 -0
- package/dist/template/common/src/index.ts +19 -0
- package/dist/template/common/src/panel.ts +38 -0
- package/dist/template/common/src/robot-component.ts +10 -0
- package/dist/template/common/src/robot.ts +38 -0
- package/dist/template/common/src/vite-env.d.ts +2 -0
- package/dist/template/common/tsconfig.json +15 -0
- package/dist/template/common/vite.config.ts +27 -0
- package/dist/template/common-js/README.md +13 -0
- package/dist/template/common-js/gitignore.template +45 -0
- package/dist/template/common-js/index.html +16 -0
- package/dist/template/common-js/nvmrc.template +1 -0
- package/dist/template/common-js/public/audio/chime.mp3 +0 -0
- package/dist/template/common-js/public/gltf/webxr-banner/banner.gltf +68 -0
- package/dist/template/common-js/public/textures/webxr.png +0 -0
- package/dist/template/common-js/public/ui/welcome.uikitml +98 -0
- package/dist/template/common-js/src/assets.js +45 -0
- package/dist/template/common-js/src/components.js +9 -0
- package/dist/template/common-js/src/index.js +14 -0
- package/dist/template/common-js/src/panel.js +31 -0
- package/dist/template/common-js/src/robot-component.js +8 -0
- package/dist/template/common-js/src/robot.js +37 -0
- package/dist/template/common-js/vite.config.js +25 -0
- package/dist/template/scenes/ar.iwsdk.scene.json +96 -0
- package/dist/template/scenes/immersive.iwsdk.scene.json +109 -0
- package/package.json +23 -17
- package/scripts/verify-release-ready.mjs +76 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# IWSDK scoped project guidance
|
|
2
|
+
|
|
3
|
+
This file augments the repository-root `AGENTS.md` for files in this directory.
|
|
4
|
+
|
|
5
|
+
# ECS API reference
|
|
6
|
+
|
|
7
|
+
## Field types
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Types.Float32 Float64 Int8 Int16 Int32 Boolean String FilePath
|
|
11
|
+
Types.Vec2 Vec3 Vec4 Color(RGBA) Entity Enum
|
|
12
|
+
Types.Object // avoid — not optimised
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Component
|
|
16
|
+
|
|
17
|
+
Declare in a system-free module, then list it in `src/components.ts` via
|
|
18
|
+
`defineComponents()` or the editor cannot author it.
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
export const MyComponent = createComponent('MyComponent', {
|
|
22
|
+
speed: { type: Types.Float32, default: 1 },
|
|
23
|
+
tint: { type: Types.Color, default: [1, 1, 1, 1] }, // RGBA
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Optional metadata per field — `label`, `step`, `min`, `max`, `enum`, `help`,
|
|
28
|
+
`widget` — drives the editor inspector.
|
|
29
|
+
|
|
30
|
+
## System
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
export class MySystem extends createSystem(
|
|
34
|
+
{
|
|
35
|
+
items: { required: [MyComponent] },
|
|
36
|
+
active: { required: [MyComponent], excluded: [Grabbed] },
|
|
37
|
+
},
|
|
38
|
+
{ speed: { type: Types.Float32, default: 1 } }, // optional config
|
|
39
|
+
) {
|
|
40
|
+
private temp!: Vector3;
|
|
41
|
+
|
|
42
|
+
init() {
|
|
43
|
+
this.temp = new Vector3();
|
|
44
|
+
this.queries.items.subscribe('qualify', (entity) => { /* matched */ });
|
|
45
|
+
this.cleanupFuncs.push(this.config.speed.subscribe((v) => { /* … */ }));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
update(delta: number, time: number) {
|
|
49
|
+
for (const entity of this.queries.active.entities) { /* no allocations */ }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Queries take `required`, `excluded` and `where` (value predicates via `eq`, `ne`,
|
|
55
|
+
`lt`, `le`, `gt`, `ge`, `isin`, `nin`). `excluded` is the clean way to skip
|
|
56
|
+
entities in a transient state — e.g. excluding `Grabbed` so a held object is left
|
|
57
|
+
alone.
|
|
58
|
+
|
|
59
|
+
Register explicitly in `src/index.ts` with `world.registerSystem(MySystem)`.
|
|
60
|
+
|
|
61
|
+
Read fields with `entity.getValue(Component, 'field')`. For vector fields use
|
|
62
|
+
`entity.getVectorView(Component, 'field')` — it returns a `Float32Array` view with
|
|
63
|
+
no allocation, and `setValue` **throws** on vector fields in elics 3.4.x.
|
|
64
|
+
|
|
65
|
+
## Interaction components
|
|
66
|
+
|
|
67
|
+
`RayInteractable` plus `Hovered`/`Pressed` covers both mouse/touch canvas input
|
|
68
|
+
and XR rays. Grab components: `OneHandGrabbable` and `TwoHandsGrabbable` are
|
|
69
|
+
proximity-based and respond to **squeeze**, while `DistanceGrabbable` is
|
|
70
|
+
ray-based and responds to **trigger**. `Grabbed` is a transient tag managed by
|
|
71
|
+
`GrabSystem` — read it, never add or remove it. `GrabSystem.useHandPinchForGrab`
|
|
72
|
+
defaults to **false**, so hand pinch does not grab unless you enable it.
|
|
73
|
+
|
|
74
|
+
`DistanceGrabbable` fields: `movementMode` (`MoveTowardsTarget`, `MoveFromTarget`,
|
|
75
|
+
`MoveAtSource`, `RotateAtSource`), `returnToOrigin`, `moveSpeedFactor`,
|
|
76
|
+
`detachOnGrab`, `translate`, `rotate`, `scale`, `targetPositionOffset`,
|
|
77
|
+
`targetQuaternionOffset`. `returnToOrigin: true` gives spring-back on release with
|
|
78
|
+
no custom code.
|
|
79
|
+
|
|
80
|
+
For a held object use `GrabSystem`'s public methods — `forceRelease(entity)`,
|
|
81
|
+
`getHolderHand(entity)` — never deep-import `Handle`.
|
|
82
|
+
|
|
83
|
+
## XR input
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
const pad = this.input.xr.gamepads.right;
|
|
87
|
+
pad?.getButtonDown(InputComponent.Trigger); // just pressed
|
|
88
|
+
pad?.getAxesValues(InputComponent.Thumbstick);
|
|
89
|
+
this.player.head; this.player.raySpaces.left; this.player.gripSpaces.right;
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Prefer `world.input.actions` for reusable intent (`locomotion.move`) over raw
|
|
93
|
+
buttons. Browser controls live at `world.input.keyboard` and
|
|
94
|
+
`world.input.browserGamepads`.
|
|
95
|
+
|
|
96
|
+
## Lifecycle
|
|
97
|
+
|
|
98
|
+
`world.visibilityState` reports `NonImmersive`, `Visible`, `VisibleBlurred` —
|
|
99
|
+
pause simulation on blur. `world.camera.position` is local to `world.player`; use
|
|
100
|
+
`getWorldPosition()` when logic needs the true viewer position.
|
|
101
|
+
|
|
102
|
+
# Asset manifest contract
|
|
103
|
+
|
|
104
|
+
`src/assets.ts` is imported **independently by the app runtime and the editor**,
|
|
105
|
+
in separate JS realms. It must therefore be deterministic and self-contained:
|
|
106
|
+
|
|
107
|
+
- no `World`, scene, iframe, editor object or DOM access
|
|
108
|
+
- no timers, no fetching ambient state
|
|
109
|
+
- no reliance on singleton object identity across realms
|
|
110
|
+
- prototypes immutable after registration, and never parented
|
|
111
|
+
|
|
112
|
+
A manifest entry is either a URL descriptor (`{ url, type, name?, priority? }`)
|
|
113
|
+
or a bare parentless `Object3D`. `AssetType` covers `GLTF`, `Audio`, `Texture`,
|
|
114
|
+
`HDRTexture`, `UIKitML`. Only glTF, UIKitML and `Object3D` entries are placeable
|
|
115
|
+
as scene content; audio/texture/HDR are for application systems.
|
|
116
|
+
|
|
117
|
+
Build public URLs from `import.meta.env.BASE_URL` so runtime, editor and subpath
|
|
118
|
+
builds resolve identically. A file in `public/` is **not** available to a scene
|
|
119
|
+
until it is registered here.
|
|
120
|
+
|
|
121
|
+
## Procedural assets
|
|
122
|
+
|
|
123
|
+
Export a parentless `Object3D` from `src/scene-assets/*.scene-asset.ts` and
|
|
124
|
+
register it under a stable ID. The registry rejects an already-parented
|
|
125
|
+
prototype.
|
|
126
|
+
|
|
127
|
+
Every placement is a distinct hierarchy clone, but **geometry and materials stay
|
|
128
|
+
shared**. Never dispose them from a placed clone; world teardown owns their
|
|
129
|
+
lifetime. Reassigning `mesh.material` on a clone is fine and is how you restyle
|
|
130
|
+
one instance — mutating the shared material in place changes every instance.
|
|
131
|
+
|
|
132
|
+
Bounds come from `Box3` over the instantiated asset and drive placement,
|
|
133
|
+
selection, framing and scatter collision. Put the origin where composition wants
|
|
134
|
+
it (usually floor contact, or the object's own pivot), keep transforms finite,
|
|
135
|
+
and don't let invisible helpers inflate bounds.
|
|
136
|
+
|
|
137
|
+
## Cost
|
|
138
|
+
|
|
139
|
+
Split tessellation by viewing distance rather than using one budget everywhere: a
|
|
140
|
+
close-range hero model and coarser display copies of the same form are two
|
|
141
|
+
prototypes from one factory function. Sphere/lathe segment counts dominate small
|
|
142
|
+
repeated detail more than people expect — check `renderStats.triangles` rather
|
|
143
|
+
than guessing.
|
|
144
|
+
|
|
145
|
+
Reuse material instances within a module. Prefer prefabs plus a deterministic
|
|
146
|
+
pattern for repetition; a pattern whose prefab resolves to a single component-free
|
|
147
|
+
mesh lowers to one `InstancedMesh`.
|
|
148
|
+
|
|
149
|
+
Start assets at `castShadow: false` and opt in only for grounded focal masses.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# IWSDK App
|
|
2
|
+
|
|
3
|
+
This project uses `iwsdk.config.json` for declarative scene, asset, component,
|
|
4
|
+
XR, and emulator configuration. Application systems remain explicit in
|
|
5
|
+
`src/index.ts`.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install
|
|
9
|
+
npm run dev
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Use the Runtime and Editor controls in the managed browser to switch between
|
|
13
|
+
the running experience and its authored scene.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
.pnpm-debug.log*
|
|
4
|
+
|
|
5
|
+
# Build outputs
|
|
6
|
+
dist/
|
|
7
|
+
*.tsbuildinfo
|
|
8
|
+
|
|
9
|
+
# Environment files
|
|
10
|
+
.env
|
|
11
|
+
.env.local
|
|
12
|
+
.env.production
|
|
13
|
+
|
|
14
|
+
# IDE and OS files
|
|
15
|
+
.vscode/*
|
|
16
|
+
!.vscode/extensions.json
|
|
17
|
+
.idea/
|
|
18
|
+
*.swp
|
|
19
|
+
*.swo
|
|
20
|
+
.DS_Store
|
|
21
|
+
Thumbs.db
|
|
22
|
+
|
|
23
|
+
# Logs and coverage
|
|
24
|
+
*.log
|
|
25
|
+
npm-debug.log*
|
|
26
|
+
yarn-debug.log*
|
|
27
|
+
yarn-error.log*
|
|
28
|
+
pnpm-debug.log*
|
|
29
|
+
coverage/
|
|
30
|
+
*.lcov
|
|
31
|
+
|
|
32
|
+
# Runtime and temporary data
|
|
33
|
+
pids/
|
|
34
|
+
*.pid
|
|
35
|
+
*.seed
|
|
36
|
+
*.pid.lock
|
|
37
|
+
.tmp/
|
|
38
|
+
.temp/
|
|
39
|
+
.iwsdk/
|
|
40
|
+
|
|
41
|
+
# MCP configs generated by the CLI
|
|
42
|
+
.mcp.json
|
|
43
|
+
.cursor/mcp.json
|
|
44
|
+
.vscode/mcp.json
|
|
45
|
+
.codex/config.toml
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta
|
|
6
|
+
name="viewport"
|
|
7
|
+
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
|
8
|
+
/>
|
|
9
|
+
<link rel="icon" href="data:," />
|
|
10
|
+
<title>IWSDK App</title>
|
|
11
|
+
</head>
|
|
12
|
+
<body style="margin: 0">
|
|
13
|
+
<div id="scene-container"></div>
|
|
14
|
+
<script type="module" src="/src/index.ts"></script>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
22.12.0
|
|
Binary file
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"asset": {
|
|
3
|
+
"version": "2.0",
|
|
4
|
+
"generator": "IWSDK starter static banner"
|
|
5
|
+
},
|
|
6
|
+
"extensionsUsed": ["KHR_materials_unlit"],
|
|
7
|
+
"scene": 0,
|
|
8
|
+
"scenes": [{ "nodes": [0] }],
|
|
9
|
+
"nodes": [{ "mesh": 0 }],
|
|
10
|
+
"meshes": [
|
|
11
|
+
{
|
|
12
|
+
"primitives": [
|
|
13
|
+
{
|
|
14
|
+
"attributes": { "POSITION": 0, "TEXCOORD_0": 1 },
|
|
15
|
+
"indices": 2,
|
|
16
|
+
"material": 0
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"materials": [
|
|
22
|
+
{
|
|
23
|
+
"name": "Unlit WebXR banner",
|
|
24
|
+
"extensions": { "KHR_materials_unlit": {} },
|
|
25
|
+
"pbrMetallicRoughness": {
|
|
26
|
+
"baseColorTexture": { "index": 0 },
|
|
27
|
+
"metallicFactor": 0,
|
|
28
|
+
"roughnessFactor": 1
|
|
29
|
+
},
|
|
30
|
+
"alphaMode": "BLEND"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"textures": [{ "source": 0 }],
|
|
34
|
+
"images": [{ "uri": "../../textures/webxr.png" }],
|
|
35
|
+
"accessors": [
|
|
36
|
+
{
|
|
37
|
+
"bufferView": 0,
|
|
38
|
+
"componentType": 5126,
|
|
39
|
+
"count": 4,
|
|
40
|
+
"type": "VEC3",
|
|
41
|
+
"min": [-1.695, -0.48, 0],
|
|
42
|
+
"max": [1.695, 0.48, 0]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"bufferView": 1,
|
|
46
|
+
"componentType": 5126,
|
|
47
|
+
"count": 4,
|
|
48
|
+
"type": "VEC2"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"bufferView": 2,
|
|
52
|
+
"componentType": 5123,
|
|
53
|
+
"count": 6,
|
|
54
|
+
"type": "SCALAR"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"bufferViews": [
|
|
58
|
+
{ "buffer": 0, "byteOffset": 0, "byteLength": 48, "target": 34962 },
|
|
59
|
+
{ "buffer": 0, "byteOffset": 48, "byteLength": 32, "target": 34962 },
|
|
60
|
+
{ "buffer": 0, "byteOffset": 80, "byteLength": 12, "target": 34963 }
|
|
61
|
+
],
|
|
62
|
+
"buffers": [
|
|
63
|
+
{
|
|
64
|
+
"byteLength": 92,
|
|
65
|
+
"uri": "data:application/octet-stream;base64,w/XYv4/C9b4AAAAAw/XYP4/C9b4AAAAAw/XYP4/C9T4AAAAAw/XYv4/C9T4AAAAAAAAAAAAAAAAAAIA/AAAAAAAAgD8AAIA/AAAAAAAAgD8AAAEAAgAAAAIAAwA="
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Panel, Divider, Button, ButtonIcon, and ButtonLabel come from the bundled
|
|
3
|
+
Horizon kit. RectangleGoggles and LogIn are bundled Lucide icon components.
|
|
4
|
+
-->
|
|
5
|
+
<style>
|
|
6
|
+
@font-face {
|
|
7
|
+
font-family: "DM Sans";
|
|
8
|
+
src: url("https://fonts.gstatic.com/s/dmsans/v17/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTg.ttf");
|
|
9
|
+
font-weight: 400;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@font-face {
|
|
13
|
+
font-family: "DM Sans";
|
|
14
|
+
src: url("https://fonts.gstatic.com/s/dmsans/v17/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTg.ttf");
|
|
15
|
+
font-weight: 500;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@font-face {
|
|
19
|
+
font-family: "DM Sans";
|
|
20
|
+
src: url("https://fonts.gstatic.com/s/dmsans/v17/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTg.ttf");
|
|
21
|
+
font-weight: 700;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.panel-root {
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
font-family: "DM Sans";
|
|
27
|
+
width: 344px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.panel-content {
|
|
31
|
+
align-items: center;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
padding-top: 16px;
|
|
34
|
+
padding-left: 24px;
|
|
35
|
+
padding-right: 24px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.heading {
|
|
39
|
+
height: 48px;
|
|
40
|
+
text-align: center;
|
|
41
|
+
font-size: 24px;
|
|
42
|
+
font-weight: 700;
|
|
43
|
+
line-height: 24px;
|
|
44
|
+
letter-spacing: -0.5px;
|
|
45
|
+
color: #272727;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.heading:dark {
|
|
49
|
+
color: rgba(255, 255, 255, 0.9);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.sub-heading {
|
|
53
|
+
color: #272727;
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
font-weight: 500;
|
|
56
|
+
line-height: 18px;
|
|
57
|
+
width: 100%;
|
|
58
|
+
margin-top: 10px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.sub-heading:dark {
|
|
62
|
+
color: rgba(255, 255, 255, 0.9);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.button {
|
|
66
|
+
justify-content: flex-start;
|
|
67
|
+
margin-left: 24px;
|
|
68
|
+
margin-right: 24px;
|
|
69
|
+
margin-top: 16px;
|
|
70
|
+
margin-bottom: 24px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.button-label {
|
|
74
|
+
transform-translate-y: 1px;
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
77
|
+
<Panel class="panel-root">
|
|
78
|
+
<div class="panel-content">
|
|
79
|
+
<div class="heading">Hello, Immersive Web!</div>
|
|
80
|
+
<Divider></Divider>
|
|
81
|
+
<div class="sub-heading">
|
|
82
|
+
Build interactive browser, mixed-reality, and virtual-reality experiences
|
|
83
|
+
with Immersive Web SDK.
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
<Button id="xr-button" class="button">
|
|
87
|
+
<ButtonIcon>
|
|
88
|
+
<RectangleGoggles></RectangleGoggles>
|
|
89
|
+
</ButtonIcon>
|
|
90
|
+
<ButtonLabel class="button-label">Enter XR</ButtonLabel>
|
|
91
|
+
</Button>
|
|
92
|
+
<Button id="exit-button" class="button" style="display: none">
|
|
93
|
+
<ButtonIcon>
|
|
94
|
+
<LogIn></LogIn>
|
|
95
|
+
</ButtonIcon>
|
|
96
|
+
<ButtonLabel class="button-label">Exit to Browser</ButtonLabel>
|
|
97
|
+
</Button>
|
|
98
|
+
</Panel>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { AssetType, defineAssets } from '@iwsdk/core';
|
|
9
|
+
|
|
10
|
+
const publicAssetUrl = (filePath: string): string =>
|
|
11
|
+
`${import.meta.env.BASE_URL}${filePath.replace(/^\/+/u, '')}`;
|
|
12
|
+
const DEFAULT_STOCK_ASSET_BASE =
|
|
13
|
+
'https://cdn.jsdelivr.net/npm/@iwsdk/example-assets@0.4.2/assets';
|
|
14
|
+
const configuredStockAssetBase =
|
|
15
|
+
import.meta.env.VITE_IWSDK_EXAMPLE_ASSET_BASE_URL?.trim();
|
|
16
|
+
const stockAssetBase = (
|
|
17
|
+
configuredStockAssetBase || DEFAULT_STOCK_ASSET_BASE
|
|
18
|
+
).replace(/\/+$/u, '');
|
|
19
|
+
|
|
20
|
+
function stockAssetUrl(assetId: string, fileName: string): string {
|
|
21
|
+
return `${stockAssetBase}/${assetId}/${fileName}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default defineAssets({
|
|
25
|
+
'environment-desk': {
|
|
26
|
+
url: stockAssetUrl('environment-desk', 'environmentDesk.gltf'),
|
|
27
|
+
type: AssetType.GLTF,
|
|
28
|
+
name: 'Environment Desk',
|
|
29
|
+
priority: 'lazy',
|
|
30
|
+
},
|
|
31
|
+
'plant-sansevieria': {
|
|
32
|
+
url: stockAssetUrl('plant-sansevieria', 'plantSansevieria.gltf'),
|
|
33
|
+
type: AssetType.GLTF,
|
|
34
|
+
name: 'Plant Sansevieria',
|
|
35
|
+
priority: 'lazy',
|
|
36
|
+
},
|
|
37
|
+
robot: {
|
|
38
|
+
url: stockAssetUrl('robot', 'robot.gltf'),
|
|
39
|
+
type: AssetType.GLTF,
|
|
40
|
+
name: 'Robot',
|
|
41
|
+
priority: 'lazy',
|
|
42
|
+
},
|
|
43
|
+
'welcome-panel': {
|
|
44
|
+
url: publicAssetUrl('ui/welcome.uikitml'),
|
|
45
|
+
type: AssetType.UIKitML,
|
|
46
|
+
name: 'Welcome Panel',
|
|
47
|
+
},
|
|
48
|
+
'webxr-banner': {
|
|
49
|
+
url: publicAssetUrl('gltf/webxr-banner/banner.gltf'),
|
|
50
|
+
type: AssetType.GLTF,
|
|
51
|
+
name: 'WebXR Banner',
|
|
52
|
+
priority: 'lazy',
|
|
53
|
+
},
|
|
54
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { defineComponents } from '@iwsdk/core';
|
|
9
|
+
import { Robot } from './robot-component.js';
|
|
10
|
+
|
|
11
|
+
export default defineComponents([Robot]);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { World } from '@iwsdk/core';
|
|
9
|
+
import projectOptions from 'virtual:iwsdk-project';
|
|
10
|
+
import { PanelSystem } from './panel.js';
|
|
11
|
+
import { RobotSystem } from './robot.js';
|
|
12
|
+
|
|
13
|
+
World.create(
|
|
14
|
+
document.getElementById('scene-container') as HTMLDivElement,
|
|
15
|
+
projectOptions,
|
|
16
|
+
).then((world) => {
|
|
17
|
+
world.registerSystem(RobotSystem);
|
|
18
|
+
world.registerSystem(PanelSystem);
|
|
19
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { createSystem, UIKitMLAsset, VisibilityState } from '@iwsdk/core';
|
|
9
|
+
|
|
10
|
+
export class PanelSystem extends createSystem({}) {
|
|
11
|
+
init(): void {
|
|
12
|
+
const panel = this.world.getSceneObject<UIKitMLAsset>('welcome-panel');
|
|
13
|
+
const xrButton = panel?.getElementById('xr-button');
|
|
14
|
+
const exitButton = panel?.getElementById('exit-button');
|
|
15
|
+
if (xrButton == null || exitButton == null) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (!this.world.xrEnabled) {
|
|
19
|
+
xrButton.setProperties({ display: 'none' });
|
|
20
|
+
exitButton.setProperties({ display: 'none' });
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const launchXR = () => this.world.launchXR();
|
|
25
|
+
const exitXR = () => this.world.exitXR();
|
|
26
|
+
xrButton.addEventListener('click', launchXR);
|
|
27
|
+
exitButton.addEventListener('click', exitXR);
|
|
28
|
+
this.cleanupFuncs.push(
|
|
29
|
+
() => xrButton.removeEventListener('click', launchXR),
|
|
30
|
+
() => exitButton.removeEventListener('click', exitXR),
|
|
31
|
+
this.world.visibilityState.subscribe((visibilityState) => {
|
|
32
|
+
const is2D = visibilityState === VisibilityState.NonImmersive;
|
|
33
|
+
xrButton.setProperties({ display: is2D ? 'flex' : 'none' });
|
|
34
|
+
exitButton.setProperties({ display: is2D ? 'none' : 'flex' });
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { createComponent } from '@iwsdk/core';
|
|
9
|
+
|
|
10
|
+
export const Robot = createComponent('Robot', {});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { AudioUtils, createSystem, Pressed, Vector3 } from '@iwsdk/core';
|
|
9
|
+
import { Robot } from './robot-component.js';
|
|
10
|
+
|
|
11
|
+
export class RobotSystem extends createSystem({
|
|
12
|
+
robot: { required: [Robot] },
|
|
13
|
+
robotClicked: { required: [Robot, Pressed] },
|
|
14
|
+
}) {
|
|
15
|
+
private lookAtTarget = new Vector3();
|
|
16
|
+
private robotPosition = new Vector3();
|
|
17
|
+
|
|
18
|
+
init(): void {
|
|
19
|
+
this.queries.robotClicked.subscribe('qualify', (entity) => {
|
|
20
|
+
AudioUtils.play(entity);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
update(): void {
|
|
25
|
+
this.queries.robot.entities.forEach((entity) => {
|
|
26
|
+
const robot = entity.object3D;
|
|
27
|
+
if (robot == null) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this.player.head.updateWorldMatrix(true, false);
|
|
31
|
+
robot.updateWorldMatrix(true, false);
|
|
32
|
+
this.lookAtTarget.setFromMatrixPosition(this.player.head.matrixWorld);
|
|
33
|
+
this.robotPosition.setFromMatrixPosition(robot.matrixWorld);
|
|
34
|
+
this.lookAtTarget.y = this.robotPosition.y;
|
|
35
|
+
robot.lookAt(this.lookAtTarget);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"jsx": "preserve",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"types": ["@iwsdk/vite-plugin-dev/client"]
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*.ts"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { iwsdkDev } from '@iwsdk/vite-plugin-dev';
|
|
9
|
+
import { defineConfig } from 'vite';
|
|
10
|
+
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
plugins: [iwsdkDev()],
|
|
13
|
+
server: { host: '0.0.0.0', port: 8081, open: false },
|
|
14
|
+
build: {
|
|
15
|
+
outDir: 'dist',
|
|
16
|
+
sourcemap: process.env.NODE_ENV !== 'production',
|
|
17
|
+
target: 'esnext',
|
|
18
|
+
rollupOptions: { input: './index.html' },
|
|
19
|
+
},
|
|
20
|
+
esbuild: { target: 'esnext' },
|
|
21
|
+
optimizeDeps: {
|
|
22
|
+
exclude: ['@babylonjs/havok'],
|
|
23
|
+
esbuildOptions: { target: 'esnext' },
|
|
24
|
+
},
|
|
25
|
+
publicDir: 'public',
|
|
26
|
+
base: './',
|
|
27
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# IWSDK App
|
|
2
|
+
|
|
3
|
+
This project uses `iwsdk.config.json` for declarative scene, asset, component,
|
|
4
|
+
XR, and emulator configuration. Application systems remain explicit in
|
|
5
|
+
`src/index.ts`.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install
|
|
9
|
+
npm run dev
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Use the Runtime and Editor controls in the managed browser to switch between
|
|
13
|
+
the running experience and its authored scene.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
.pnpm-debug.log*
|
|
4
|
+
|
|
5
|
+
# Build outputs
|
|
6
|
+
dist/
|
|
7
|
+
*.tsbuildinfo
|
|
8
|
+
|
|
9
|
+
# Environment files
|
|
10
|
+
.env
|
|
11
|
+
.env.local
|
|
12
|
+
.env.production
|
|
13
|
+
|
|
14
|
+
# IDE and OS files
|
|
15
|
+
.vscode/*
|
|
16
|
+
!.vscode/extensions.json
|
|
17
|
+
.idea/
|
|
18
|
+
*.swp
|
|
19
|
+
*.swo
|
|
20
|
+
.DS_Store
|
|
21
|
+
Thumbs.db
|
|
22
|
+
|
|
23
|
+
# Logs and coverage
|
|
24
|
+
*.log
|
|
25
|
+
npm-debug.log*
|
|
26
|
+
yarn-debug.log*
|
|
27
|
+
yarn-error.log*
|
|
28
|
+
pnpm-debug.log*
|
|
29
|
+
coverage/
|
|
30
|
+
*.lcov
|
|
31
|
+
|
|
32
|
+
# Runtime and temporary data
|
|
33
|
+
pids/
|
|
34
|
+
*.pid
|
|
35
|
+
*.seed
|
|
36
|
+
*.pid.lock
|
|
37
|
+
.tmp/
|
|
38
|
+
.temp/
|
|
39
|
+
.iwsdk/
|
|
40
|
+
|
|
41
|
+
# MCP configs generated by the CLI
|
|
42
|
+
.mcp.json
|
|
43
|
+
.cursor/mcp.json
|
|
44
|
+
.vscode/mcp.json
|
|
45
|
+
.codex/config.toml
|