Repository navigation
Expand file tree
/
Copy pathBoard.js
More file actions
54 lines (41 loc) · 1.64 KB
/
Copy pathBoard.js
File metadata and controls
54 lines (41 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import * as React from 'react';
// import {useFrame /*useFrame*/} from '@react-three/fiber';
import {Canvas} from '@react-three/fiber';
import Controls from './OrbitControls';
import {useImperativeHandle, useRef, forwardRef} from 'react';
import {TrackballControls} from '@react-three/fiber';
import OrbitControls from './OrbitControls';
import Cells from './Cells';
export const Board = ({board, layoutType, selectedPoint, onSelectPoint, mazeType}, ref) => {
const controlsRef = useRef(OrbitControls);
useImperativeHandle(ref, () => ({
resetCamera: () => {
return controlsRef.current.resetCamera();
},
}));
return (
<Canvas>
<Controls ref = {controlsRef} selectedPoint = {selectedPoint}/>
{/* <mesh> /!* BorderBox *!/ */}
{/* <boxBufferGeometry attach = "geometry" args = {[80, 80, -10]}/> */}
{/* <meshBasicMaterial attach = "material" color = "black"/> */}
{/* </mesh> */}
<ambientLight color = "white" intensity = {0.1}/>
<hemisphereLight
color = "#ffffff"
skyColor = "#ffffbb"
groundColor = "#080820"
intensity = {1.0}
/>
<Cells
board = {board}
layoutType = {layoutType}
mazeType = {mazeType}
selectedPoint = {selectedPoint}
onSelectPoint = {onSelectPoint}
/>
{/*<Effects />*/}
</Canvas>
);
};
export default forwardRef(Board);