Compare commits

5 Commits

Author SHA1 Message Date
BorisNikolaev 5b8a22b0dc Update README.md 2026-06-18 23:09:06 +03:00
Boris Nikolaev 6c169a3a18 chg: clean-up preview 2026-06-08 01:01:37 +03:00
Boris Nikolaev 5ad44e128b chg: preview path 2026-06-08 00:48:39 +03:00
Boris Nikolaev 7eb47677ef add: sandbox attr 2026-06-08 00:30:46 +03:00
Boris Nikolaev 91029ccbe7 chg: second preview 2026-06-08 00:17:16 +03:00
3 changed files with 3 additions and 93 deletions
+3 -2
View File
@@ -2,12 +2,13 @@
![](preview.jpg) ![](preview.jpg)
<iframe <iframe
src="https://boris-code.ru/files/ap002-preview/index.html" src="https://boris-code.ru/files/ap002-preview/?src=https://s3.boris-code.ru/public/projects/dq8/chr2glb/screenshots/model.glb&clip=%E8%B5%B0%E3%82%8A&view=unlit"
width="100%" width="100%"
height="500" height="500"
style="border: 1px solid #30363d; border-radius: 8px;" style="border: 1px solid #30363d; border-radius: 8px;"
allow="autoplay" allow="autoplay"
title="3D Model Preview"> sandbox="allow-scripts allow-same-origin allow-popups allow-forms"
title="3D Preview">
</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.