-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e48cd35
commit 62fa405
Showing
6 changed files
with
295 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,49 @@ | ||
import Test2 from "./test2"; | ||
import Satelites from "./satelites"; | ||
import React, { useRef, useState, Suspense } from "react"; | ||
import { Canvas, useFrame, useThree, extend } from "@react-three/fiber"; | ||
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls"; | ||
import Test2 from "./test2" | ||
import Satelites from "./satelites" | ||
import React, { useRef, useState, Suspense } from "react" | ||
import { Canvas, useFrame, useThree, extend } from "@react-three/fiber" | ||
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls" | ||
import { Stars } from '@react-three/drei' | ||
|
||
extend({ OrbitControls }); | ||
extend({ OrbitControls }) | ||
|
||
const CameraControls = () => { | ||
// Get a reference to the Three.js Camera, and the canvas html element. | ||
// We need these to setup the OrbitControls component. | ||
// https://threejs.org/docs/#examples/en/controls/OrbitControls | ||
const { | ||
camera, | ||
gl: { domElement }, | ||
} = useThree(); | ||
// Ref to the controls, so that we can update them on every frame using useFrame | ||
const controls = useRef(); | ||
useFrame((state) => controls.current.update()); | ||
return <orbitControls ref={controls} args={[camera, domElement]} />; | ||
}; | ||
} = useThree() | ||
const controls = useRef() | ||
useFrame((state) => controls.current.update()) | ||
|
||
return <orbitControls ref={controls} args={[camera, domElement]} /> | ||
} | ||
|
||
|
||
const Test = () => ( | ||
<Canvas | ||
colorManagement | ||
camera={{ position: [25, 25, 25], fov: 10, far: 10000 }} | ||
raycaster={{ params: { Points: { threshold: 0.2 } } }} | ||
> | ||
<ambientLight /> | ||
<CameraControls /> | ||
{/* <spotLight position={[10, 10, 10]} angle={0.15} /> */} | ||
<CameraControls /> | ||
{/* Stars package takes time, comment out when working! */} | ||
<Suspense fallback={null}> | ||
<Test2 /> | ||
<Satelites id="points" /> | ||
<Stars | ||
radius={75} // Radius of the inner sphere (default=100) | ||
depth={35} // Depth of area where stars should fit (default=50) | ||
count={5000} // Amount of stars (default=5000) | ||
factor={20} // Size factor (default=4) | ||
saturation={0.2} // Saturation 0-1 (default=0) | ||
fade // Faded dots (default=false) | ||
/> | ||
</Suspense> | ||
</Canvas> | ||
|
||
); | ||
|
||
export default Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.