-
Notifications
You must be signed in to change notification settings - Fork 0
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
395337f
commit b00849b
Showing
7 changed files
with
73 additions
and
45 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
26 changes: 26 additions & 0 deletions
26
applications/visualizer/frontend/src/components/viewers/ThreeD/BaseScene.tsx
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {CameraControls, PerspectiveCamera} from "@react-three/drei"; | ||
import { | ||
CAMERA_FAR, | ||
CAMERA_FOV, | ||
CAMERA_NEAR, | ||
CAMERA_POSITION, | ||
LIGHT_1_COLOR, LIGHT_2_COLOR, LIGHT_2_POSITION | ||
} from "../../../../settings/threeDSettings.ts"; | ||
|
||
function BaseScene() { | ||
return <> | ||
<PerspectiveCamera | ||
makeDefault | ||
fov={CAMERA_FOV} | ||
aspect={window.innerWidth / window.innerHeight} | ||
position={CAMERA_POSITION} | ||
near={CAMERA_NEAR} | ||
far={CAMERA_FAR} | ||
/> | ||
<CameraControls makeDefault/> | ||
<ambientLight color={LIGHT_1_COLOR}/> | ||
<directionalLight color={LIGHT_2_COLOR} position={LIGHT_2_POSITION}/> | ||
</>; | ||
} | ||
|
||
export default BaseScene; |
12 changes: 12 additions & 0 deletions
12
applications/visualizer/frontend/src/components/viewers/ThreeD/Gizmo.tsx
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {GizmoHelper, GizmoViewport} from "@react-three/drei"; | ||
|
||
function Gizmo() { | ||
return <GizmoHelper | ||
alignment="bottom-right" | ||
margin={[80, 80]} | ||
> | ||
<GizmoViewport axisColors={["red", "green", "blue"]} hideNegativeAxes hideAxisHeads/> | ||
</GizmoHelper>; | ||
} | ||
|
||
export default Gizmo; |
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
12 changes: 12 additions & 0 deletions
12
applications/visualizer/frontend/src/helpers/threeDHelpers.ts
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export function getFurthestIntersectedObject(event) { | ||
if (!event.intersections || event.intersections.length === 0) { | ||
return null; | ||
} | ||
|
||
// TODO: Replace the following with the concept of raycasting layers | ||
const validIntersections = event.intersections.filter(intersection => intersection.object.userData.id !== undefined); | ||
|
||
const sortedIntersections = validIntersections.sort((a, b) => b.distance - a.distance); | ||
|
||
return sortedIntersections[0].object; | ||
} |