1
- import { Effects } from " @react-three/drei" ;
2
- import { extend } from " @react-three/fiber" ;
1
+ import { Effects } from ' @react-three/drei' ;
2
+ import { extend } from ' @react-three/fiber' ;
3
3
import {
4
4
forwardRefValue ,
5
5
GetStage2D ,
@@ -13,21 +13,24 @@ import {
13
13
TextureRef ,
14
14
useFrameLoop ,
15
15
useTextureAtlas ,
16
- } from "twopoint5d-r3f" ;
17
- import { useEffect , useRef , useState } from "react" ;
18
- import { FilmPass } from "three/examples/jsm/postprocessing/FilmPass" ;
19
- import { RenderPass } from "three/examples/jsm/postprocessing/RenderPass" ;
16
+ } from '@spearwolf/twopoint5d-r3f' ;
17
+ import { useEffect , useRef , useState } from 'react' ;
20
18
21
- import { LogStageSizeToConsole } from "../utils/LogStageSizeToConsole" ;
22
- import { WiredBox } from "../utils/WiredBox" ;
23
- import { BouncingSprites } from "./BouncingSprites" ;
19
+ import { FilmPass } from 'three/examples/jsm/postprocessing/FilmPass' ;
20
+ import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass' ;
24
21
25
- extend ( { RenderPass , FilmPass } ) ;
22
+ import assetsUrl from '~demos/utils/assetsUrl.ts' ;
26
23
27
- export const DemoOrDie = ( { capacity } ) => {
24
+ import { WiredBox } from '../WiredBox.tsx' ;
25
+ import { BouncingSprites } from './BouncingSprites.js' ;
26
+ import { LogStageSizeToConsole } from './LogStageSizeToConsole.jsx' ;
27
+
28
+ extend ( { RenderPass, FilmPass} ) ;
29
+
30
+ export function DemoOrDie ( { capacity} ) {
28
31
const geometry = useRef ( ) ;
29
32
30
- const atlas = useTextureAtlas ( " atlas0" ) ;
33
+ const atlas = useTextureAtlas ( ' atlas0' ) ;
31
34
32
35
const [ tick , setTick ] = useState ( 0 ) ;
33
36
const [ tack , setTack ] = useState ( null ) ;
@@ -44,17 +47,17 @@ export const DemoOrDie = ({ capacity }) => {
44
47
if ( tick < 5 ) {
45
48
setTimeout ( ( ) => setTick ( tick + 1 ) , 1000 ) ;
46
49
} else {
47
- setTack ( { isTack : true } ) ;
50
+ setTack ( { isTack : true } ) ;
48
51
}
49
52
} , [ tick ] ) ;
50
53
51
54
return (
52
55
< >
53
56
< TextureAtlas
54
57
name = "atlas0"
55
- url = "/examples/assets/ lab-walls-tiles.json"
58
+ url = { assetsUrl ( ' lab-walls-tiles.json' ) }
56
59
nearest
57
- overrideImageUrl = "/examples/assets/ lab-walls-tiles.png"
60
+ overrideImageUrl = { assetsUrl ( ' lab-walls-tiles.png' ) }
58
61
/>
59
62
60
63
< Stage2D name = "stage0" noAutoRender noAutoClear >
@@ -66,40 +69,27 @@ export const DemoOrDie = ({ capacity }) => {
66
69
</ Stage2D >
67
70
68
71
< Stage2D name = "stage1" noAutoRender noAutoClear defaultCamera >
69
- < ParallaxProjection
70
- plane = "xy"
71
- origin = "bottom left"
72
- width = { 150 }
73
- height = { 150 }
74
- fit = "contain"
75
- />
72
+ < ParallaxProjection plane = "xy" origin = "bottom left" width = { 150 } height = { 150 } fit = "contain" />
76
73
77
74
< LogStageSizeToConsole />
78
75
79
76
< TexturedSprites >
80
- < TexturedSpritesGeometry
81
- capacity = { capacity }
82
- ref = { geometry }
83
- > </ TexturedSpritesGeometry >
77
+ < TexturedSpritesGeometry capacity = { capacity } ref = { geometry } > </ TexturedSpritesGeometry >
84
78
< TexturedSpritesMaterial depthTest = { false } depthWrite = { false } >
85
79
< TextureRef name = "atlas0" attach = "colorMap" />
86
80
</ TexturedSpritesMaterial >
87
81
</ TexturedSprites >
88
82
</ Stage2D >
89
83
90
- < GetStage2D name = { [ " stage0" , " stage1" ] } >
84
+ < GetStage2D name = { [ ' stage0' , ' stage1' ] } >
91
85
{ ( stage0 , stage1 ) => (
92
86
< Effects disableRenderPass = { true } >
93
87
< renderPass args = { [ stage0 . scene , stage0 . camera ] } />
94
- < renderPass
95
- clear = { false }
96
- clearDepth = { true }
97
- args = { [ stage1 . scene , stage1 . camera , undefined , false , false ] }
98
- />
88
+ < renderPass clear = { false } clearDepth = { true } args = { [ stage1 . scene , stage1 . camera , undefined , false , false ] } />
99
89
< filmPass args = { [ 1 , 0.5 , 10 , 0 ] } />
100
90
</ Effects >
101
91
) }
102
92
</ GetStage2D >
103
93
</ >
104
94
) ;
105
- } ;
95
+ }
0 commit comments