Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
love_飞影
Neos
Commits
8b40ef3d
Commit
8b40ef3d
authored
Oct 22, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix lint
parent
0b4ef6e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
src/ui/BabylonJs.tsx
src/ui/BabylonJs.tsx
+21
-5
No files found.
src/ui/BabylonJs.tsx
View file @
8b40ef3d
import
React
,
{
useEffect
,
useRef
}
from
"
react
"
;
import
React
,
{
useEffect
,
useRef
}
from
"
react
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
export
default
function
()
{
export
default
function
()
{
const
canvasRef
=
useRef
<
HTMLCanvasElement
>
(
null
);
const
canvasRef
=
useRef
<
HTMLCanvasElement
>
(
null
);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -10,17 +10,33 @@ export default function() {
...
@@ -10,17 +10,33 @@ export default function() {
const
engine
=
new
BABYLON
.
Engine
(
canvasCurrent
,
true
);
const
engine
=
new
BABYLON
.
Engine
(
canvasCurrent
,
true
);
const
scene
=
new
BABYLON
.
Scene
(
engine
);
const
scene
=
new
BABYLON
.
Scene
(
engine
);
const
camera
=
new
BABYLON
.
FreeCamera
(
"
camera1
"
,
new
BABYLON
.
Vector3
(
0
,
5
,
-
10
),
scene
);
const
camera
=
new
BABYLON
.
FreeCamera
(
"
camera1
"
,
new
BABYLON
.
Vector3
(
0
,
5
,
-
10
),
scene
);
camera
.
setTarget
(
BABYLON
.
Vector3
.
Zero
());
camera
.
setTarget
(
BABYLON
.
Vector3
.
Zero
());
camera
.
attachControl
(
canvasCurrent
,
true
);
camera
.
attachControl
(
canvasCurrent
,
true
);
const
light
=
new
BABYLON
.
HemisphericLight
(
"
light
"
,
new
BABYLON
.
Vector3
(
0
,
1
,
0
),
scene
);
const
light
=
new
BABYLON
.
HemisphericLight
(
"
light
"
,
new
BABYLON
.
Vector3
(
0
,
1
,
0
),
scene
);
light
.
intensity
=
0.7
;
light
.
intensity
=
0.7
;
const
sphere
=
BABYLON
.
MeshBuilder
.
CreateSphere
(
"
sphere
"
,
{
diameter
:
2
,
segments
:
32
},
scene
);
const
sphere
=
BABYLON
.
MeshBuilder
.
CreateSphere
(
"
sphere
"
,
{
diameter
:
2
,
segments
:
32
},
scene
);
sphere
.
position
.
y
=
1
;
sphere
.
position
.
y
=
1
;
const
ground
=
BABYLON
.
MeshBuilder
.
CreateGround
(
"
ground
"
,
{
width
:
6
,
height
:
6
},
scene
);
const
ground
=
BABYLON
.
MeshBuilder
.
CreateGround
(
"
ground
"
,
{
width
:
6
,
height
:
6
},
scene
);
engine
.
runRenderLoop
(()
=>
{
engine
.
runRenderLoop
(()
=>
{
scene
.
render
();
scene
.
render
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment