This commit is contained in:
@ -20,9 +20,15 @@
|
||||
env: { hdrPath: '/hdr/my.env', intensity: 1.2, rotationY: 0.3 },
|
||||
};
|
||||
|
||||
console.log(window.faceSDK , window.faceSDK.kernel);
|
||||
|
||||
console.log(window.faceSDK, window.faceSDK && window.faceSDK.kernel);
|
||||
|
||||
const kernel = window.faceSDK && window.faceSDK.kernel;
|
||||
if (!kernel) {
|
||||
console.error('SDK 全局构建未正确加载,请检查脚本地址是否可访问');
|
||||
}
|
||||
|
||||
if (!kernel) return;
|
||||
|
||||
kernel.init(config);
|
||||
|
||||
|
||||
@ -46,4 +52,4 @@
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
42
index copy.html
Normal file
42
index copy.html
Normal file
@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>3D模型展示SDK - TS版</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
overflow: hidden;
|
||||
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
||||
}
|
||||
#app { width: 100vw; height: 100vh; position: relative; }
|
||||
#renderDom { width: 100%; height: 100%; display: block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<canvas id="renderDom"></canvas>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
import { kernel } from '/src/main.ts';
|
||||
|
||||
const config = {
|
||||
container: 'renderDom',
|
||||
modelUrlList: ["/model/model.glb"],
|
||||
animationUrlList: [],
|
||||
idleAnimationUrlList: [],
|
||||
onSuccess: () => console.log('SDK initialized'),
|
||||
onError: (err) => console.error('SDK init error', err),
|
||||
};
|
||||
|
||||
kernel.init(config);
|
||||
|
||||
|
||||
window.faceSDK = { kernel };
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -10,8 +10,8 @@ export default defineConfig({
|
||||
lib: {
|
||||
entry: 'src/main.ts',
|
||||
name: 'kernel',
|
||||
formats: ['esm'],
|
||||
fileName: () => 'assets/index.js',
|
||||
formats: ['es', 'iife'],
|
||||
fileName: (format) => format === 'es' ? 'assets/index.js' : 'assets/index.global.js',
|
||||
},
|
||||
target: 'esnext',
|
||||
outDir: 'dist',
|
||||
|
||||
Reference in New Issue
Block a user