新增兼容层,适配WebCAD v16材质版本
This commit is contained in:
1 parent
ae9d88c6d7
commit
fc94b6721a
10 files changed
+516
-29
No files matched your search
@@ -0,0 +1,36 @@
|
||||
<!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>
|
||||
Reference in new issue
Block a user