36 lines
1.4 KiB
HTML
36 lines
1.4 KiB
HTML
<!doctype html>
|
|||
|
|
<html lang="zh-CN">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<title>材质导入回归验证</title>
|
||
|
|
<link rel="stylesheet" href="/dist/material-editor.css">
|
||
|
|
<style>body { margin: 0; } #app { height: 100vh; }</style>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div id="app"></div>
|
||
|
|
<script src="/dist/material-editor.iife.js"></script>
|
||
|
|
<script type="module">
|
||
|
|
import { FromDeflateBase64, ToDeflatedBase64 } from "/src/helpers/helper.material.ts";
|
||
|
|
|
||
|
|
const input = await fetch("/tests/fixtures/material-v24-v16.json").then(response => response.json());
|
||
|
|
// 使用本地图片;其他序列化数据与故障样例一致,无需访问业务服务器。
|
||
|
|
input[44] = "texture1.png";
|
||
|
|
window.materialSmoke = { input, submitted: [] };
|
||
|
|
const faces = ["right", "left", "top", "bottom", "front", "back"];
|
||
|
|
MaterialEditor.Mount("#app", {
|
||
|
|
host: location.origin,
|
||
|
|
envTextureSrc: faces.map(face => `/${face}.webp`),
|
||
|
|
grayEnvTextureSrc: faces.map(face => `/${face}-gray.webp`),
|
||
|
|
updateModel: { name: "材质1", file: ToDeflatedBase64(JSON.stringify(input)) },
|
||
|
|
submitCallback: materials => {
|
||
|
|
window.materialSmoke.submitted = materials.map(material => ({
|
||
|
|
name: material.name,
|
||
|
|
data: JSON.parse(FromDeflateBase64(material.file)),
|
||
|
|
logoSize: material.logo.size,
|
||
|
|
file: material.file,
|
||
|
|
}));
|
||
|
|
},
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|