|
1 | 1 | <!DOCTYPE html> |
| 2 | +<html> |
2 | 3 |
|
3 | 4 | <head> |
4 | 5 | <meta charset="utf-8"> |
|
39 | 40 | </script> |
40 | 41 | <script type="module"> |
41 | 42 | import * as THREE from "three"; |
42 | | - import { SplatMesh, SparkRenderer } from "@sparkjsdev/spark"; |
| 43 | + import { SplatMesh, SparkRenderer, PackedSplats } from "@sparkjsdev/spark"; |
43 | 44 | import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js"; |
44 | 45 | import { getAssetFileURL } from "/examples/js/get-asset-url.js"; |
45 | 46 |
|
|
55 | 56 | const spark = new SparkRenderer({ renderer }); |
56 | 57 |
|
57 | 58 | const splatURL = await getAssetFileURL("fireplace.spz"); |
58 | | - const background = new SplatMesh({ url: splatURL }); |
| 59 | + const packedSplats = new PackedSplats({ url: splatURL }); |
| 60 | + const background = new SplatMesh({ packedSplats }); |
59 | 61 | background.quaternion.set(1, 0, 0, 0); |
60 | 62 | background.position.set(0.5, 0, -1); |
61 | 63 | background.scale.setScalar(0.5); |
62 | 64 | scene.add(background); |
63 | 65 |
|
64 | | - const background2 = new SplatMesh({ url: splatURL }); |
| 66 | + const background2 = new SplatMesh({ packedSplats }); |
65 | 67 | background2.quaternion.set(1, 0, 0, 0); |
66 | 68 | background2.rotation.y = Math.PI; |
67 | 69 | background2.position.set(-0.5, 0, 0.0); |
|
81 | 83 | scene.add(duck); |
82 | 84 |
|
83 | 85 | let lastTime; |
| 86 | + let renderedEnvMap = false; |
84 | 87 | renderer.setAnimationLoop(function animate(time) { |
85 | 88 | const deltaTime = time - (lastTime || time); |
86 | 89 | lastTime = time; |
|
0 commit comments