Selaa lähdekoodia

Clear Reimport test

master
Palash Bansal 11 kuukautta sitten
vanhempi
commit
a39beeb439
No account linked to committer's email address

+ 64
- 0
examples/clear-reimport-test/index.html Näytä tiedosto

@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Clear + Reimport Test with config</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Import maps polyfill -->
<!-- Remove this when import maps will be widely supported -->
<script async src="https://unpkg.com/es-module-shims@1.6.3/dist/es-module-shims.js"></script>

<script type="importmap">
{
"imports": {
"threepipe": "./../../dist/index.mjs"
}
}

</script>
<style id="example-style">
html, body, #canvas-container, #mcanvas {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
}
</style>
<script type="module" src="../examples-utils/global-loading.mjs"></script>
<script type="module" src="../examples-utils/simple-code-preview.mjs"></script>
<script id="example-script" type="module">
import {_testFinish, _testStart, ThreeViewer, timeout, Color} from 'threepipe'

const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas')})

async function init() {

viewer.deleteImportedViewerConfigOnLoad = true
viewer.deleteImportedViewerConfigOnLoadWait = 2000
const model3 = await viewer.load('https://asset-samples.threepipe.org/demos/classic-watch.glb')
console.log(model3.children.length)
viewer.scene.backgroundColor = new Color(0x000000)
await timeout(500)
viewer.scene.clearSceneModels()
await timeout(500)
// should load white bg
const model4 = await viewer.load('https://asset-samples.threepipe.org/demos/classic-watch.glb')
console.log(model3.children.length, model4.children.length)
viewer.scene.backgroundColor = new Color(0xff0000)
await timeout(500)
viewer.scene.clearSceneModels()
await timeout(500)
// should not change bg with console warn
const model5 = await viewer.load('https://asset-samples.threepipe.org/demos/classic-watch.glb')
}

_testStart()
init().finally(_testFinish)
</script>
</head>
<body>
<div id="canvas-container">
<canvas id="mcanvas"></canvas>
</div>

</body>

+ 3
- 13
examples/dispose-reimport-test-2/index.html Näytä tiedosto

@@ -33,23 +33,13 @@

async function init() {

viewer.deleteImportedViewerConfigOnLoad = true
viewer.deleteImportedViewerConfigOnLoadWait = 2000
const model3 = await viewer.load('https://asset-samples.threepipe.org/demos/classic-watch.glb')
console.log(model3.children.length)
const model = await viewer.load('https://asset-samples.threepipe.org/demos/classic-watch.glb')
viewer.scene.backgroundColor = new Color(0x000000)
await timeout(500)
viewer.scene.clearSceneModels()
viewer.scene.disposeSceneModels()
await timeout(500)
// should load white bg
const model4 = await viewer.load('https://asset-samples.threepipe.org/demos/classic-watch.glb')
console.log(model3.children.length, model4.children.length)
viewer.scene.backgroundColor = new Color(0xff0000)
await timeout(500)
viewer.scene.clearSceneModels()
await timeout(500)
// should not change bg with console warn
const model5 = await viewer.load('https://asset-samples.threepipe.org/demos/classic-watch.glb')
const model2 = await viewer.load('https://asset-samples.threepipe.org/demos/classic-watch.glb')
}

_testStart()

+ 1
- 0
examples/index.html Näytä tiedosto

@@ -554,6 +554,7 @@
<li><a href="./gltf-transmission-test-msaa-zprepass/">glTF Transmission Test + MSAA + zPrepass</a></li>
<li><a href="./dispose-reimport-test/">Dispose + Reimport (URL)</a></li>
<li><a href="./dispose-reimport-test-2/">Dispose + Reimport (URL, Root)</a></li>
<li><a href="./clear-reimport-test/">Clear + Reimport (URL, Root)</a></li>
</ul>
</div>
<div class="iframe-container">

Loading…
Peruuta
Tallenna