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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
Neos
Commits
6d9fab15
Commit
6d9fab15
authored
Dec 27, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add BabylonCanvas
parent
0cf0d046
Pipeline
#18877
passed with stages
in 2 minutes and 26 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
2 deletions
+48
-2
src/ui/Duel/babylon.tsx
src/ui/Duel/babylon.tsx
+46
-2
src/ui/Neos.tsx
src/ui/Neos.tsx
+2
-0
No files found.
src/ui/Duel/babylon.tsx
View file @
6d9fab15
import
React
,
{
useEffect
}
from
"
react
"
;
import
{
Engine
,
Scene
}
from
"
react-babylonjs
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
const
BabylonCanvas
=
()
=>
{};
const
BabylonCanvas
=
()
=>
(
<
div
>
<
Engine
antialias
adaptToDeviceRatio
canvasId=
"babylonJS"
>
<
Scene
>
<
DuelCamera
/>
<
DuelLight
/>
<
DuelGround
/>
</
Scene
>
</
Engine
>
</
div
>
);
const
DuelGround
=
()
=>
{};
const
DuelCamera
=
()
=>
(
<
freeCamera
name=
"duel-camera"
position=
{
new
BABYLON
.
Vector3
(
0
,
8
,
-
10
)
}
target=
{
BABYLON
.
Vector3
.
Zero
()
}
></
freeCamera
>
);
const
DuelLight
=
()
=>
(
<
hemisphericLight
name=
"duel-light"
direction=
{
new
BABYLON
.
Vector3
(
1
,
2.5
,
1
)
}
intensity=
{
0.7
}
></
hemisphericLight
>
);
const
DuelGround
=
()
=>
{
const
shape
=
CONFIG
.
GroundShape
();
const
texture
=
new
BABYLON
.
Texture
(
`http://localhost:3030/images/newfield.png`
);
texture
.
hasAlpha
=
true
;
return
(
<
ground
name=
"duel-ground"
width=
{
shape
.
width
}
height=
{
shape
.
height
}
>
<
standardMaterial
name=
"duel-ground-mat"
diffuseTexture=
{
texture
}
></
standardMaterial
>
</
ground
>
);
};
export
default
BabylonCanvas
;
src/ui/Neos.tsx
View file @
6d9fab15
...
...
@@ -4,6 +4,7 @@ import WaitRoom from "./WaitRoom";
import
{
Routes
,
Route
}
from
"
react-router-dom
"
;
import
Mora
from
"
./Mora
"
;
import
Duel
from
"
./Duel/mod
"
;
import
BabylonCanvas
from
"
./Duel/babylon
"
;
export
default
function
()
{
// FIXME: 这里Mora/Duel路由应该由每个房间指定一个路径
...
...
@@ -13,6 +14,7 @@ export default function () {
<
Route
path=
"/:player/:passWd/:ip"
element=
{
<
WaitRoom
/>
}
/>
<
Route
path=
"/mora"
element=
{
<
Mora
/>
}
/>
<
Route
path=
"/duel"
element=
{
<
Duel
/>
}
/>
<
Route
path=
"/react-babylon"
element=
{
<
BabylonCanvas
/>
}
/>
</
Routes
>
);
}
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