add stereo-exp1
This commit is contained in:
24
stereo-exp1/src/Experience.jsx
Normal file
24
stereo-exp1/src/Experience.jsx
Normal file
@ -0,0 +1,24 @@
|
||||
import { useThree, extend } from '@react-three/fiber'
|
||||
import { OrbitControls } from '@react-three/drei'
|
||||
|
||||
export default function Experience()
|
||||
{
|
||||
const { camera, gl } = useThree()
|
||||
|
||||
return <>
|
||||
<OrbitControls />
|
||||
|
||||
<directionalLight position={ [ 1, 2, 3 ] } intensity={ 4.5 } />
|
||||
<ambientLight intensity={ 1.5 } />
|
||||
|
||||
<mesh position-y={ 5 } scale={ 10 }>
|
||||
<planeGeometry />
|
||||
<meshStandardMaterial color="blue"/>
|
||||
</mesh>
|
||||
|
||||
<mesh position-y={ - 1 } rotation-x={ - Math.PI * 0.5 } scale={ 10 }>
|
||||
<planeGeometry />
|
||||
<meshStandardMaterial color="grey" />
|
||||
</mesh>
|
||||
</>
|
||||
}
|
12
stereo-exp1/src/index.html
Normal file
12
stereo-exp1/src/index.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Stereo Experiment 1</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="./index.jsx"></script></body>
|
||||
</html>
|
19
stereo-exp1/src/index.jsx
Normal file
19
stereo-exp1/src/index.jsx
Normal file
@ -0,0 +1,19 @@
|
||||
import './style.css'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import { Canvas } from '@react-three/fiber'
|
||||
import Experience from './Experience.jsx'
|
||||
|
||||
const root = ReactDOM.createRoot(document.querySelector('#root'))
|
||||
|
||||
root.render(
|
||||
<Canvas
|
||||
camera={ {
|
||||
fov: 45,
|
||||
near: 0.1,
|
||||
far: 200,
|
||||
position: [ - 4, 3, 6 ]
|
||||
} }
|
||||
>
|
||||
<Experience />
|
||||
</Canvas>
|
||||
)
|
11
stereo-exp1/src/style.css
Normal file
11
stereo-exp1/src/style.css
Normal file
@ -0,0 +1,11 @@
|
||||
html,
|
||||
body,
|
||||
#root
|
||||
{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: ivory;
|
||||
}
|
Reference in New Issue
Block a user