-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add msaa transmission test, Add multi viewer test, Add LegacyPhongMat…
…erial, Allow custom numeric samples in msaa, temporary fix for transmission not working with msaa, circular import fixes, stats.js position fix, disable debug by default in ThreeViewer.
- Loading branch information
Showing
23 changed files
with
520 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>GLTF Transmission Test (MSAA)</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", | ||
"@threepipe/plugin-tweakpane": "./../../plugins/tweakpane/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/simple-code-preview.mjs"></script> | ||
<script id="example-script" type="module" src="./script.js" data-scripts="./script.ts;./script.js"></script> | ||
</head> | ||
<body> | ||
<div id="canvas-container"> | ||
<canvas id="mcanvas"></canvas> | ||
</div> | ||
|
||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import {_testFinish, IObject3D, RenderTargetPreviewPlugin, ThreeViewer} from 'threepipe' | ||
import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||
|
||
const viewer = new ThreeViewer({ | ||
canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||
msaa: true, | ||
rgbm: true, | ||
zPrepass: false, | ||
}) | ||
|
||
async function init() { | ||
|
||
const targetPreview = viewer.addPluginSync(RenderTargetPreviewPlugin) | ||
targetPreview.addTarget(()=>viewer.renderManager.composerTarget, 'composer-1', false, false) | ||
viewer.renderManager.renderPass.preserveTransparentTarget = true | ||
targetPreview.addTarget(()=>viewer.renderManager.renderPass.transparentTarget, 'transparent', true, true) | ||
targetPreview.addTarget(()=>viewer.renderManager.composerTarget2, 'composer-2', false, false) | ||
|
||
await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr') | ||
const [model, model2] = await Promise.all([ | ||
viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/IridescenceLamp.glb', { | ||
autoCenter: true, | ||
autoScale: true, | ||
}), | ||
viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/IridescentDishWithOlives.glb', { | ||
autoCenter: true, | ||
autoScale: true, | ||
}), | ||
]) | ||
|
||
if (!model || !model2) { | ||
console.error('model not loaded') | ||
return | ||
} | ||
model.position.x = -1 | ||
model2.position.x = 1 | ||
model2.position.y = -1.2 | ||
|
||
const ui = viewer.addPluginSync(new TweakpaneUiPlugin(false)) | ||
|
||
const m1 = model?.getObjectByName('lamp_transmission') | ||
const m2 = model2?.getObjectByName('glassCover') | ||
const materials = [...m1?.materials || [], ...m2?.materials || []] | ||
for (const material of materials) { | ||
const config = material.uiConfig | ||
if (!config) continue | ||
ui.appendChild(config) | ||
} | ||
|
||
} | ||
|
||
init().then(_testFinish) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Multiple Viewers Test</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, .mcanvas, .container { | ||
width: 100%; | ||
height: 100%; | ||
margin: 0; | ||
overflow: hidden; | ||
} | ||
.container{ | ||
display: grid; | ||
grid-template-columns: 1fr 1fr; | ||
grid-template-rows: 1fr 1fr; | ||
} | ||
.canvas-container{ | ||
position: relative; | ||
width: 100%; | ||
height: 100%; | ||
overflow: hidden; | ||
outline: 1px solid #464646; | ||
} | ||
</style> | ||
<script type="module" src="../examples-utils/simple-code-preview.mjs"></script> | ||
<script id="example-script" type="module" src="./script.js" data-scripts="./script.ts;./script.js"></script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="canvas-container"> | ||
<canvas id="mcanvas1" class="mcanvas"></canvas> | ||
</div> | ||
<div class="canvas-container"> | ||
<canvas id="mcanvas2" class="mcanvas"></canvas> | ||
</div> | ||
<div class="canvas-container"> | ||
<canvas id="mcanvas3" class="mcanvas"></canvas> | ||
</div> | ||
<div class="canvas-container"> | ||
<canvas id="mcanvas4" class="mcanvas"></canvas> | ||
</div> | ||
</div> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import {_testFinish, ThreeViewer} from 'threepipe' | ||
|
||
const models = [ | ||
'https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', | ||
'https://threejs.org/examples/models/fbx/Samba Dancing.fbx', | ||
'https://threejs.org/examples/models/draco/bunny.drc', | ||
'https://threejs.org/examples/models/gltf/kira.glb', | ||
] | ||
|
||
async function init(i: number) { | ||
|
||
const viewer = new ThreeViewer({ | ||
canvas: document.getElementById('mcanvas' + (i + 1)) as HTMLCanvasElement, | ||
msaa: true, | ||
debug: true, | ||
dropzone: { | ||
allowedExtensions: ['gltf', 'glb', 'hdr', 'bin', 'png', 'jpeg', 'webp', 'jpg', 'exr'], | ||
addOptions: { | ||
disposeSceneObjects: true, | ||
autoSetEnvironment: true, // when hdr is dropped | ||
autoSetBackground: true, | ||
}, | ||
}, | ||
}) | ||
|
||
await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr', { | ||
// setBackground: true, | ||
}) | ||
const result = await viewer.load(models[i], { | ||
autoCenter: true, | ||
autoScale: true, | ||
}) | ||
console.log(result) | ||
|
||
} | ||
|
||
Promise.all(new Array(4).fill(0).map(async(_, i) => init(i))).then(_testFinish) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.