diff --git a/src/components/Game.tsx b/src/components/Game.tsx index 31eceb2..47ba581 100644 --- a/src/components/Game.tsx +++ b/src/components/Game.tsx @@ -286,7 +286,7 @@ const Game = () => { rotation-y={camRotY} > - {/* + { bigHUDScale={currentSpriteHUD!["big"]["scale"]} orthoCameraPosY={orthoCameraPosY} id={currentSpriteHUD!["id"]} - /> */} + /> diff --git a/src/components/GrayRing.tsx b/src/components/GrayRing.tsx index 10b8947..cdf6b6d 100644 --- a/src/components/GrayRing.tsx +++ b/src/components/GrayRing.tsx @@ -28,7 +28,6 @@ const GrayRing = (props: GrayRingProps) => { scale={[1.3, 1.3, 1.3]} position={[0, props.grayRingPosY, 0]} rotation={[0, 0.26, 0]} - dispose={null} > { position={[0, props.purpleRingPosY, 0]} rotation-y={purpleRingRotY} scale={[1.3, 1.3, 1.3]} - dispose={null} > { const blueUniforms = useMemo( @@ -61,41 +63,209 @@ const Starfield = () => { } `; + const LCG = (a: number, c: number, m: number, s: number) => () => + (s = (s * a + c) % m); + + const lcgInstance = LCG(1664525, 1013904223, 2 ** 32, 2); + + const posesBlueFromRight = Array.from({ length: 40 }, () => [ + lcgInstance() / 1000000000, + lcgInstance() / 1000000000, + lcgInstance() / 1000000000, + ]); + + const posesBlueFromLeft = Array.from({ length: 25 }, () => [ + lcgInstance() / 1000000000, + lcgInstance() / 1000000000, + lcgInstance() / 1000000000, + ]); + + const posesCyanFromRight = Array.from({ length: 10 }, () => [ + lcgInstance() / 1000000000, + lcgInstance() / 1000000000, + lcgInstance() / 1000000000, + ]); + + const posesCyanFromLeft = Array.from({ length: 5 }, () => [ + lcgInstance() / 1000000000, + lcgInstance() / 1000000000, + lcgInstance() / 1000000000, + ]); + + const posesWhiteFromleft = Array.from({ length: 5 }, () => [ + lcgInstance() / 1000000000, + lcgInstance() / 1000000000, + lcgInstance() / 1000000000, + ]); + + const blueFromRightRef = useRef(posesBlueFromRight.map(() => createRef())); + const blueFromLeftRef = useRef(posesBlueFromLeft.map(() => createRef())); + const cyanFromRightRef = useRef(posesCyanFromRight.map(() => createRef())); + const cyanFromLeftRef = useRef(posesCyanFromLeft.map(() => createRef())); + const whiteFromLeftRef = useRef(posesWhiteFromleft.map(() => createRef())); + + useFrame(() => { + blueFromRightRef.current.map((ref) => { + if ((ref.current as any).position.x < -1) { + (ref.current as any).position.x += 7.3; + (ref.current as any).position.z -= 7.3; + } else { + (ref.current as any).position.x -= 0.03; + (ref.current as any).position.z += 0.03; + } + }); + blueFromLeftRef.current.map((ref) => { + if ((ref.current as any).position.x > 3) { + (ref.current as any).position.x -= 3.3; + (ref.current as any).position.z -= 3.3; + } else { + (ref.current as any).position.x += 0.03; + (ref.current as any).position.z += 0.03; + } + }); + cyanFromRightRef.current.map((ref) => { + if ((ref.current as any).position.x < -1) { + (ref.current as any).position.x += 4.3; + (ref.current as any).position.z -= 4.3; + } else { + (ref.current as any).position.x -= 0.03; + (ref.current as any).position.z += 0.03; + } + }); + cyanFromLeftRef.current.map((ref) => { + if ((ref.current as any).position.x > 3) { + (ref.current as any).position.x -= 3.3; + (ref.current as any).position.z -= 3.3; + } else { + (ref.current as any).position.x += 0.03; + (ref.current as any).position.z += 0.03; + } + }); + whiteFromLeftRef.current.map((ref) => { + if ((ref.current as any).position.x > 3) { + (ref.current as any).position.x -= 3.3; + (ref.current as any).position.z -= 3.3; + } else { + (ref.current as any).position.x += 0.03; + (ref.current as any).position.z += 0.03; + } + }); + }); + return ( - - - - - - - - - - - - - + + {posesBlueFromRight.map((pos: any, idx: number) => { + return ( + + + + + ); + })} + {posesBlueFromLeft.map((pos: any, idx: number) => { + return ( + + + + + ); + })} + {posesCyanFromRight.map((pos: any, idx: number) => { + return ( + + + + + ); + })} + {posesCyanFromLeft.map((pos: any, idx: number) => { + return ( + + + + + ); + })} + {posesWhiteFromleft.map((pos: any, idx: number) => { + return ( + + + + + ); + })} ); };