@crapthings/run3d 0.2.3 → 0.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/README.md CHANGED
@@ -14,7 +14,9 @@ cd my-project
14
14
  pnpm dev
15
15
  ```
16
16
 
17
- Edit `src/Scene.jsx` to make it your own. To install dependencies later, add `--skip-install` to the first command.
17
+ Edit the components in `src/Scenes` to make the starter scene your own. To install dependencies later, add `--skip-install` to the first command.
18
+
19
+ Drag to orbit the scene, scroll to zoom, and right-drag to pan. Edit `src/Scenes/index.jsx` for the scene and its settings.
18
20
 
19
21
  ## Included tools
20
22
 
@@ -52,5 +54,6 @@ Edit `src/Scene.jsx` to make it your own. To install dependencies later, add `--
52
54
 
53
55
  - [React Router](https://github.com/remix-run/react-router) — connects URLs to pages and handles navigation.
54
56
  - [Tailwind CSS](https://github.com/tailwindlabs/tailwindcss) — styles the app.
57
+ - [React Hotkeys Hook](https://github.com/JohannesKlauss/react-hotkeys-hook) — adds declarative keyboard shortcuts with a React hook.
55
58
  - [Headless UI](https://github.com/tailwindlabs/headlessui) — provides accessible, unstyled React UI components.
56
59
  - [Floating UI](https://github.com/floating-ui/floating-ui) — positions menus, tooltips, and popovers.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.3",
6
+ "version": "0.2.5",
7
7
  "description": "From idea to interactive 3D prototype in one command. A JavaScript starter with Vite, React Three Fiber, and tools for creative experimentation.",
8
8
  "type": "module",
9
9
  "bin": {
@@ -1,4 +1,17 @@
1
1
  # Rules
2
2
 
3
- - Only run `pnpm build`, `pnpm lint`, or `pnpm test` when explicitly requested by the user.
3
+ ## Commands
4
+
5
+ - Only run `pnpm build`, `pnpm lint`, or `pnpm test` when explicitly requested by the user, and never run `pnpm dev`.
6
+
7
+ ## Code Style
8
+
4
9
  - Follow JavaScript Standard Style (standard.js) when writing `.js` and `.jsx` files.
10
+
11
+ ## Scene Lighting
12
+
13
+ - Avoid ambient lighting by default. Only add ambient lighting (such as `AmbientLight` or `HemisphereLight`) when explicitly requested by the user.
14
+
15
+ ## Texture Maps
16
+
17
+ - When using texture maps, process them with the installed `three-hex-tiling` package to reduce visible texture repetition instead of relying on basic repeating UV tiling alone.
@@ -31,6 +31,7 @@
31
31
  "postprocessing": "^6.39.5",
32
32
  "react": "19.2.8",
33
33
  "react-dom": "19.2.8",
34
+ "react-hotkeys-hook": "^5.3.3",
34
35
  "react-router": "^7.18.3",
35
36
  "recast-navigation": "^0.43.1",
36
37
  "three": "^0.186.0",
@@ -220,6 +220,9 @@ importers:
220
220
  react-dom:
221
221
  specifier: 19.2.8
222
222
  version: 19.2.8(react@19.2.8)
223
+ react-hotkeys-hook:
224
+ specifier: ^5.3.3
225
+ version: 5.3.3(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
223
226
  react-router:
224
227
  specifier: ^7.18.3
225
228
  version: 7.18.3(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
@@ -1327,6 +1330,12 @@ packages:
1327
1330
  peerDependencies:
1328
1331
  react: ^19.2.8
1329
1332
 
1333
+ react-hotkeys-hook@5.3.3:
1334
+ resolution: {integrity: sha512-aswgyWUnE25hmhzHTfKDmKzsaSE5DJ4LKaU/o6rQSXkDd/1Bh9TfAFQbHkf6fLy11HvlYkp+cDDarGdhmCDhoQ==}
1335
+ peerDependencies:
1336
+ react: '>=16.8.0'
1337
+ react-dom: '>=16.8.0'
1338
+
1330
1339
  react-is@16.13.1:
1331
1340
  resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
1332
1341
 
@@ -2557,6 +2566,11 @@ snapshots:
2557
2566
  react: 19.2.8
2558
2567
  scheduler: 0.27.0
2559
2568
 
2569
+ react-hotkeys-hook@5.3.3(react-dom@19.2.8(react@19.2.8))(react@19.2.8):
2570
+ dependencies:
2571
+ react: 19.2.8
2572
+ react-dom: 19.2.8(react@19.2.8)
2573
+
2560
2574
  react-is@16.13.1: {}
2561
2575
 
2562
2576
  react-router@7.18.3(react-dom@19.2.8(react@19.2.8))(react@19.2.8):
@@ -1,4 +1,4 @@
1
- import { Scene } from '@/Scene'
1
+ import { Scene } from '@/Scenes'
2
2
 
3
3
  export function App () {
4
4
  return (
@@ -0,0 +1,42 @@
1
+ import { Canvas, extend } from '@react-three/fiber'
2
+ import { Grid, OrbitControls, Sky } from '@react-three/drei'
3
+ import { Perf } from 'r3f-perf'
4
+ import { SunLight } from 'three/addons/lights/SunLight.js'
5
+
6
+ extend({ SunLight })
7
+
8
+ // One world unit represents one meter.
9
+ export function Scene () {
10
+ return (
11
+ <Canvas camera={{ position: [4, 3.4, 6], fov: 50, far: 100 }} dpr={1} shadows>
12
+ {import.meta.env.DEV && <Perf position='top-right' />}
13
+ <sunLight
14
+ args={['#fff2e3', 2]}
15
+ position={[30, 45, 20]}
16
+ castShadow
17
+ shadow-camera-far={60}
18
+ />
19
+ <Sky distance={1000} rayleigh={1} sunPosition={[30, 45, 20]} turbidity={4} />
20
+ <mesh castShadow position-y={0.7}>
21
+ <boxGeometry args={[1.4, 1.4, 1.4]} />
22
+ <meshStandardMaterial color='#38bdf8' metalness={0.15} roughness={0.35} />
23
+ </mesh>
24
+ <mesh receiveShadow rotation-x={-Math.PI / 2} position-y={-0.01}>
25
+ <planeGeometry args={[64, 64]} />
26
+ <shadowMaterial transparent opacity={0.25} depthWrite={false} />
27
+ </mesh>
28
+ <Grid
29
+ args={[64, 64]}
30
+ cellColor='#cbd5e1'
31
+ cellSize={1}
32
+ cellThickness={0.5}
33
+ fadeDistance={32}
34
+ infiniteGrid
35
+ sectionColor='#94a3b8'
36
+ sectionSize={2}
37
+ sectionThickness={0.8}
38
+ />
39
+ <OrbitControls makeDefault target={[0, 0.7, 0]} />
40
+ </Canvas>
41
+ )
42
+ }
@@ -1,35 +0,0 @@
1
- import { Canvas } from '@react-three/fiber'
2
- import { Grid, OrbitControls } from '@react-three/drei'
3
-
4
- function Box () {
5
- return (
6
- <mesh castShadow position-y={0.7}>
7
- <boxGeometry args={[1.4, 1.4, 1.4]} />
8
- <meshStandardMaterial color='#38bdf8' metalness={0.15} roughness={0.35} />
9
- </mesh>
10
- )
11
- }
12
-
13
- export function Scene () {
14
- return (
15
- <Canvas camera={{ position: [3, 2.4, 4.6], fov: 45 }} shadows>
16
- <color attach='background' args={['#f8fafc']} />
17
- <ambientLight intensity={0.8} />
18
- <directionalLight castShadow intensity={2} position={[4, 6, 3]} />
19
- <Box />
20
- <Grid
21
- args={[12, 12]}
22
- cellColor='#cbd5e1'
23
- cellSize={0.5}
24
- cellThickness={0.6}
25
- fadeDistance={18}
26
- fadeStrength={1}
27
- infiniteGrid
28
- sectionColor='#94a3b8'
29
- sectionSize={2}
30
- sectionThickness={1}
31
- />
32
- <OrbitControls makeDefault />
33
- </Canvas>
34
- )
35
- }