@needle-tools/gltf-progressive 2.1.6-next.c9b2e8b → 2.1.6

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.
Files changed (42) hide show
  1. package/examples/react-three-fiber/src/App.tsx +38 -0
  2. package/examples/react-three-fiber/src/index.tsx +12 -0
  3. package/examples/react-three-fiber/src/styles.css +16 -0
  4. package/examples/react-three-fiber/tsconfig.json +22 -0
  5. package/{dist/lib → lib}/version.js +1 -1
  6. package/package.json +15 -18
  7. package/.github/workflows/publish.yml +0 -47
  8. package/dist/CHANGELOG.md +0 -211
  9. package/dist/README.md +0 -129
  10. package/dist/examples/modelviewer-multiple.html +0 -126
  11. package/dist/examples/modelviewer.html +0 -34
  12. package/dist/examples/react-three-fiber/.prettierrc +0 -10
  13. package/dist/examples/react-three-fiber/favicon.png +0 -0
  14. package/dist/examples/react-three-fiber/index.html +0 -24
  15. package/dist/examples/react-three-fiber/package-lock.json +0 -4023
  16. package/dist/examples/react-three-fiber/package.json +0 -34
  17. package/dist/examples/react-three-fiber/vite.config.js +0 -39
  18. package/dist/examples/threejs/index.html +0 -52
  19. package/dist/examples/threejs/main.js +0 -181
  20. package/dist/package.json +0 -65
  21. /package/{dist/gltf-progressive.js → gltf-progressive.js} +0 -0
  22. /package/{dist/gltf-progressive.min.js → gltf-progressive.min.js} +0 -0
  23. /package/{dist/gltf-progressive.umd.cjs → gltf-progressive.umd.cjs} +0 -0
  24. /package/{dist/lib → lib}/extension.d.ts +0 -0
  25. /package/{dist/lib → lib}/extension.js +0 -0
  26. /package/{dist/lib → lib}/index.d.ts +0 -0
  27. /package/{dist/lib → lib}/index.js +0 -0
  28. /package/{dist/lib → lib}/loaders.d.ts +0 -0
  29. /package/{dist/lib → lib}/loaders.js +0 -0
  30. /package/{dist/lib → lib}/lods_manager.d.ts +0 -0
  31. /package/{dist/lib → lib}/lods_manager.js +0 -0
  32. /package/{dist/lib → lib}/plugins/index.d.ts +0 -0
  33. /package/{dist/lib → lib}/plugins/index.js +0 -0
  34. /package/{dist/lib → lib}/plugins/modelviewer.d.ts +0 -0
  35. /package/{dist/lib → lib}/plugins/modelviewer.js +0 -0
  36. /package/{dist/lib → lib}/plugins/plugin.d.ts +0 -0
  37. /package/{dist/lib → lib}/plugins/plugin.js +0 -0
  38. /package/{dist/lib → lib}/utils.d.ts +0 -0
  39. /package/{dist/lib → lib}/utils.internal.d.ts +0 -0
  40. /package/{dist/lib → lib}/utils.internal.js +0 -0
  41. /package/{dist/lib → lib}/utils.js +0 -0
  42. /package/{dist/lib → lib}/version.d.ts +0 -0
