@needle-tools/gltf-progressive 2.1.5 → 2.1.6-next.8d7f3c1

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.
@@ -1,34 +1,34 @@
1
- {
2
- "name": "react-typescript",
3
- "version": "1.0.0",
4
- "main": "src/index.tsx",
5
- "dependencies": {
6
- "@needle-tools/gltf-progressive": "file:../..",
7
- "@react-three/drei": "^9.0.1",
8
- "@react-three/fiber": "^8.0.6",
9
- "react": "^18.0.0",
10
- "react-dom": "^18.0.0",
11
- "three": "0.162.0",
12
- "typescript": "4.7.4"
13
- },
14
- "devDependencies": {
15
- "@types/react": "18.0.15",
16
- "@types/react-dom": "17.0.0",
17
- "@types/three": "0.162.0",
18
- "@vitejs/plugin-basic-ssl": "^1.0.1",
19
- "@vitejs/plugin-react": "^1.3.0",
20
- "typescript": "4.1.3",
21
- "vite": "<= 4.3.9",
22
- "vite-plugin-compression": "^0.5.1"
23
- },
24
- "scripts": {
25
- "start": "vite --host",
26
- "build": "vite build"
27
- },
28
- "browserslist": [
29
- ">0.2%",
30
- "not dead",
31
- "not ie <= 11",
32
- "not op_mini all"
33
- ]
34
- }
1
+ {
2
+ "name": "react-typescript",
3
+ "version": "1.0.0",
4
+ "main": "src/index.tsx",
5
+ "dependencies": {
6
+ "@needle-tools/gltf-progressive": "file:../..",
7
+ "@react-three/drei": "^9.0.1",
8
+ "@react-three/fiber": "^8.0.6",
9
+ "react": "^18.0.0",
10
+ "react-dom": "^18.0.0",
11
+ "three": "0.162.0",
12
+ "typescript": "4.7.4"
13
+ },
14
+ "devDependencies": {
15
+ "@types/react": "18.0.15",
16
+ "@types/react-dom": "17.0.0",
17
+ "@types/three": "0.162.0",
18
+ "@vitejs/plugin-basic-ssl": "^1.0.1",
19
+ "@vitejs/plugin-react": "^1.3.0",
20
+ "typescript": "4.1.3",
21
+ "vite": "<= 4.3.9",
22
+ "vite-plugin-compression": "^0.5.1"
23
+ },
24
+ "scripts": {
25
+ "start": "vite --host",
26
+ "build": "vite build"
27
+ },
28
+ "browserslist": [
29
+ ">0.2%",
30
+ "not dead",
31
+ "not ie <= 11",
32
+ "not op_mini all"
33
+ ]
34
+ }
@@ -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
+ }
@@ -1,22 +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"]
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
22
  }
