feat(all): sdk 测试 index.html
This commit is contained in:
parent
5d7f479765
commit
8a1436d3a8
@ -2,25 +2,6 @@
|
||||
"name": "@deep/engine",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"main": "src/DeepEngine.es.js",
|
||||
"types": "./types/index.d.ts",
|
||||
"dependencies": {
|
||||
"camera-controls": "^3.1.2",
|
||||
"emittery": "^2.0.0",
|
||||
"lodash-es": "^4.18.1",
|
||||
"simplex-noise": "^4.0.3",
|
||||
"three": "catalog:",
|
||||
"three-bvh-csg": "^0.0.18",
|
||||
"three-is": "workspace:*",
|
||||
"three-mesh-bvh": "^0.9.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "catalog:",
|
||||
"@types/three": "catalog:",
|
||||
"@vue/tsconfig": "^0.9.1",
|
||||
"html2canvas": "^1.4.1",
|
||||
"typescript": "catalog:",
|
||||
"vite": "catalog:"
|
||||
}
|
||||
"main": "./public/DeepEngine.es.js",
|
||||
"types": "./types/index.d.ts"
|
||||
}
|
||||
57
packages/sdk/public/index.html
Normal file
57
packages/sdk/public/index.html
Normal file
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"three": "https://unpkg.com/three@0.184.0/build/three.webgpu.js",
|
||||
"three/webgpu": "https://unpkg.com/three@0.184.0/build/three.webgpu.js",
|
||||
"three/tsl": "https://unpkg.com/three@0.184.0/build/three.tsl.js",
|
||||
"three/examples/": "https://unpkg.com/three@0.184.0/examples/",
|
||||
"three/addons/": "https://unpkg.com/three@0.184.0/examples/jsm/",
|
||||
"@deep/engine":"./DeepEngine.es.js"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
html,body,#container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
|
||||
<script type="module">
|
||||
import * as THREE from 'three/webgpu';
|
||||
import {Tool, Viewer, ViewerEvents} from "@deep/engine";
|
||||
import {color} from "three/tsl"
|
||||
const viewer = new Viewer("container", {
|
||||
initCameraState: {
|
||||
position: {x: 5, y: 5, z: 5},
|
||||
target: {x: 0, y: 0, z: 0},
|
||||
},
|
||||
});
|
||||
viewer.emitter.once(ViewerEvents.INIT).then(() => {
|
||||
viewer.scene.backgroundNode = color("#aaaaaa");
|
||||
// 创建一个 box
|
||||
const geometry = new THREE.BoxGeometry(1, 1, 1);
|
||||
const material = new THREE.MeshBasicMaterial({
|
||||
color: 0x00ff00
|
||||
});
|
||||
const box = new THREE.Mesh(geometry, material);
|
||||
|
||||
// 设置位置
|
||||
box.position.set(0, 0.5, 0);
|
||||
|
||||
// 添加到场景
|
||||
viewer.scene.add(box);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,16 +0,0 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"types": ["vite/client"],
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": false,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
"target": "ES2023",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"types": ["node"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": false,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
import { defineConfig, loadEnv } from 'vite';
|
||||
import { dirname, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
export default defineConfig(async ({ mode, command }) => {
|
||||
const root = process.cwd();
|
||||
const env = loadEnv(mode, root);
|
||||
|
||||
const {
|
||||
VITE_PUBLIC_PATH
|
||||
} = env;
|
||||
|
||||
return {
|
||||
base: VITE_PUBLIC_PATH,
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'src/index.ts'),
|
||||
name: 'DeepEngine', // 打包后全局变量的名称
|
||||
fileName: (format: any) => `DeepEngine.${format}.js`,
|
||||
formats: ['es', 'umd']
|
||||
},
|
||||
outDir: "dist",
|
||||
sourcemap: false,
|
||||
// 规定触发警告的 chunk 大小。(以 kbs 为单位)
|
||||
chunkSizeWarningLimit: 1024 * 6,
|
||||
},
|
||||
plugins: [],
|
||||
optimizeDeps: {},
|
||||
server: {
|
||||
headers: {
|
||||
'Cross-Origin-Opener-Policy': 'same-origin',
|
||||
'Cross-Origin-Embedder-Policy': 'require-corp',
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user