@@ -0,0 +1,38 @@
1
+ 'use client';
2
+
3
+ /* eslint-disable */
4
+ import * as React from 'react'
5
+ import { Canvas, useThree } from '@react-three/fiber'
6
+
7
+ import { useNeedleProgressive } from '@needle-tools/gltf-progressive'
8
+ import { Environment, OrbitControls, useGLTF } from '@react-three/drei'
9
+
10
+ function MyModel() {
11
+ const { gl } = useThree()
12
+ const url = 'https://engine.needle.tools/demos/gltf-progressive/assets/church/model.glb'
13
+ const { scene } = useGLTF(url, false, false, (loader) => {
14
+ useNeedleProgressive(url, gl, loader as any)
15
+ })
16
+ return <primitive object={scene} />
17
+ }
18
+
19
+
20
+ export default function App() {
21
+ return (
22
+ <Canvas
23
+ frameloop="demand"
24
+ camera={{ position: [25, 15, 25] }}>
25
+ <OrbitControls target={[0 , 10, 0]} />
26
+ <ambientLight intensity={1} />
27
+ <spotLight position={[10, 10, 10]} angle={0.15} penumbra={1} />
28
+ <pointLight position={[-10, -10, -10]} />
29
+ <Environment
30
+ files="https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/2k/evening_road_01_2k.hdr"
31
+ // ground={{ height: 5, radius: 40, scale: 10 }}
32
+ />
33
+ <MyModel />
34
+ </Canvas>
35
+ )
36
+ }
37
+
38
+
@@ -0,0 +1,12 @@
1
+ //@ts-ignore
2
+ import { createRoot } from 'react-dom/client'
3
+ import * as React from 'react'
4
+ import './styles.css'
5
+ import App from './App'
6
+
7
+
8
+ createRoot(document.getElementById('root')).render(
9
+ <>
10
+ <App />
11
+ </>
12
+ )
@@ -0,0 +1,16 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ html,
6
+ body,
7
+ #root {
8
+ width: 100%;
9
+ height: 100%;
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+
14
+ body {
15
+ background: #f0f0f0;
16
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "react",
4
+ "target": "ESNext",
5
+ "useDefineForClassFields": true,
6
+ "module": "ESNext",
7
+ "lib": ["ESNext", "DOM"],
8
+ "moduleResolution": "Node",
9
+ "strict": true,
10
+ "sourceMap": true,
11
+ "resolveJsonModule": true,
12
+ "esModuleInterop": true,
13
+ "noEmit": true,
14
+ "noUnusedLocals": false,
15
+ "noUnusedParameters": true,
16
+ "noImplicitReturns": true,
17
+ "noImplicitAny": false,
18
+ "experimentalDecorators": true,
19
+ "skipLibCheck": true
20
+ },
21
+ "include": ["./src"]
22
+ }
@@ -1,4 +1,4 @@
1
1
  // replaced at build time
2
- export const version = "2.1.6-next.c9b2e8b";
2
+ export const version = "2.1.6";
3
3
  globalThis["GLTF_PROGRESSIVE_VERSION"] = version;
