@needle-tools/gltf-progressive 1.2.4-beta.1 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -0
- package/dist/CHANGELOG.md +139 -0
- package/dist/README.md +125 -0
- package/dist/examples/modelviewer-multiple.html +125 -0
- package/dist/examples/modelviewer.html +33 -0
- package/dist/examples/react-three-fiber/.prettierrc +10 -0
- package/dist/examples/react-three-fiber/favicon.png +0 -0
- package/dist/examples/react-three-fiber/index.html +24 -0
- package/dist/examples/react-three-fiber/package-lock.json +4023 -0
- package/dist/examples/react-three-fiber/package.json +34 -0
- package/dist/examples/react-three-fiber/tsconfig.json +22 -0
- package/dist/examples/react-three-fiber/vite.config.js +39 -0
- package/dist/examples/threejs/index.html +51 -0
- package/dist/examples/threejs/main.js +181 -0
- package/{gltf-progressive.js → dist/gltf-progressive.js} +166 -154
- package/{gltf-progressive.min.js → dist/gltf-progressive.min.js} +6 -6
- package/{gltf-progressive.umd.cjs → dist/gltf-progressive.umd.cjs} +7 -7
- package/{lib → dist/lib}/lods_manager.d.ts +1 -0
- package/{lib → dist/lib}/lods_manager.js +21 -2
- package/{lib → dist/lib}/version.js +1 -1
- package/dist/package.json +60 -0
- package/examples/modelviewer-multiple.html +1 -1
- package/examples/modelviewer.html +1 -1
- package/package.json +73 -59
- package/tsconfig.json +42 -0
- /package/{lib → dist/lib}/extension.d.ts +0 -0
- /package/{lib → dist/lib}/extension.js +0 -0
- /package/{lib → dist/lib}/index.d.ts +0 -0
- /package/{lib → dist/lib}/index.js +0 -0
- /package/{lib → dist/lib}/loaders.d.ts +0 -0
- /package/{lib → dist/lib}/loaders.js +0 -0
- /package/{lib → dist/lib}/plugins/index.d.ts +0 -0
- /package/{lib → dist/lib}/plugins/index.js +0 -0
- /package/{lib → dist/lib}/plugins/modelviewer.d.ts +0 -0
- /package/{lib → dist/lib}/plugins/modelviewer.js +0 -0
- /package/{lib → dist/lib}/plugins/plugin.d.ts +0 -0
- /package/{lib → dist/lib}/plugins/plugin.js +0 -0
- /package/{lib → dist/lib}/utils.d.ts +0 -0
- /package/{lib → dist/lib}/utils.internal.d.ts +0 -0
- /package/{lib → dist/lib}/utils.internal.js +0 -0
- /package/{lib → dist/lib}/utils.js +0 -0
- /package/{lib → dist/lib}/version.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.2.5] - 2023-07-09
|
|
8
|
+
- Remove: Frustum cull check because we're already operating on the latest renderlist
|
|
9
|
+
|
|
10
|
+
## [1.2.5-beta] - 2023-07-09
|
|
11
|
+
- Change: Update skinned mesh bounding box every 30 frames using the lowres mesh version
|
|
12
|
+
|
|
7
13
|
## [1.2.4-beta.1] - 2023-07-09
|
|
8
14
|
- Add: LODsManager `manual` property which can be used to manually update the LODs in the scene by calling `LODsManager.update(scene, camera)`
|
|
9
15
|
- Fix: updating LODs in WebXR
|
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ Examples are in the `/examples` directory. Live versions can be found in the lin
|
|
|
17
17
|
- \<model-viewer\>
|
|
18
18
|
- [single \<model-viewer> element](https://engine.needle.tools/demos/gltf-progressive/modelviewer)
|
|
19
19
|
- [multiple \<model-viewer> elements](https://engine.needle.tools/demos/gltf-progressive/modelviewer-multiple)
|
|
20
|
+
- [Needle Engine](https://stackblitz.com/edit/needle-engine-gltf-progressive?file=src%2Fmain.ts)
|
|
20
21
|
|
|
21
22
|
**Interactive Examples**:
|
|
22
23
|
- [Stackblitz](https://stackblitz.com/@marwie/collections/gltf-progressive)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this package will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [1.2.5-beta] - 2023-07-09
|
|
8
|
+
- Change: Update skinned mesh bounding box every 30 frames using the lowres mesh version
|
|
9
|
+
|
|
10
|
+
## [1.2.4-beta.1] - 2023-07-09
|
|
11
|
+
- Add: LODsManager `manual` property which can be used to manually update the LODs in the scene by calling `LODsManager.update(scene, camera)`
|
|
12
|
+
- Fix: updating LODs in WebXR
|
|
13
|
+
|
|
14
|
+
## [1.2.4-beta] - 2023-07-05
|
|
15
|
+
- Change: `createLoaders` now returns created loaders and decoders to be re-used
|
|
16
|
+
|
|
17
|
+
## [1.2.3-beta] - 2023-07-04
|
|
18
|
+
- Add: support for transmissive objects
|
|
19
|
+
|
|
20
|
+
## [1.2.3-alpha.3] - 2023-07-01
|
|
21
|
+
- Add: prevent loading highres textures when user has enabled data-save mode
|
|
22
|
+
|
|
23
|
+
## [1.2.3-alpha.2] - 2023-06-27
|
|
24
|
+
- Fix: error caused by parser associations containing `undefined` value
|
|
25
|
+
|
|
26
|
+
## [1.2.3-alpha.1] - 2023-06-25
|
|
27
|
+
- Internal: rename `setRaycastMesh` to `registerRaycastMesh`
|
|
28
|
+
|
|
29
|
+
## [1.2.3-alpha] - 2023-06-24
|
|
30
|
+
- Change: automatically change LOD update interval based on framerate
|
|
31
|
+
|
|
32
|
+
## [1.2.2-alpha.4] - 2023-06-20
|
|
33
|
+
- Add: Register version in global "GLTF_PROGRESSIVE_VERSION" variable
|
|
34
|
+
- Add: `<model-viewer>` elements added document at any time are now properly registered
|
|
35
|
+
- Fix: LOD updates for multiple `<model-viewer>` elements
|
|
36
|
+
- Fix: Initial render tick for a few frames for `<model-viewer>` to trigger LOD updates when the model-viewer element is not animated or interacted with
|
|
37
|
+
- Change: `<model-viewer>` elements will fetch a slightly higher texture LOD
|
|
38
|
+
|
|
39
|
+
## [1.2.1-alpha.4] - 2023-06-19
|
|
40
|
+
- Fix: SkinnedMesh bounds calculation
|
|
41
|
+
|
|
42
|
+
## [1.2.1-alpha.3] - 2023-06-15
|
|
43
|
+
- update the README
|
|
44
|
+
|
|
45
|
+
## [1.2.1-alpha.2] - 2023-06-15
|
|
46
|
+
- fix: Ortographic camera causing LODs being falsely updated
|
|
47
|
+
- fix: regression introduced in 1.2.1-alpha
|
|
48
|
+
- fix: error when trying to load a LOD glTF directly
|
|
49
|
+
- fix: issues caused by instanceof in local development environments
|
|
50
|
+
|
|
51
|
+
## [1.2.0-alpha.9] - 2023-06-13
|
|
52
|
+
- fix: issue where skinned mesh matrix was falsely applied to calculate screen size
|
|
53
|
+
- fix: use bounding box from SkinnedMesh object
|
|
54
|
+
|
|
55
|
+
## [1.2.0-alpha.6] - 2023-06-12
|
|
56
|
+
- fix: minor bug where opened glTF has `NEEDLE_progressive` extension but no lods array because the glTF is a LOD variant
|
|
57
|
+
|
|
58
|
+
## [1.2.0-alpha.5] - 2023-06-10
|
|
59
|
+
- fix: safeguard when `registerMesh` or `registerTexture` are being called with invalid data
|
|
60
|
+
- examples: update vanilla threejs example
|
|
61
|
+
|
|
62
|
+
## [1.2.0-alpha.4] - 2023-06-07
|
|
63
|
+
- add: `useRaycastMeshes` method:
|
|
64
|
+
```ts
|
|
65
|
+
// call to enable raycasting with low poly raycast meshes
|
|
66
|
+
// this can be done once in your project
|
|
67
|
+
useRaycastMeshes(true);
|
|
68
|
+
|
|
69
|
+
// then use the raycaster as usual
|
|
70
|
+
const raycaster = new Raycaster();
|
|
71
|
+
raycaster.setFromCamera(mouse, camera);
|
|
72
|
+
const intersects = raycaster.intersectObjects(scene.children, true);
|
|
73
|
+
|
|
74
|
+
// call to disable raycasting with low polwy meshes
|
|
75
|
+
useRaycastMeshes(false);
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## [1.2.0-alpha.3] - 2023-06-06
|
|
79
|
+
- add: automatically load the highest LOD first to show a slightly better quality level as soon as possible
|
|
80
|
+
- fix: improve Texture LOD selection by taking LOD level height into account
|
|
81
|
+
- fix: correctly assign LOD level information to initially loaded texture
|
|
82
|
+
|
|
83
|
+
## [1.1.0-alpha.2] - 2023-06-05
|
|
84
|
+
- fix: register LOD information for meshes that don't have associations
|
|
85
|
+
|
|
86
|
+
## [1.1.0-alpha] - 2023-06-03
|
|
87
|
+
- add: loading of multiple texture LOD levels
|
|
88
|
+
- fix: issue where material LODs where not updated when the material was cloned
|
|
89
|
+
- change: clamp screen coverage when near plane intersects with the object bounds
|
|
90
|
+
- change: skip CubeCamera setup
|
|
91
|
+
- change: handle cases where an object has only texture LODs
|
|
92
|
+
|
|
93
|
+
## [1.0.0-alpha.19] - 2023-05-31
|
|
94
|
+
- add `LODsManager.plugins` getter
|
|
95
|
+
|
|
96
|
+
## [1.0.0-alpha.18] - 2023-05-30
|
|
97
|
+
- update README
|
|
98
|
+
|
|
99
|
+
## [1.0.0-alpha.16] - 2023-05-29
|
|
100
|
+
- fix: LODs manager now clamps to LOD 0 if the near plane is inside the bounds
|
|
101
|
+
- change: Ignore certain material in lods update loop
|
|
102
|
+
|
|
103
|
+
## [1.0.0-alpha.15] - 2023-05-25
|
|
104
|
+
- add: `getRaycastMesh` method
|
|
105
|
+
- add: LODsManager does now expose `targetTriangleDensity`. The target triangle density is the desired max amount of triangles on screen when the mesh is filling the screen.
|
|
106
|
+
- change: create LODsManager via `LODsManager.get(renderer)`
|
|
107
|
+
|
|
108
|
+
## [1.0.0-alpha.13] - 2023-05-24
|
|
109
|
+
- fix: modelviewer error when trying to access undefined texture extensions
|
|
110
|
+
|
|
111
|
+
## [1.0.0-alpha.13] - 2023-05-24
|
|
112
|
+
- add: vanilla three.js example
|
|
113
|
+
- fix: texture LODs losing filter setting
|
|
114
|
+
|
|
115
|
+
## [1.0.0-alpha.12] - 2023-05-19
|
|
116
|
+
- fix: update LODs when using postprocessing
|
|
117
|
+
|
|
118
|
+
## [1.0.0-alpha.11] - 2023-05-17
|
|
119
|
+
- add: expose `setDracoDecoderLocation` and `setKTX2TranscoderLocation`
|
|
120
|
+
- fix: allow using draco decoder and ktx2 transcoder from local filepath
|
|
121
|
+
|
|
122
|
+
## [1.0.0-alpha.10] - 2023-05-07
|
|
123
|
+
- fix: progressive assets are now only updated during the main canvas render call and not e.g. when rendering to a texture
|
|
124
|
+
|
|
125
|
+
## [1.0.0-alpha.9] - 2023-05-03
|
|
126
|
+
- fix: handle loading of ShaderMaterial for VRM progressive textures
|
|
127
|
+
|
|
128
|
+
## [1.0.0-alpha.8] - 2023-05-03
|
|
129
|
+
- fix: handle transparent materials
|
|
130
|
+
|
|
131
|
+
## [1.0.0-alpha.7] - 2023-05-01
|
|
132
|
+
- fix: Handle modelviewer `src` set as property but not as attribute
|
|
133
|
+
- change: Remove sourcemap
|
|
134
|
+
|
|
135
|
+
## [1.0.0-alpha.6] - 2023-05-01
|
|
136
|
+
- fix: LOD mesh assignment for multi-material meshes (meshes with multiple primitives)
|
|
137
|
+
|
|
138
|
+
## [1.0.0-alpha.5] - 2023-04-30
|
|
139
|
+
- initial version
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# glTF progressive
|
|
2
|
+
|
|
3
|
+
Support for loading of glTF or GLB files with progressive mesh or texture data for three.js based engines.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
- Automatic loading of mesh and texture LODs.
|
|
7
|
+
- High quality LOD levels are loaded on demand based on screen density.
|
|
8
|
+
- Use low-poly LOD meshes for raycasting which allows the usage of high-poly meshes with smooth interaction
|
|
9
|
+
- Use [cloud.needle.tools](https://cloud.needle.tools) for processing glTF, GLB & VRM assets
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
Examples are in the `/examples` directory. Live versions can be found in the links below.
|
|
14
|
+
|
|
15
|
+
- [Vanilla three.js](https://engine.needle.tools/demos/gltf-progressive/threejs/) - multiple models and animations
|
|
16
|
+
- [React Three Fiber](https://engine.needle.tools/demos/gltf-progressive/r3f/)
|
|
17
|
+
- \<model-viewer\>
|
|
18
|
+
- [single \<model-viewer> element](https://engine.needle.tools/demos/gltf-progressive/modelviewer)
|
|
19
|
+
- [multiple \<model-viewer> elements](https://engine.needle.tools/demos/gltf-progressive/modelviewer-multiple)
|
|
20
|
+
- [Needle Engine](https://stackblitz.com/edit/needle-engine-gltf-progressive?file=src%2Fmain.ts)
|
|
21
|
+
|
|
22
|
+
**Interactive Examples**:
|
|
23
|
+
- [Stackblitz](https://stackblitz.com/@marwie/collections/gltf-progressive)
|
|
24
|
+
- [Codesandbox](https://codesandbox.io/dashboard/sandboxes/gltf-progressive)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<br/>
|
|
28
|
+
<video width="320" controls autoplay src="https://engine.needle.tools/demos/gltf-progressive/video.mp4">
|
|
29
|
+
<source src="https://engine.needle.tools/demos/gltf-progressive/video.mp4" type="video/mp4">
|
|
30
|
+
</video>
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### react three fiber
|
|
36
|
+
|
|
37
|
+
Full example in `examples/react-three-fiber`
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
function ChurchModel() {
|
|
41
|
+
const { gl } = useThree()
|
|
42
|
+
const url = 'https://engine.needle.tools/demos/gltf-progressive/assets/church/model.glb'
|
|
43
|
+
const { scene } = useGLTF(url, false, false, (loader) => {
|
|
44
|
+
useNeedleProgressive(url, gl, loader as any)
|
|
45
|
+
})
|
|
46
|
+
return <primitive object={scene} />
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### threejs (CDN, no bundler)
|
|
51
|
+
|
|
52
|
+
The full example can be found at `examples/threejs`
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<head>
|
|
56
|
+
<!-- Add the threejs import map to your HTML head section -->
|
|
57
|
+
<script type="importmap">
|
|
58
|
+
{
|
|
59
|
+
"imports": {
|
|
60
|
+
"three": "https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js",
|
|
61
|
+
"three/addons/": "https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/",
|
|
62
|
+
"three/examples/": "https://cdn.jsdelivr.net/npm/three@latest/examples/",
|
|
63
|
+
"@needle-engine/gltf-progressive": "https://www.unpkg.com/@needle-tools/gltf-progressive@latest"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
</head>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
In your script:
|
|
71
|
+
```ts
|
|
72
|
+
const gltfLoader = new GLTFLoader();
|
|
73
|
+
|
|
74
|
+
const url = "https://engine.needle.tools/demos/gltf-progressive/assets/church/model.glb";
|
|
75
|
+
|
|
76
|
+
// register the progressive loader
|
|
77
|
+
useNeedleProgressive(url, renderer, gltfLoader)
|
|
78
|
+
|
|
79
|
+
// just call the load method as usual
|
|
80
|
+
gltfLoader.load(url, gltf => {
|
|
81
|
+
console.log(gltf)
|
|
82
|
+
scene.add(gltf.scene)
|
|
83
|
+
gltf.scene.position.y += .95;
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### \<model-viewer\>
|
|
89
|
+
|
|
90
|
+
The example can be found in `examples/modelviewer.html`
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<head>
|
|
94
|
+
<!-- Include threejs import map -->
|
|
95
|
+
<script type="importmap">
|
|
96
|
+
{
|
|
97
|
+
"imports": {
|
|
98
|
+
"three": "https://unpkg.com/three/build/three.module.js",
|
|
99
|
+
"three/": "https://unpkg.com/three/"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</script>
|
|
103
|
+
<!-- Include gltf-progressive -->
|
|
104
|
+
<script type="module" src="https://www.unpkg.com/@needle-tools/gltf-progressive@latest"></script>
|
|
105
|
+
<!-- Include model-viewer -->
|
|
106
|
+
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.4.0/model-viewer.min.js"></script>
|
|
107
|
+
</head>
|
|
108
|
+
<body>
|
|
109
|
+
|
|
110
|
+
<model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/church/model.glb" camera-controls auto-rotate></model-viewer>
|
|
111
|
+
|
|
112
|
+
</body>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Needle Engine
|
|
116
|
+
|
|
117
|
+
[Needle Engine](https://needle.tools) natively supports progressive loading of these glTF files! See [docs.needle.tools](https://docs.needle.tools) for more information.
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
# Contact ✒️
|
|
121
|
+
<b>[🌵 needle — tools for creators](https://needle.tools)</b> •
|
|
122
|
+
[Twitter](https://twitter.com/NeedleTools) •
|
|
123
|
+
[Discord](https://discord.needle.tools) •
|
|
124
|
+
[Forum](https://forum.needle.tools)
|
|
125
|
+
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>gltf-progressive & model-viewer</title>
|
|
7
|
+
|
|
8
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
|
+
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap"
|
|
11
|
+
rel="stylesheet">
|
|
12
|
+
|
|
13
|
+
<script type="importmap">
|
|
14
|
+
{
|
|
15
|
+
"imports": {
|
|
16
|
+
"three": "https://unpkg.com/three/build/three.module.js",
|
|
17
|
+
"three/": "https://unpkg.com/three/"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
<script type="module" src="https://www.unpkg.com/@needle-tools/gltf-progressive@latest"></script>
|
|
22
|
+
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.4.0/model-viewer.min.js"></script>
|
|
23
|
+
</head>
|
|
24
|
+
|
|
25
|
+
<div class="layout">
|
|
26
|
+
<div class="card">
|
|
27
|
+
<h1>glTF Progressive</h1>
|
|
28
|
+
<h3><a href="https://www.npmjs.com/package/@needle-tools/gltf-progressive"
|
|
29
|
+
target="_blank">@needle-tools/gltf-progressive</a></h3>
|
|
30
|
+
<p>Load high quality assets in model-viewer without having to worry about loading times, bandwidth or
|
|
31
|
+
performance.</p>
|
|
32
|
+
<p>Get started now at <a href="https://cloud.needle.tools">cloud.needle.tools</a></p>
|
|
33
|
+
</div>
|
|
34
|
+
<model-viewer src="https://api.cloud.needle.tools/v1/public/9162350/2b4509376/" ar auto-rotate shadow-intensity=".5"
|
|
35
|
+
camera-controls touch-action="pan-y" autoplay></model-viewer>
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
<model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/vase/model.glb" ar
|
|
39
|
+
shadow-intensity=".5" camera-controls touch-action="pan-y"></model-viewer>
|
|
40
|
+
|
|
41
|
+
<model-viewer src="https://api.cloud.needle.tools/v1/public/908aa03/29b3b3743/" ar auto-rotate shadow-intensity=".5"
|
|
42
|
+
camera-controls touch-action="pan-y" autoplay></model-viewer>
|
|
43
|
+
|
|
44
|
+
<model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/church/model.glb" ar auto-rotate
|
|
45
|
+
shadow-intensity="1" camera-controls touch-action="pan-y" auto-rotate autoplay field-of-view="10deg"
|
|
46
|
+
max-camera-orbit="auto 90deg auto"></model-viewer>
|
|
47
|
+
|
|
48
|
+
<model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/putti gruppe/model.glb" ar auto-rotate
|
|
49
|
+
shadow-intensity="1" camera-controls touch-action="pan-y" auto-rotate autoplay
|
|
50
|
+
max-camera-orbit="auto 90deg auto"></model-viewer>
|
|
51
|
+
|
|
52
|
+
<model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/jupiter_und_ganymed/model.glb" ar
|
|
53
|
+
auto-rotate shadow-intensity=".5" camera-controls touch-action="pan-y"></model-viewer>
|
|
54
|
+
|
|
55
|
+
<model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/cyberpunk/model.glb" ar auto-rotate
|
|
56
|
+
shadow-intensity=".5" camera-controls touch-action="pan-y" autoplay rotation-per-second="60deg"></model-viewer>
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
// Example if a model is loaded after the page has loaded
|
|
62
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
const element = document.createElement('model-viewer');
|
|
65
|
+
element.src = "https://api.cloud.needle.tools/v1/public/9191068/261b4395b/";
|
|
66
|
+
element.setAttribute("camera-controls", "");
|
|
67
|
+
const layout = document.querySelector('.layout');
|
|
68
|
+
layout.appendChild(element);
|
|
69
|
+
}, 2000)
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<style>
|
|
75
|
+
body {
|
|
76
|
+
margin: 0;
|
|
77
|
+
background-color: rgba(245, 245, 245, 1);
|
|
78
|
+
font-family: "Open Sans", sans-serif;
|
|
79
|
+
font-optical-sizing: auto;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
* {
|
|
83
|
+
box-sizing: border-box;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
a {
|
|
87
|
+
text-decoration: none;
|
|
88
|
+
color: #cb0000;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.layout {
|
|
92
|
+
position: relative;
|
|
93
|
+
width: 100%;
|
|
94
|
+
min-height: 100%;
|
|
95
|
+
|
|
96
|
+
display: grid;
|
|
97
|
+
grid-template-columns: repeat(auto-fill, minmax(460px, 2fr));
|
|
98
|
+
gap: 1rem;
|
|
99
|
+
padding: 1rem;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.layout>* {
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: auto;
|
|
105
|
+
aspect-ratio: 1;
|
|
106
|
+
flex: 1;
|
|
107
|
+
background: white;
|
|
108
|
+
border-radius: .3rem;
|
|
109
|
+
box-shadow: 0 0 1rem rgba(0, 0, 0, .1);
|
|
110
|
+
outline: 1px solid white;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.card {
|
|
114
|
+
padding: 1rem;
|
|
115
|
+
max-width: calc(100vw - 2rem);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@media screen and (max-width: 800px) {
|
|
119
|
+
.layout {
|
|
120
|
+
grid-template-columns: 1fr;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
124
|
+
|
|
125
|
+
</html>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>gltf-progressive & model-viewer</title>
|
|
7
|
+
<script type="importmap">
|
|
8
|
+
{
|
|
9
|
+
"imports": {
|
|
10
|
+
"three": "https://unpkg.com/three/build/three.module.js",
|
|
11
|
+
"three/": "https://unpkg.com/three/"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.4.0/model-viewer.min.js"></script>
|
|
16
|
+
<script type="module" src="https://www.unpkg.com/@needle-tools/gltf-progressive@latest"></script>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/church/model.glb" ar shadow-intensity="1"
|
|
20
|
+
camera-controls touch-action="pan-y" auto-rotate max-camera-orbit="auto 90deg auto"></model-viewer>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
body {
|
|
24
|
+
margin: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
model-viewer {
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
32
|
+
|
|
33
|
+
</html>
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" href="favicon.png">
|
|
6
|
+
<meta name="viewport" content="width=device-width, user-scalable=no">
|
|
7
|
+
|
|
8
|
+
<title>react-three-fiber with progressive loading</title>
|
|
9
|
+
<meta name="description" content="🌵 gltf-progressive example">
|
|
10
|
+
<meta name="twitter:card" content="summary_large_image">
|
|
11
|
+
<meta property="og:title" content="react-three-fiber with progressive loading" />
|
|
12
|
+
<meta property="og:description" content="🌵 gltf-progressive example" />
|
|
13
|
+
<meta property="twitter:image" content="" />
|
|
14
|
+
<meta property="og:image" content="" />
|
|
15
|
+
|
|
16
|
+
<meta name="robots" content="index,follow">
|
|
17
|
+
<link rel="stylesheet" href="./src/style.css">
|
|
18
|
+
</head>
|
|
19
|
+
|
|
20
|
+
<body>
|
|
21
|
+
<script type="module" src="./src/index.tsx"></script>
|
|
22
|
+
<div id="root" style="width:100vw; height:100vh;"></div>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|