Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cs_vsofpm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuhao
cs_vsofpm
Commits
b3bd4ed3
Commit
b3bd4ed3
authored
Dec 25, 2023
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asd
parent
ad0596f4
Pipeline
#6694
passed with stages
in 15 minutes and 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
13 deletions
+45
-13
proxy.ts
config/proxy.ts
+1
-1
index.jsx
src/components/PointViewer/index.jsx
+0
-2
index.jsx
src/components/ThreeViewer/index.jsx
+44
-10
No files found.
config/proxy.ts
View file @
b3bd4ed3
...
...
@@ -22,7 +22,7 @@
export
default
{
dev
:
{
"/vstp/"
:
{
target
:
"http://jmcl.nangaoyun.com/vstp/"
,
target
:
"http://jmcl.nangaoyun.com/vstp/"
,
// "http://jmcl.nangaoyun.com/vstp/",
changeOrigin
:
true
,
// pathRewrite: { "^/vstp": "" },
},
...
...
src/components/PointViewer/index.jsx
View file @
b3bd4ed3
...
...
@@ -16,7 +16,6 @@ import "./index.less";
function
Sphere
({
position
,
CoordinatePoint
,
CurGongjianPoint
})
{
const
meshRef
=
useRef
();
return
(
<
mesh
ref=
{
meshRef
}
...
...
@@ -67,7 +66,6 @@ function PointViewer({ position, CoordinatePoint, CurGongjianPoint }) {
}
}
>
<
axesHelper
args=
{
[
20
]
}
></
axesHelper
>
<
Gltf
src=
{
"./model.glb"
}
receiveShadow
...
...
src/components/ThreeViewer/index.jsx
View file @
b3bd4ed3
...
...
@@ -8,7 +8,7 @@
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
*/
import
{
Gltf
,
OrbitControls
}
from
"@react-three/drei"
;
import
{
Gltf
,
OrbitControls
,
Stage
}
from
"@react-three/drei"
;
import
{
Canvas
,
useLoader
}
from
"@react-three/fiber"
;
import
{
memo
}
from
"react"
;
import
{
FBXLoader
}
from
"three/examples/jsm/loaders/FBXLoader"
;
...
...
@@ -22,30 +22,55 @@ const ModelLoader = memo(({ url = "./glb/camera.obj" }) => {
const
modelType
=
urlsplit
[
urlsplit
.
length
-
1
];
if
(
modelType
===
"gltf"
||
modelType
===
"glb"
)
{
return
<
Gltf
src=
{
url
}
receiveShadow
castShadow
position=
{
[
0
,
0
,
0
]
}
/>;
return
(
<
Gltf
src=
{
url
}
receiveShadow
castShadow
position=
{
[
0
,
0
,
0
]
}
scale=
{
20
}
inject=
{
<
meshPhysicalMaterial
color=
"white"
metalness=
{
1
}
// 控制金属感,1 表示完全金属
roughness=
{
0
}
// 控制光滑度,0 表示非常光滑
/>
}
/>
);
}
else
if
(
modelType
===
"obj"
)
{
loader
=
useLoader
(
OBJLoader
,
url
);
return
(
<
group
>
<
mesh
receiveShadow
castShadow
scale=
{
20
}
>
<
primitive
object=
{
loader
.
clone
()
}
receiveShadow
castShadow
position=
{
[
0
,
0
,
0
]
}
/>
</
group
>
<
meshPhysicalMaterial
color=
"white"
metalness=
{
1
}
// 控制金属感,1 表示完全金属
roughness=
{
0
}
// 控制光滑度,0 表示非常光滑
/>
</
mesh
>
);
}
else
if
(
modelType
===
"fbx"
)
{
loader
=
useLoader
(
FBXLoader
,
url
);
return
(
<
group
>
<
mesh
receiveShadow
castShadow
scale=
{
20
}
>
<
primitive
object=
{
loader
.
scene
.
clone
()
}
receiveShadow
castShadow
position=
{
[
0
,
0
,
0
]
}
/>
</
group
>
<
meshPhysicalMaterial
color=
"white"
metalness=
{
1
}
// 控制金属感,1 表示完全金属
roughness=
{
0
}
// 控制光滑度,0 表示非常光滑
/>
</
mesh
>
);
}
});
...
...
@@ -54,11 +79,20 @@ function ThreeViewer({ url }) {
return
(
<
div
className=
"bar-block-component"
>
<
Canvas
style=
{
{
height
:
"600px"
,
width
:
"100%"
}
}
id=
{
"sada"
}
>
<
color
attach=
"background"
args=
{
[
"#333"
]
}
/>
<
ambientLight
intensity=
{
1
}
/>
<
color
attach=
"background"
args=
{
[
"white"
]
}
/>
<
OrbitControls
></
OrbitControls
>
<
pointLight
position=
{
[
10
,
10
,
10
]
}
intensity=
{
1
}
/>
<
ModelLoader
url=
{
url
}
/>
<
Stage
intensity=
{
0.5
}
preset=
"rembrandt"
shadows=
{
"contact"
}
adjustCamera=
{
1
}
environment=
{
{
path
:
"/"
,
files
:
"env.hdr"
,
}
}
>
<
ModelLoader
url=
{
url
}
/>
</
Stage
>
</
Canvas
>
</
div
>
);
...
...
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