4
4
  console.debug(`[gltf-progressive] version ${version || "-"}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-progressive",
3
- "version": "2.1.6-next.c9b2e8b",
3
+ "version": "2.1.6",
4
4
  "description": "three.js support for loading glTF or GLB files that contain progressive loading data",
5
5
  "homepage": "https://needle.tools",
6
6
  "author": {
@@ -25,23 +25,23 @@
25
25
  "optimization"
26
26
  ],
27
27
  "type": "module",
28
- "main": "./src/index.ts",
28
+ "main": "./lib/index.js",
29
29
  "exports": {
30
30
  ".": {
31
- "import": "./src/index.js",
31
+ "import": "./lib/index.js",
32
32
  "require": "./gltf-progressive.js"
33
33
  }
34
34
  },
35
- "scripts": {
36
- "dev": "npm-watch build:lib",
37
- "prepublishOnly": "node tools/build.mjs",
38
- "build": "node tools/build.mjs --dry-run",
39
- "build:dist": "vite build",
40
- "build:lib": "tsc --rootDir ./src --outDir ./dist/lib --noEmit false --declaration --incremental false --sourceMap false && node tools/compile.mjs",
41
- "test:tsc": "tsc --noEmit",
42
- "lint": "eslint --ext .ts src",
43
- "lint:fix": "eslint --ext .ts src --fix"
44
- },
35
+ "files": [
36
+ "lib",
37
+ "examples",
38
+ "package.json",
39
+ "README.md",
40
+ "CHANGELOG.md",
41
+ "gltf-progressive.js",
42
+ "gltf-progressive.min.js",
43
+ "gltf-progressive.umd.cjs"
44
+ ],
45
45
  "watch": {
46
46
  "build:lib": {
47
47
  "patterns": [
@@ -71,8 +71,5 @@
71
71
  "three": ">= 0.160.0",
72
72
  "vite": "<= 4.3.9"
73
73
  },
74
- "publishConfig": {
75
- "access": "public",
76
- "registry": "https://registry.npmjs.org"
77
- }
78
- }
74
+ "types": "./lib/index.d.ts"
75
+ }
@@ -1,47 +0,0 @@
1
- name: Release Workflow
2
- on:
3
- push:
4
- branches:
5
- - 'release/next'
6
- - 'release/stable'
7
- - 'release/experimental'
8
-
9
- jobs:
10
- run-release-script:
11
- runs-on: ubuntu-latest
12
- timeout-minutes: 5
13
- defaults:
14
- run:
15
- working-directory: .
16
- steps:
17
- - name: Checkout code
18
- uses: actions/checkout@v4
19
- # with:
20
- # submodules: false
21
- # token: ${{ secrets.GH_RELEASE_TOKEN }}
22
- # - name: Initialize specific submodules
23
- # run: |
24
- # git config --global url."https://x-access-token:${{ secrets.GH_RELEASE_TOKEN }}@github.com/".insteadOf "https://github.com/"
25
- # git submodule update --init modules/gltf-progressive
26
- # git submodule update --init modules/needle-engine-modules
27
- # working-directory: ./
28
-
29
- - name: Setup Node.js
30
- uses: actions/setup-node@v4
31
- with:
32
- node-version: '22'
33
- cache: 'npm'
34
- cache-dependency-path: './package.json'
35
-
36
- - name: Install dependencies
37
- run: npm install
38
-
39
- - name: Publish to npm (stable branch)
40
- if: startsWith(github.ref_name, 'release/stable')
41
- run: npx --yes needle-publish-helper@next publish "." --webhook "${{ secrets.DISCORD_WEBHOOK }}" --access-token "${{ secrets.NPM_TOKEN }}" --tag "stable" --create-tag "release/" --llm-api-key "${{ secrets.LLM_API_KEY }}"
42
-
43
- - name: Publish to npm (next and experimental branches)
44
- if: ${{ !startsWith(github.ref_name, 'release/stable') }}
45
- run: npx --yes needle-publish-helper@next publish "." --webhook "${{ secrets.DISCORD_WEBHOOK }}" --access-token "${{ secrets.NPM_TOKEN }}" --tag "${{ github.ref_name }}" --version+tag --version+hash --create-tag "release/" --llm-api-key "${{ secrets.LLM_API_KEY }}"
46
-
47
-
package/dist/CHANGELOG.md DELETED
@@ -1,211 +0,0 @@
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
- ## [2.1.4] - 2025-04-13
8
- - Fix: Don't minify internal exports (e.g. class names of three.js)
9
-
10
- ## [2.1.3] - 2025-03-19
11
- - Fix: DracoLoader cache busting due to range request
12
-
13
- ## [2.1.2] - 2025-03-10
14
- - Chore: Update examples
15
-
16
- ## [2.1.1] - 2025-02-20
17
- - Fix: Handle failed progressive texture loading due to e.g. offline or missing files
18
- - Fix: Regression causing custom KTX2Transcoder location not working for e.g. offline usage
19
-
20
- ## [2.1.0] - 2025-02-13
21
- - Bump version
22
-
23
- ## [2.1.0-alpha.6] - 2025-02-12
24
- - Fix: `?debugprogressive` now also switches texture LODs
25
-
26
- ## [2.1.0-alpha.5] - 2025-01-30
27
- - Add: initial support for Orthographic cameras
28
-
29
- ## [2.1.0-alpha.4] - 2025-01-29
30
- - Fix: LOD not loading if the max texture resolution is too small
31
-
32
- ## [2.1.0-alpha.3] - 2025-01-21
33
- - Change: Load Draco and KTX loaders as soon as possible
34
- - Fix: Make `GET` request to draco endpoint with 1 byte range instead of HEAD request. The HEAD request did return the whole draco loader.
35
-
36
- ## [2.1.0-alpha.2] - 2025-01-17
37
- - Add: expose methods in globalThis/window at `Needle.gltfProgressive`
38
-
39
- ## [2.1.0-alpha.1] - 2025-01-15
40
- - Fix: issue where `getMeshLOD` for multi-material meshes would not return the correct index if called multiple times at the same time
41
-
42
- ## [2.1.0-alpha] - 2025-01-14
43
- - Bump three types to r169
44
-
45
- ## [2.0.0-alpha.3] - 2025-01-02
46
- - Change: Load higher texture resolution by default
47
-
48
- ## [2.0.0-alpha.1] - 2024-12-09
49
- - Add: `Accept` header options for Needle Cloud requests
50
-
51
- ## [1.2.15] - 2024-10-21
52
- - Fix: internal window parameter access causing issue with SSR
53
-
54
- ## [1.2.13] - 2024-10-06
55
- - Update README
56
-
57
- ## [1.2.12] - 2024-09-23
58
- - Add: `assignTextureLOD` now also accepts mesh as parameter
59
- - Change: improved `assignTextureLOD` typing
60
-
61
- ## [1.2.11] - 2024-09-11
62
- - Fix: draco and KTX decoder path handling when gstatic can not be reached and user set path
63
-
64
- ## [1.2.10] - 2024-09-10
65
- - Fix: loading and assigning texture LOD for ShaderMaterial and RawShaderMaterial
66
-
67
- ## [1.2.9] - 2024-07-29
68
- - Fix: server side rendering fixes
69
-
70
- ## [1.2.8] - 2023-07-19
71
- - Add: repository url
72
-
73
- ## [1.2.7] - 2023-07-18
74
- - Fix: include `type: module`
75
-
76
- ## [1.2.5] - 2023-07-16
77
- - Remove: Frustum cull check because we're already operating on the latest renderlist
78
-
79
- ## [1.2.5-beta] - 2023-07-09
80
- - Change: Update skinned mesh bounding box every 30 frames using the lowres mesh version
81
-
82
- ## [1.2.4-beta.1] - 2023-07-09
83
- - Add: LODsManager `manual` property which can be used to manually update the LODs in the scene by calling `LODsManager.update(scene, camera)`
84
- - Fix: updating LODs in WebXR
85
-
86
- ## [1.2.4-beta] - 2023-07-05
87
- - Change: `createLoaders` now returns created loaders and decoders to be re-used
88
-
89
- ## [1.2.3-beta] - 2023-07-04
90
- - Add: support for transmissive objects
91
-
92
- ## [1.2.3-alpha.3] - 2023-07-01
93
- - Add: prevent loading highres textures when user has enabled data-save mode
94
-
95
- ## [1.2.3-alpha.2] - 2023-06-27
96
- - Fix: error caused by parser associations containing `undefined` value
97
-
98
- ## [1.2.3-alpha.1] - 2023-06-25
99
- - Internal: rename `setRaycastMesh` to `registerRaycastMesh`
100
-
101
- ## [1.2.3-alpha] - 2023-06-24
102
- - Change: automatically change LOD update interval based on framerate
103
-
104
- ## [1.2.2-alpha.4] - 2023-06-20
105
- - Add: Register version in global "GLTF_PROGRESSIVE_VERSION" variable
106
- - Add: `<model-viewer>` elements added document at any time are now properly registered
107
- - Fix: LOD updates for multiple `<model-viewer>` elements
108
- - 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
109
- - Change: `<model-viewer>` elements will fetch a slightly higher texture LOD
110
-
111
- ## [1.2.1-alpha.4] - 2023-06-19
112
- - Fix: SkinnedMesh bounds calculation
113
-
114
- ## [1.2.1-alpha.3] - 2023-06-15
115
- - update the README
116
-
117
- ## [1.2.1-alpha.2] - 2023-06-15
118
- - fix: Ortographic camera causing LODs being falsely updated
119
- - fix: regression introduced in 1.2.1-alpha
120
- - fix: error when trying to load a LOD glTF directly
121
- - fix: issues caused by instanceof in local development environments
122
-
123
- ## [1.2.0-alpha.9] - 2023-06-13
124
- - fix: issue where skinned mesh matrix was falsely applied to calculate screen size
125
- - fix: use bounding box from SkinnedMesh object
126
-
127
- ## [1.2.0-alpha.6] - 2023-06-12
128
- - fix: minor bug where opened glTF has `NEEDLE_progressive` extension but no lods array because the glTF is a LOD variant
129
-
130
- ## [1.2.0-alpha.5] - 2023-06-10
131
- - fix: safeguard when `registerMesh` or `registerTexture` are being called with invalid data
132
- - examples: update vanilla threejs example
133
-
134
- ## [1.2.0-alpha.4] - 2023-06-07
135
- - add: `useRaycastMeshes` method:
136
- ```ts
137
- // call to enable raycasting with low poly raycast meshes
138
- // this can be done once in your project
139
- useRaycastMeshes(true);
140
-
141
- // then use the raycaster as usual
142
- const raycaster = new Raycaster();
143
- raycaster.setFromCamera(mouse, camera);
144
- const intersects = raycaster.intersectObjects(scene.children, true);
145
-
146
- // call to disable raycasting with low polwy meshes
147
- useRaycastMeshes(false);
148
- ```
149
-
150
- ## [1.2.0-alpha.3] - 2023-06-06
151
- - add: automatically load the highest LOD first to show a slightly better quality level as soon as possible
152
- - fix: improve Texture LOD selection by taking LOD level height into account
153
- - fix: correctly assign LOD level information to initially loaded texture
154
-
155
- ## [1.1.0-alpha.2] - 2023-06-05
156
- - fix: register LOD information for meshes that don't have associations
157
-
158
- ## [1.1.0-alpha] - 2023-06-03
159
- - add: loading of multiple texture LOD levels
160
- - fix: issue where material LODs where not updated when the material was cloned
161
- - change: clamp screen coverage when near plane intersects with the object bounds
162
- - change: skip CubeCamera setup
163
- - change: handle cases where an object has only texture LODs
164
-
165
- ## [1.0.0-alpha.19] - 2023-05-31
166
- - add `LODsManager.plugins` getter
167
-
168
- ## [1.0.0-alpha.18] - 2023-05-30
169
- - update README
170
-
171
- ## [1.0.0-alpha.16] - 2023-05-29
172
- - fix: LODs manager now clamps to LOD 0 if the near plane is inside the bounds
173
- - change: Ignore certain material in lods update loop
174
-
175
- ## [1.0.0-alpha.15] - 2023-05-25
176
- - add: `getRaycastMesh` method
177
- - 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.
178
- - change: create LODsManager via `LODsManager.get(renderer)`
179
-
180
- ## [1.0.0-alpha.13] - 2023-05-24
181
- - fix: modelviewer error when trying to access undefined texture extensions
182
-
183
- ## [1.0.0-alpha.13] - 2023-05-24
184
- - add: vanilla three.js example
185
- - fix: texture LODs losing filter setting
186
-
187
- ## [1.0.0-alpha.12] - 2023-05-19
188
- - fix: update LODs when using postprocessing
189
-
190
- ## [1.0.0-alpha.11] - 2023-05-17
191
- - add: expose `setDracoDecoderLocation` and `setKTX2TranscoderLocation`
192
- - fix: allow using draco decoder and ktx2 transcoder from local filepath
193
-
194
- ## [1.0.0-alpha.10] - 2023-05-07
195
- - fix: progressive assets are now only updated during the main canvas render call and not e.g. when rendering to a texture
196
-
197
- ## [1.0.0-alpha.9] - 2023-05-03
198
- - fix: handle loading of ShaderMaterial for VRM progressive textures
199
-
200
- ## [1.0.0-alpha.8] - 2023-05-03
201
- - fix: handle transparent materials
202
-
203
- ## [1.0.0-alpha.7] - 2023-05-01
204
- - fix: Handle modelviewer `src` set as property but not as attribute
205
- - change: Remove sourcemap
206
-
207
- ## [1.0.0-alpha.6] - 2023-05-01
208
- - fix: LOD mesh assignment for multi-material meshes (meshes with multiple primitives)
209
-
210
- ## [1.0.0-alpha.5] - 2023-04-30
211
- - initial version
package/dist/README.md DELETED
@@ -1,129 +0,0 @@
1
- # glTF progressive
2
-
3
- LODs on steroids for glTF, GLB or VRM files with density based loading for meshes or texture for any three.js based project.
4
-
5
- ## Features
6
- - One line integration in any three.js based engine/project
7
- - Mesh LOD support
8
- - Texture LOD support
9
- - LOD levels are loaded on demand based on mesh screen density
10
- - Low poly LOD meshes can easily be used for raycasting for smooth interactions with high-poly meshes
11
- - Cloud generation and loading support via [cloud.needle.tools](https://cloud.needle.tools) for glTF, GLB & VRM assets
12
-
13
- ## Examples
14
-
15
- Examples are in the `/examples` directory. Live versions can be found in the links below.
16
-
17
- - [Vanilla three.js](https://engine.needle.tools/demos/gltf-progressive/threejs/) - multiple models and animations
18
- - [React Three Fiber](https://engine.needle.tools/demos/gltf-progressive/r3f/)
19
- - \<model-viewer\>
20
- - [single \<model-viewer> element](https://engine.needle.tools/demos/gltf-progressive/modelviewer)
21
- - [multiple \<model-viewer> elements](https://engine.needle.tools/demos/gltf-progressive/modelviewer-multiple)
22
- - [Needle Engine](https://stackblitz.com/edit/needle-engine-gltf-progressive?file=src%2Fmain.ts)
23
- - [Needle Cloud](https://cloud.needle.tools/view?file=Z23hmXBZN45qJ-ZN45qJ-world)
24
-
25
- **Interactive Examples**:
26
- - [Stackblitz](https://stackblitz.com/@marwie/collections/gltf-progressive)
27
- - [Codesandbox](https://codesandbox.io/dashboard/sandboxes/gltf-progressive)
28
-
29
-
30
- <br/>
31
- <video width="320" controls autoplay src="https://engine.needle.tools/demos/gltf-progressive/video.mp4">
32
- <source src="https://engine.needle.tools/demos/gltf-progressive/video.mp4" type="video/mp4">
33
- </video>
34
-
35
-
36
- ## Usage
37
-
38
- ### react three fiber
39
-
40
- Full example in `examples/react-three-fiber`
41
-
42
- ```ts
43
- function MyModel() {
44
- const { gl } = useThree()
45
- const url = 'https://cloud.needle.tools/-/assets/Z23hmXBZN45qJ-ZN45qJ-world/file'
46
- const { scene } = useGLTF(url, false, false, (loader) => {
47
- useNeedleProgressive(url, gl, loader as any)
48
- })
49
- return <primitive object={scene} />
50
- }
51
- ```
52
-
53
- ### threejs (CDN, no bundler)
54
-
55
- The full example can be found at `examples/threejs`
56
-
57
- ```html
58
- <head>
59
- <!-- Add the threejs import map to your HTML head section -->
60
- <script type="importmap">
61
- {
62
- "imports": {
63
- "three": "https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js",
64
- "three/addons/": "https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/",
65
- "three/examples/": "https://cdn.jsdelivr.net/npm/three@latest/examples/",
66
- "@needle-tools/gltf-progressive": "https://cdn.jsdelivr.net/npm/@needle-tools/gltf-progressive/gltf-progressive.min.js"
67
- }
68
- }
69
- </script>
70
- </head>
71
- ```
72
-
73
- In your script:
74
- ```ts
75
- const gltfLoader = new GLTFLoader();
76
-
77
- const url = "https://cloud.needle.tools/-/assets/Z23hmXBZN45qJ-ZN45qJ-world/file";
78
-
79
- // register the progressive loader plugin
80
- useNeedleProgressive(url, renderer, gltfLoader)
81
-
82
- // just call the load method as usual
83
- gltfLoader.load(url, gltf => {
84
- scene.add(gltf.scene)
85
- })
86
- ```
87
-
88
-
89
- ### \<model-viewer\>
90
-
91
- The example can be found in `examples/modelviewer.html`
92
-
93
- ```html
94
- <head>
95
- <!-- Include threejs import map -->
96
- <script type="importmap">
97
- {
98
- "imports": {
99
- "three": "https://unpkg.com/three/build/three.module.js",
100
- "three/": "https://unpkg.com/three/"
101
- }
102
- }
103
- </script>
104
- <!-- Include gltf-progressive -->
105
- <script type="module" src="https://cdn.jsdelivr.net/npm/@needle-tools/gltf-progressive/gltf-progressive.min.js"></script>
106
- <!-- Include model-viewer -->
107
- <script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.4.0/model-viewer.min.js"></script>
108
- </head>
109
- <body>
110
-
111
- <model-viewer src="https://cloud.needle.tools/-/assets/Z23hmXBZN45qJ-ZN45qJ-world/file" camera-controls auto-rotate></model-viewer>
112
-
113
- </body>
114
- ```
115
-
116
- ### Needle Engine
117
-
118
- [Needle Engine](https://needle.tools) natively supports progressive loading of these glTF files! See [docs.needle.tools](https://docs.needle.tools) for more information.
119
-
120
-
121
- Use [cloud.needle.tools](https://cloud.needle.tools) to generate LODs for your assets now.
122
-
123
-
124
- # Contact ✒️
125
- <b>[🌵 needle — tools for creators](https://needle.tools)</b> •
126
- [Twitter](https://twitter.com/NeedleTools) •
127
- [Discord](https://discord.needle.tools) •
128
- [Forum](https://forum.needle.tools)
129
-
@@ -1,126 +0,0 @@
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"
22
- src="https://cdn.jsdelivr.net/npm/@needle-tools/gltf-progressive/gltf-progressive.min.js"></script>
23
- <script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.4.0/model-viewer.min.js"></script>
24
- </head>
25
-
26
- <div class="layout">
27
- <div class="card">
28
- <h1>glTF Progressive</h1>
29
- <h3><a href="https://www.npmjs.com/package/@needle-tools/gltf-progressive"
30
- target="_blank">@needle-tools/gltf-progressive</a></h3>
31
- <p>Load high quality assets in model-viewer without having to worry about loading times, bandwidth or
32
- performance.</p>
33
- <p>Get started now at <a href="https://cloud.needle.tools">cloud.needle.tools</a></p>
34
- </div>
35
- <model-viewer src="https://api.cloud.needle.tools/v1/public/9162350/2b4509376/" ar auto-rotate shadow-intensity=".5"
36
- camera-controls touch-action="pan-y" autoplay></model-viewer>
37
-
38
-
39
- <model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/vase/model.glb" ar
40
- shadow-intensity=".5" camera-controls touch-action="pan-y"></model-viewer>
41
-
42
- <model-viewer src="https://api.cloud.needle.tools/v1/public/908aa03/29b3b3743/" ar auto-rotate shadow-intensity=".5"
43
- camera-controls touch-action="pan-y" autoplay></model-viewer>
44
-
45
- <model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/church/model.glb" ar auto-rotate
46
- shadow-intensity="1" camera-controls touch-action="pan-y" auto-rotate autoplay field-of-view="10deg"
47
- max-camera-orbit="auto 90deg auto"></model-viewer>
48
-
49
- <model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/putti gruppe/model.glb" ar auto-rotate
50
- shadow-intensity="1" camera-controls touch-action="pan-y" auto-rotate autoplay
51
- max-camera-orbit="auto 90deg auto"></model-viewer>
52
-
53
- <model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/jupiter_und_ganymed/model.glb" ar
54
- auto-rotate shadow-intensity=".5" camera-controls touch-action="pan-y"></model-viewer>
55
-
56
- <model-viewer src="https://engine.needle.tools/demos/gltf-progressive/assets/cyberpunk/model.glb" ar auto-rotate
57
- shadow-intensity=".5" camera-controls touch-action="pan-y" autoplay rotation-per-second="60deg"></model-viewer>
58
-
59
- </div>
60
-
61
- <script>
62
- // Example if a model is loaded after the page has loaded
63
- document.addEventListener('DOMContentLoaded', () => {
64
- setTimeout(() => {
65
- const element = document.createElement('model-viewer');
66
- element.src = "https://api.cloud.needle.tools/v1/public/9191068/261b4395b/";
67
- element.setAttribute("camera-controls", "");
68
- const layout = document.querySelector('.layout');
69
- layout.appendChild(element);
70
- }, 2000)
71
- });
72
-
73
- </script>
74
-
75
- <style>
76
- body {
77
- margin: 0;
78
- background-color: rgba(245, 245, 245, 1);
79
- font-family: "Open Sans", sans-serif;
80
- font-optical-sizing: auto;
81
- }
82
-
83
- * {
84
- box-sizing: border-box;
85
- }
86
-
87
- a {
88
- text-decoration: none;
89
- color: #cb0000;
90
- }
91
-
92
- .layout {
93
- position: relative;
94
- width: 100%;
95
- min-height: 100%;
96
-
97
- display: grid;
98
- grid-template-columns: repeat(auto-fill, minmax(460px, 2fr));
99
- gap: 1rem;
100
- padding: 1rem;
101
- }
102
-
103
- .layout>* {
104
- width: 100%;
105
- height: auto;
106
- aspect-ratio: 1;
107
- flex: 1;
108
- background: white;
109
- border-radius: .3rem;
110
- box-shadow: 0 0 1rem rgba(0, 0, 0, .1);
111
- outline: 1px solid white;
112
- }
113
-
114
- .card {
115
- padding: 1rem;
116
- max-width: calc(100vw - 2rem);
117
- }
118
-
119
- @media screen and (max-width: 800px) {
120
- .layout {
121
- grid-template-columns: 1fr;
122
- }
123
- }
124
- </style>
125
-
126
- </html>