@@ -1,39 +1,39 @@
1
- import * as path from 'path';
2
- import { defineConfig } from 'vite';
3
- import react from '@vitejs/plugin-react';
4
- import basicSsl from '@vitejs/plugin-basic-ssl'
5
- import viteCompression from 'vite-plugin-compression';
6
-
7
- export default defineConfig(async (command) => {
8
-
9
-
10
- return {
11
- base: "./",
12
- assetsInclude: ['*'],
13
-
14
- plugins: [
15
- react(),
16
- basicSsl(),
17
- viteCompression({ deleteOriginFile: true }),
18
- ],
19
-
20
- server: {
21
- https: true,
22
- proxy: { // workaround: specifying a proxy skips HTTP2 which is currently problematic in Vite since it causes session memory timeouts.
23
- 'https://localhost:3000': 'https://localhost:3000'
24
- },
25
- strictPort: true,
26
- port: 3001
27
- },
28
- build: {
29
- outDir: "./dist",
30
- emptyOutDir: true,
31
- },
32
- resolve: {
33
- alias: {
34
- 'react': () => path.resolve(__dirname, 'node_modules/react'),
35
- '@react-three/fiber': () => path.resolve(__dirname, 'node_modules/@react-three/fiber'),
36
- }
37
- }
38
- }
1
+ import * as path from 'path';
2
+ import { defineConfig } from 'vite';
3
+ import react from '@vitejs/plugin-react';
4
+ import basicSsl from '@vitejs/plugin-basic-ssl'
5
+ import viteCompression from 'vite-plugin-compression';
6
+
7
+ export default defineConfig(async (command) => {
8
+
9
+
10
+ return {
11
+ base: "./",
12
+ assetsInclude: ['*'],
13
+
14
+ plugins: [
15
+ react(),
16
+ basicSsl(),
17
+ viteCompression({ deleteOriginFile: true }),
18
+ ],
19
+
20
+ server: {
21
+ https: true,
22
+ proxy: { // workaround: specifying a proxy skips HTTP2 which is currently problematic in Vite since it causes session memory timeouts.
23
+ 'https://localhost:3000': 'https://localhost:3000'
24
+ },
25
+ strictPort: true,
26
+ port: 3001
27
+ },
28
+ build: {
29
+ outDir: "./dist",
30
+ emptyOutDir: true,
31
+ },
32
+ resolve: {
33
+ alias: {
34
+ 'react': () => path.resolve(__dirname, 'node_modules/react'),
35
+ '@react-three/fiber': () => path.resolve(__dirname, 'node_modules/@react-three/fiber'),
36
+ }
37
+ }
38
+ }
39
39
  });
@@ -1,52 +1,52 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <title>Threejs Progressive Loading</title>
8
- <style>
9
- body {
10
- margin: 0;
11
- }
12
- </style>
13
- <script type="importmap">
14
- {
15
- "imports": {
16
- "three": "https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js",
17
- "three/addons/": "https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/",
18
- "three/examples/": "https://cdn.jsdelivr.net/npm/three@latest/examples/",
19
- "@needle-tools/gltf-progressive": "https://cdn.jsdelivr.net/npm/@needle-tools/gltf-progressive/gltf-progressive.min.js"
20
- }
21
- }
22
- </script>
23
- </head>
24
-
25
- <body>
26
- <script type="module" src="./main.js"></script>
27
- <button class="show-source">Show Source</button>
28
- </body>
29
-
30
-
31
- <style>
32
- .show-source {
33
- position: fixed;
34
- right: 1rem;
35
- bottom: 1rem;
36
- z-index: 100;
37
- border-radius: .5rem;
38
- border: none;
39
- padding: .3rem .5rem;
40
- }
41
- </style>
42
- <script>
43
- document.addEventListener("DOMContentLoaded", () => {
44
- document.querySelector('.show-source').addEventListener('click', () => {
45
- const scriptSource = document.querySelector('script[type="module"]').src;
46
- console.log(scriptSource);
47
- window.open(scriptSource);
48
- });
49
- });
50
- </script>
51
-
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <title>Threejs Progressive Loading</title>
8
+ <style>
9
+ body {
10
+ margin: 0;
11
+ }
12
+ </style>
13
+ <script type="importmap">
14
+ {
15
+ "imports": {
16
+ "three": "https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js",
17
+ "three/addons/": "https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/",
18
+ "three/examples/": "https://cdn.jsdelivr.net/npm/three@latest/examples/",
19
+ "@needle-tools/gltf-progressive": "https://cdn.jsdelivr.net/npm/@needle-tools/gltf-progressive/gltf-progressive.min.js"
20
+ }
21
+ }
22
+ </script>
23
+ </head>
24
+
25
+ <body>
26
+ <script type="module" src="./main.js"></script>
27
+ <button class="show-source">Show Source</button>
28
+ </body>
29
+
30
+
31
+ <style>
32
+ .show-source {
33
+ position: fixed;
34
+ right: 1rem;
35
+ bottom: 1rem;
36
+ z-index: 100;
37
+ border-radius: .5rem;
38
+ border: none;
39
+ padding: .3rem .5rem;
40
+ }
41
+ </style>
42
+ <script>
43
+ document.addEventListener("DOMContentLoaded", () => {
44
+ document.querySelector('.show-source').addEventListener('click', () => {
45
+ const scriptSource = document.querySelector('script[type="module"]').src;
46
+ console.log(scriptSource);
47
+ window.open(scriptSource);
48
+ });
49
+ });
50
+ </script>
51
+
52
52
  </html>