@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,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.js"></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,45 @@
|
|
|
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
|
+
import { AssetType, defineAssets } from '@iwsdk/core';
|
|
8
|
+
const publicAssetUrl = (filePath) => `${import.meta.env.BASE_URL}${filePath.replace(/^\/+/u, '')}`;
|
|
9
|
+
const DEFAULT_STOCK_ASSET_BASE = 'https://cdn.jsdelivr.net/npm/@iwsdk/example-assets@0.4.2/assets';
|
|
10
|
+
const configuredStockAssetBase = import.meta.env.VITE_IWSDK_EXAMPLE_ASSET_BASE_URL?.trim();
|
|
11
|
+
const stockAssetBase = (configuredStockAssetBase || DEFAULT_STOCK_ASSET_BASE).replace(/\/+$/u, '');
|
|
12
|
+
function stockAssetUrl(assetId, fileName) {
|
|
13
|
+
return `${stockAssetBase}/${assetId}/${fileName}`;
|
|
14
|
+
}
|
|
15
|
+
export default defineAssets({
|
|
16
|
+
'environment-desk': {
|
|
17
|
+
url: stockAssetUrl('environment-desk', 'environmentDesk.gltf'),
|
|
18
|
+
type: AssetType.GLTF,
|
|
19
|
+
name: 'Environment Desk',
|
|
20
|
+
priority: 'lazy',
|
|
21
|
+
},
|
|
22
|
+
'plant-sansevieria': {
|
|
23
|
+
url: stockAssetUrl('plant-sansevieria', 'plantSansevieria.gltf'),
|
|
24
|
+
type: AssetType.GLTF,
|
|
25
|
+
name: 'Plant Sansevieria',
|
|
26
|
+
priority: 'lazy',
|
|
27
|
+
},
|
|
28
|
+
robot: {
|
|
29
|
+
url: stockAssetUrl('robot', 'robot.gltf'),
|
|
30
|
+
type: AssetType.GLTF,
|
|
31
|
+
name: 'Robot',
|
|
32
|
+
priority: 'lazy',
|
|
33
|
+
},
|
|
34
|
+
'welcome-panel': {
|
|
35
|
+
url: publicAssetUrl('ui/welcome.uikitml'),
|
|
36
|
+
type: AssetType.UIKitML,
|
|
37
|
+
name: 'Welcome Panel',
|
|
38
|
+
},
|
|
39
|
+
'webxr-banner': {
|
|
40
|
+
url: publicAssetUrl('gltf/webxr-banner/banner.gltf'),
|
|
41
|
+
type: AssetType.GLTF,
|
|
42
|
+
name: 'WebXR Banner',
|
|
43
|
+
priority: 'lazy',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
import { defineComponents } from '@iwsdk/core';
|
|
8
|
+
import { Robot } from './robot-component.js';
|
|
9
|
+
export default defineComponents([Robot]);
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
import { World } from '@iwsdk/core';
|
|
8
|
+
import projectOptions from 'virtual:iwsdk-project';
|
|
9
|
+
import { PanelSystem } from './panel.js';
|
|
10
|
+
import { RobotSystem } from './robot.js';
|
|
11
|
+
World.create(document.getElementById('scene-container'), projectOptions).then((world) => {
|
|
12
|
+
world.registerSystem(RobotSystem);
|
|
13
|
+
world.registerSystem(PanelSystem);
|
|
14
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
import { createSystem, VisibilityState } from '@iwsdk/core';
|
|
8
|
+
export class PanelSystem extends createSystem({}) {
|
|
9
|
+
init() {
|
|
10
|
+
const panel = this.world.getSceneObject('welcome-panel');
|
|
11
|
+
const xrButton = panel?.getElementById('xr-button');
|
|
12
|
+
const exitButton = panel?.getElementById('exit-button');
|
|
13
|
+
if (xrButton == null || exitButton == null) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!this.world.xrEnabled) {
|
|
17
|
+
xrButton.setProperties({ display: 'none' });
|
|
18
|
+
exitButton.setProperties({ display: 'none' });
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const launchXR = () => this.world.launchXR();
|
|
22
|
+
const exitXR = () => this.world.exitXR();
|
|
23
|
+
xrButton.addEventListener('click', launchXR);
|
|
24
|
+
exitButton.addEventListener('click', exitXR);
|
|
25
|
+
this.cleanupFuncs.push(() => xrButton.removeEventListener('click', launchXR), () => exitButton.removeEventListener('click', exitXR), this.world.visibilityState.subscribe((visibilityState) => {
|
|
26
|
+
const is2D = visibilityState === VisibilityState.NonImmersive;
|
|
27
|
+
xrButton.setProperties({ display: is2D ? 'flex' : 'none' });
|
|
28
|
+
exitButton.setProperties({ display: is2D ? 'none' : 'flex' });
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
import { createComponent } from '@iwsdk/core';
|
|
8
|
+
export const Robot = createComponent('Robot', {});
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
import { AudioUtils, createSystem, Pressed, Vector3 } from '@iwsdk/core';
|
|
8
|
+
import { Robot } from './robot-component.js';
|
|
9
|
+
export class RobotSystem extends createSystem({
|
|
10
|
+
robot: { required: [Robot] },
|
|
11
|
+
robotClicked: { required: [Robot, Pressed] },
|
|
12
|
+
}) {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.lookAtTarget = new Vector3();
|
|
16
|
+
this.robotPosition = new Vector3();
|
|
17
|
+
}
|
|
18
|
+
init() {
|
|
19
|
+
this.queries.robotClicked.subscribe('qualify', (entity) => {
|
|
20
|
+
AudioUtils.play(entity);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
update() {
|
|
24
|
+
this.queries.robot.entities.forEach((entity) => {
|
|
25
|
+
const robot = entity.object3D;
|
|
26
|
+
if (robot == null) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.player.head.updateWorldMatrix(true, false);
|
|
30
|
+
robot.updateWorldMatrix(true, false);
|
|
31
|
+
this.lookAtTarget.setFromMatrixPosition(this.player.head.matrixWorld);
|
|
32
|
+
this.robotPosition.setFromMatrixPosition(robot.matrixWorld);
|
|
33
|
+
this.lookAtTarget.y = this.robotPosition.y;
|
|
34
|
+
robot.lookAt(this.lookAtTarget);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
import { iwsdkDev } from '@iwsdk/vite-plugin-dev';
|
|
8
|
+
import { defineConfig } from 'vite';
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
plugins: [iwsdkDev()],
|
|
11
|
+
server: { host: '0.0.0.0', port: 8081, open: false },
|
|
12
|
+
build: {
|
|
13
|
+
outDir: 'dist',
|
|
14
|
+
sourcemap: process.env.NODE_ENV !== 'production',
|
|
15
|
+
target: 'esnext',
|
|
16
|
+
rollupOptions: { input: './index.html' },
|
|
17
|
+
},
|
|
18
|
+
esbuild: { target: 'esnext' },
|
|
19
|
+
optimizeDeps: {
|
|
20
|
+
exclude: ['@babylonjs/havok'],
|
|
21
|
+
esbuildOptions: { target: 'esnext' },
|
|
22
|
+
},
|
|
23
|
+
publicDir: 'public',
|
|
24
|
+
base: './',
|
|
25
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "iwsdk.scene.v1",
|
|
3
|
+
"units": "meters",
|
|
4
|
+
"components": {},
|
|
5
|
+
"resources": {},
|
|
6
|
+
"nodes": [
|
|
7
|
+
{
|
|
8
|
+
"id": "plant-sansevieria",
|
|
9
|
+
"name": "Plant Sansevieria",
|
|
10
|
+
"metadata": {
|
|
11
|
+
"iwsdk.validation": {
|
|
12
|
+
"allowFloating": true
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"content": {
|
|
16
|
+
"type": "asset",
|
|
17
|
+
"asset": "plant-sansevieria"
|
|
18
|
+
},
|
|
19
|
+
"transform": {
|
|
20
|
+
"position": [1.2, 0.2, -1.8],
|
|
21
|
+
"scale": 2
|
|
22
|
+
},
|
|
23
|
+
"components": {
|
|
24
|
+
"RayInteractable": {},
|
|
25
|
+
"DistanceGrabbable": {
|
|
26
|
+
"movementMode": "MoveFromTarget"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "robot",
|
|
32
|
+
"name": "Robot",
|
|
33
|
+
"metadata": {
|
|
34
|
+
"iwsdk.validation": {
|
|
35
|
+
"allowFloating": true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"content": {
|
|
39
|
+
"type": "asset",
|
|
40
|
+
"asset": "robot"
|
|
41
|
+
},
|
|
42
|
+
"transform": {
|
|
43
|
+
"position": [-1.2, 0.4, -1.8]
|
|
44
|
+
},
|
|
45
|
+
"components": {
|
|
46
|
+
"AudioSource": {
|
|
47
|
+
"src": "./audio/chime.mp3",
|
|
48
|
+
"maxInstances": 3,
|
|
49
|
+
"playbackMode": "fade-restart"
|
|
50
|
+
},
|
|
51
|
+
"RayInteractable": {},
|
|
52
|
+
"Robot": {}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "welcome-panel",
|
|
57
|
+
"name": "Welcome Panel",
|
|
58
|
+
"content": {
|
|
59
|
+
"type": "asset",
|
|
60
|
+
"asset": "welcome-panel"
|
|
61
|
+
},
|
|
62
|
+
"transform": {
|
|
63
|
+
"position": [0, 1.6, -2],
|
|
64
|
+
"scale": 0.4
|
|
65
|
+
},
|
|
66
|
+
"components": {
|
|
67
|
+
"RayInteractable": {},
|
|
68
|
+
"ScreenSpace": {
|
|
69
|
+
"top": "20px",
|
|
70
|
+
"left": "20px",
|
|
71
|
+
"width": "25vw",
|
|
72
|
+
"height": "40%"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": "webxr-banner",
|
|
78
|
+
"name": "WebXR Banner",
|
|
79
|
+
"metadata": {
|
|
80
|
+
"iwsdk.validation": {
|
|
81
|
+
"allowFloating": true
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"content": {
|
|
85
|
+
"type": "asset",
|
|
86
|
+
"asset": "webxr-banner"
|
|
87
|
+
},
|
|
88
|
+
"transform": {
|
|
89
|
+
"position": [0, 1, 1.8],
|
|
90
|
+
"rotationDeg": [0, 180, 0],
|
|
91
|
+
"scale": [1, -1, 1]
|
|
92
|
+
},
|
|
93
|
+
"components": {}
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "iwsdk.scene.v1",
|
|
3
|
+
"units": "meters",
|
|
4
|
+
"components": {
|
|
5
|
+
"com.iwsdk.components.DomeGradient": {
|
|
6
|
+
"sky": [0.2423, 0.6172, 0.8308, 1],
|
|
7
|
+
"equator": [0.6584, 0.7084, 0.7913, 1],
|
|
8
|
+
"ground": [0.807, 0.7758, 0.7454, 1],
|
|
9
|
+
"intensity": 1
|
|
10
|
+
},
|
|
11
|
+
"com.iwsdk.components.IBLGradient": {
|
|
12
|
+
"sky": [0.6902, 0.749, 0.7843, 1],
|
|
13
|
+
"equator": [0.6584, 0.7084, 0.7913, 1],
|
|
14
|
+
"ground": [0.807, 0.7758, 0.7454, 1],
|
|
15
|
+
"intensity": 1
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"resources": {},
|
|
19
|
+
"nodes": [
|
|
20
|
+
{
|
|
21
|
+
"id": "environment",
|
|
22
|
+
"name": "Environment",
|
|
23
|
+
"content": {
|
|
24
|
+
"type": "asset",
|
|
25
|
+
"asset": "environment-desk"
|
|
26
|
+
},
|
|
27
|
+
"transform": {
|
|
28
|
+
"position": [0, -0.106921583, 0],
|
|
29
|
+
"rotationDeg": [0, 180, 0]
|
|
30
|
+
},
|
|
31
|
+
"components": {
|
|
32
|
+
"LocomotionEnvironment": {}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "plant-sansevieria",
|
|
37
|
+
"name": "Plant Sansevieria",
|
|
38
|
+
"content": {
|
|
39
|
+
"type": "asset",
|
|
40
|
+
"asset": "plant-sansevieria"
|
|
41
|
+
},
|
|
42
|
+
"transform": {
|
|
43
|
+
"position": [1.2, 0.85, -1.8]
|
|
44
|
+
},
|
|
45
|
+
"components": {
|
|
46
|
+
"RayInteractable": {},
|
|
47
|
+
"DistanceGrabbable": {
|
|
48
|
+
"movementMode": "MoveFromTarget"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "robot",
|
|
54
|
+
"name": "Robot",
|
|
55
|
+
"content": {
|
|
56
|
+
"type": "asset",
|
|
57
|
+
"asset": "robot"
|
|
58
|
+
},
|
|
59
|
+
"transform": {
|
|
60
|
+
"position": [-1.2, 0.95, -1.8],
|
|
61
|
+
"scale": 0.5
|
|
62
|
+
},
|
|
63
|
+
"components": {
|
|
64
|
+
"AudioSource": {
|
|
65
|
+
"src": "./audio/chime.mp3",
|
|
66
|
+
"maxInstances": 3,
|
|
67
|
+
"playbackMode": "fade-restart"
|
|
68
|
+
},
|
|
69
|
+
"RayInteractable": {},
|
|
70
|
+
"Robot": {}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"id": "welcome-panel",
|
|
75
|
+
"name": "Welcome Panel",
|
|
76
|
+
"content": {
|
|
77
|
+
"type": "asset",
|
|
78
|
+
"asset": "welcome-panel"
|
|
79
|
+
},
|
|
80
|
+
"transform": {
|
|
81
|
+
"position": [0, 1.6, -2],
|
|
82
|
+
"scale": 0.4
|
|
83
|
+
},
|
|
84
|
+
"components": {
|
|
85
|
+
"RayInteractable": {},
|
|
86
|
+
"ScreenSpace": {
|
|
87
|
+
"top": "20px",
|
|
88
|
+
"left": "20px",
|
|
89
|
+
"width": "25vw",
|
|
90
|
+
"height": "40%"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "webxr-banner",
|
|
96
|
+
"name": "WebXR Banner",
|
|
97
|
+
"content": {
|
|
98
|
+
"type": "asset",
|
|
99
|
+
"asset": "webxr-banner"
|
|
100
|
+
},
|
|
101
|
+
"transform": {
|
|
102
|
+
"position": [0, 1, 1.8],
|
|
103
|
+
"rotationDeg": [0, 180, 0],
|
|
104
|
+
"scale": [1, -1, 1]
|
|
105
|
+
},
|
|
106
|
+
"components": {}
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iwsdk/create",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Interactive CLI to scaffold Immersive Web SDK starter apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -9,8 +9,23 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/cli.js",
|
|
12
|
+
"dist/guidance",
|
|
13
|
+
"dist/template",
|
|
14
|
+
"scripts/verify-release-ready.mjs",
|
|
12
15
|
"README.md"
|
|
13
16
|
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"prebuild": "node scripts/gen-version.cjs && node scripts/build-template.mjs",
|
|
19
|
+
"prepublishOnly": "corepack pnpm@10.18.3 build && corepack pnpm@10.18.3 verify:release-ready",
|
|
20
|
+
"build": "rollup -c",
|
|
21
|
+
"dev": "corepack pnpm@10.18.3 -s build && node dist/cli.js",
|
|
22
|
+
"watch": "rollup -c --watch",
|
|
23
|
+
"clean": "rm -rf dist",
|
|
24
|
+
"test": "corepack pnpm@10.18.3 --filter @iwsdk/scene-composition build && corepack pnpm@10.18.3 --filter @iwsdk/cli build && corepack pnpm@10.18.3 build && vitest run",
|
|
25
|
+
"test:watch": "vitest",
|
|
26
|
+
"test:coverage": "vitest run --coverage",
|
|
27
|
+
"verify:release-ready": "node scripts/verify-release-ready.mjs"
|
|
28
|
+
},
|
|
14
29
|
"keywords": [
|
|
15
30
|
"create",
|
|
16
31
|
"cli",
|
|
@@ -29,30 +44,21 @@
|
|
|
29
44
|
"node": ">=20.19.0 <21.0.0-0 || >=22.12.0 <23.0.0-0 || >=24.0.0"
|
|
30
45
|
},
|
|
31
46
|
"dependencies": {
|
|
32
|
-
"@pmndrs/chef": "^0.1.9",
|
|
33
47
|
"cross-spawn": "^7.0.6",
|
|
34
48
|
"chalk": "^5.6.2",
|
|
35
49
|
"commander": "^14.0.0",
|
|
36
|
-
"fast-xml-parser": "^4.5.1",
|
|
37
50
|
"semver": "^7.6.3",
|
|
38
51
|
"ora": "^8.2.0",
|
|
39
|
-
"prompts": "^2.4.2"
|
|
40
|
-
"prettier": "^3.0.3"
|
|
52
|
+
"prompts": "^2.4.2"
|
|
41
53
|
},
|
|
42
54
|
"devDependencies": {
|
|
55
|
+
"@iwsdk/cli": "workspace:*",
|
|
56
|
+
"@iwsdk/core": "workspace:*",
|
|
57
|
+
"@iwsdk/scene-composition": "workspace:*",
|
|
43
58
|
"@types/prompts": "^2.4.9",
|
|
44
59
|
"@types/semver": "^7.5.8",
|
|
45
60
|
"@types/cross-spawn": "^6.0.6",
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
"scripts": {
|
|
49
|
-
"prebuild": "node scripts/gen-version.cjs",
|
|
50
|
-
"build": "rollup -c",
|
|
51
|
-
"dev": "pnpm -s build && node dist/cli.js",
|
|
52
|
-
"watch": "rollup -c --watch",
|
|
53
|
-
"clean": "rm -rf dist",
|
|
54
|
-
"test": "vitest run",
|
|
55
|
-
"test:watch": "vitest",
|
|
56
|
-
"test:coverage": "vitest run --coverage"
|
|
61
|
+
"typescript": "^5.8.3",
|
|
62
|
+
"vitest": "^4.1.10"
|
|
57
63
|
}
|
|
58
|
-
}
|
|
64
|
+
}
|