chg: clean-up preview

This commit is contained in:
Boris Nikolaev
2026-06-08 01:01:37 +03:00
parent 5ad44e128b
commit 6c169a3a18
3 changed files with 1 additions and 101 deletions
+1 -10
View File
@@ -8,16 +8,7 @@
style="border: 1px solid #30363d; border-radius: 8px;" style="border: 1px solid #30363d; border-radius: 8px;"
allow="autoplay" allow="autoplay"
sandbox="allow-scripts allow-same-origin allow-popups allow-forms" sandbox="allow-scripts allow-same-origin allow-popups allow-forms"
title="3D Model Preview"> title="3D Preview">
</iframe>
<iframe
src="https://git.boris-code.ru/boris-code/dq8chr2glb/raw/branch/main/viewer.html"
width="100%"
height="500"
style="border: 1px solid #30363d; border-radius: 8px;"
allow="autoplay"
title="3D Model Preview 2">
</iframe> </iframe>
Convert Dragon Quest VIII (PS2) character models to modern 3D format. Convert Dragon Quest VIII (PS2) character models to modern 3D format.
-91
View File
@@ -1,91 +0,0 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.160.0/build/three.module.js"
}
}
</script>
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.4.0/model-viewer.min.js"></script>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
model-viewer {
width: 100vw;
height: 100vh;
background-color: #111111;
}
</style>
</head>
<body>
<model-viewer
id="model-viewer"
src="model.glb"
alt=""
camera-controls
autoplay
loop
environment-image="neutral"
shadow-intensity="0"
animation-name="走り"
>
</model-viewer>
<script type="module">
import * as THREE from 'three';
const viewer = document.querySelector('#model-viewer');
viewer.addEventListener('load', () => {
const model = viewer.model;
const symbols = Object.getOwnPropertySymbols(model);
const materialsSymbol = symbols.find(sym => sym.toString() === 'Symbol(materials)');
if (materialsSymbol && model[materialsSymbol]) {
const materials = model[materialsSymbol];
let updatedCount = 0;
materials.forEach(matWrapper => {
const correlatedSymbol = Object.getOwnPropertySymbols(matWrapper)
.find(sym => sym.toString() === 'Symbol(correlatedObjects)');
if (correlatedSymbol && matWrapper[correlatedSymbol]) {
const threeObjects = matWrapper[correlatedSymbol];
threeObjects.forEach(obj => {
if (obj.isMaterial) {
obj.side = THREE.DoubleSide;
if (obj.isMeshStandardMaterial || obj.isMeshPhysicalMaterial) {
if (obj.map) {
obj.emissiveMap = obj.map;
obj.emissive = new THREE.Color(0xffffff);
obj.emissiveIntensity = 1.0;
} else {
obj.emissive = obj.color.clone();
obj.emissiveIntensity = 1.0;
}
obj.color.setHex(0x000000);
obj.metalness = 0;
obj.roughness = 1;
}
obj.needsUpdate = true;
updatedCount++;
}
});
}
});
}
});
</script>
</body>
</html>
BIN
View File
Binary file not shown.