Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-manager-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
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
赵啸非
device-manager-ui
Commits
6d038320
Commit
6d038320
authored
Mar 31, 2025
by
王晓旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据宣汉项目修改了一下灯光和缩放
parent
3b1848c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
.env
.env
+1
-1
src/views/analysis/components/three/three.vue
src/views/analysis/components/three/three.vue
+15
-4
No files found.
.env
View file @
6d038320
...
@@ -9,7 +9,7 @@ VUE_APP_BASE_API =127.0.0.1:18222/m
...
@@ -9,7 +9,7 @@ VUE_APP_BASE_API =127.0.0.1:18222/m
VUE_APP_PORTAL_URL = http://192.168.0.98:11072
VUE_APP_PORTAL_URL = http://192.168.0.98:11072
# 站点请求地址
# 站点请求地址
VUE_APP_SITETREE_URL = http://192.168.0.98:110
78
/base/site/siteTree
VUE_APP_SITETREE_URL = http://192.168.0.98:110
91/m/basics_api
/base/site/siteTree
# 系统名称
# 系统名称
VUE_APP_sysName = "设备物联网"
VUE_APP_sysName = "设备物联网"
src/views/analysis/components/three/three.vue
View file @
6d038320
...
@@ -283,9 +283,9 @@ export default {
...
@@ -283,9 +283,9 @@ export default {
directionalLight
:
"
#0xffc288
"
,
//点光源
directionalLight
:
"
#0xffc288
"
,
//点光源
intensity
:
1
,
//灯光强度
intensity
:
1
,
//灯光强度
visible
:
true
,
//是否可见
visible
:
true
,
//是否可见
castShadow
:
true
,
castShadow
:
true
,
//是否阴影
exponent
:
30
,
exponent
:
30
,
target
:
"
plane
"
,
target
:
"
plane
"
,
//距原点距离
debug
:
false
,
debug
:
false
,
};
};
...
@@ -334,11 +334,13 @@ export default {
...
@@ -334,11 +334,13 @@ export default {
.
name
(
"
z
"
);
.
name
(
"
z
"
);
},
},
_initTree
()
{
_initTree
()
{
// 把模型放到透视相机中设置
scene
=
new
THREE
.
Scene
();
scene
=
new
THREE
.
Scene
();
// alert(this.$el.offsetWidth)
// alert(this.$el.offsetWidth)
// alert(this.$el.offsetHeight)
// alert(this.$el.offsetHeight)
let
screenW
=
this
.
$el
.
offsetWidth
;
let
screenW
=
this
.
$el
.
offsetWidth
;
let
screenH
=
this
.
$el
.
offsetHeight
;
let
screenH
=
this
.
$el
.
offsetHeight
;
// 设置透视相机
camera
=
new
THREE
.
PerspectiveCamera
(
4
,
screenW
/
screenH
,
0.01
,
20000
);
camera
=
new
THREE
.
PerspectiveCamera
(
4
,
screenW
/
screenH
,
0.01
,
20000
);
this
.
_initCamera
();
this
.
_initCamera
();
camera
.
lookAt
(
scene
.
position
);
camera
.
lookAt
(
scene
.
position
);
...
@@ -370,6 +372,7 @@ export default {
...
@@ -370,6 +372,7 @@ export default {
}
}
this
.
animation
();
this
.
animation
();
},
},
// 动画
animation
()
{
animation
()
{
// TWEEN.update()
// TWEEN.update()
requestAnimationFrame
(
this
.
animation
);
requestAnimationFrame
(
this
.
animation
);
...
@@ -390,6 +393,7 @@ export default {
...
@@ -390,6 +393,7 @@ export default {
// renderer.render( scene, camera );
// renderer.render( scene, camera );
// labelRenderer.render( scene, camera );
// labelRenderer.render( scene, camera );
},
},
// 样式渲染
css2renderer
()
{
css2renderer
()
{
let
screenW
=
this
.
$el
.
offsetWidth
;
let
screenW
=
this
.
$el
.
offsetWidth
;
let
screenH
=
this
.
$el
.
offsetHeight
;
let
screenH
=
this
.
$el
.
offsetHeight
;
...
@@ -404,12 +408,14 @@ export default {
...
@@ -404,12 +408,14 @@ export default {
labelRenderer
.
domElement
.
style
.
top
=
0
;
labelRenderer
.
domElement
.
style
.
top
=
0
;
this
.
$refs
.
three
.
appendChild
(
labelRenderer
.
domElement
);
this
.
$refs
.
three
.
appendChild
(
labelRenderer
.
domElement
);
},
},
// 将渲染好的样式插入节点中
css2controls
()
{
css2controls
()
{
this
.
css2renderer
();
this
.
css2renderer
();
controls
=
new
OrbitControls
(
camera
,
labelRenderer
.
domElement
);
controls
=
new
OrbitControls
(
camera
,
labelRenderer
.
domElement
);
var
counter
=
document
.
getElementById
(
"
counter
"
);
var
counter
=
document
.
getElementById
(
"
counter
"
);
counter
.
appendChild
(
renderer
.
domElement
);
counter
.
appendChild
(
renderer
.
domElement
);
},
},
// 设置灯光
_Light
()
{
_Light
()
{
ambientLight
=
new
THREE
.
AmbientLight
(
0xffffff
,
0.2
);
ambientLight
=
new
THREE
.
AmbientLight
(
0xffffff
,
0.2
);
ambientLight
.
position
.
set
(
0
,
0
,
0
);
ambientLight
.
position
.
set
(
0
,
0
,
0
);
...
@@ -418,11 +424,14 @@ export default {
...
@@ -418,11 +424,14 @@ export default {
directionalLight
.
castShadow
=
true
;
directionalLight
.
castShadow
=
true
;
directionalLight
.
position
.
set
(
5
,
10
,
7.5
);
directionalLight
.
position
.
set
(
5
,
10
,
7.5
);
scene
.
add
(
directionalLight
);
scene
.
add
(
directionalLight
);
console
.
log
(
'
设置灯光
'
,
directionalLight
,
scene
);
// SpotLight = new THREE.SpotLight(0xffffff,1);
// SpotLight = new THREE.SpotLight(0xffffff,1);
// SpotLight.castShadow = true;
// SpotLight.castShadow = true;
// SpotLight.position.set( 385.522, 1132.217, 1825.427 );
// SpotLight.position.set( 385.522, 1132.217, 1825.427 );
// scene.add(SpotLight)
// scene.add(SpotLight)
},
},
// 渲染每一层楼层图
_3Dloder
()
{
_3Dloder
()
{
let
_this
=
this
;
let
_this
=
this
;
let
dracoLoader
=
new
DRACOLoader
();
let
dracoLoader
=
new
DRACOLoader
();
...
@@ -464,8 +473,8 @@ export default {
...
@@ -464,8 +473,8 @@ export default {
// console.log(obj,'@@@@@@@');
// console.log(obj,'@@@@@@@');
// const children = obj.scene.children[0].children;
// const children = obj.scene.children[0].children;
const
children
=
obj
.
scene
.
children
;
const
children
=
obj
.
scene
.
children
;
// const positionY = (iterator - 1.7) * 2
00;
const
positionY
=
(
iterator
-
1.7
)
*
1
00
;
const
positionY
=
(
iterator
-
1.7
)
*
5
0
;
// const positionY = (iterator - 1.7) * 2
0;
children
.
forEach
((
element
)
=>
{
children
.
forEach
((
element
)
=>
{
let
objname
=
element
.
name
;
let
objname
=
element
.
name
;
console
.
log
(
'
objname
'
,
objname
,
iterator
);
console
.
log
(
'
objname
'
,
objname
,
iterator
);
...
@@ -502,6 +511,7 @@ export default {
...
@@ -502,6 +511,7 @@ export default {
},
},
obj
:
obj
.
scene
,
obj
:
obj
.
scene
,
};
};
scene
.
scale
.
set
(
0.2
,
0.2
,
0.2
)
scene
.
add
(
obj
.
scene
);
//返回的组对象插入场景中
scene
.
add
(
obj
.
scene
);
//返回的组对象插入场景中
_this
.
isloading
=
false
;
_this
.
isloading
=
false
;
});
});
...
@@ -581,6 +591,7 @@ export default {
...
@@ -581,6 +591,7 @@ export default {
//返回选中的对象
//返回选中的对象
return
intersects
;
return
intersects
;
},
},
// 点击模型
clickmodel
(
event
)
{
clickmodel
(
event
)
{
let
intersects
=
this
.
getIntersects
(
event
);
let
intersects
=
this
.
getIntersects
(
event
);
// 获取选中最近的 Mesh 对象
// 获取选中最近的 Mesh 对象
...
...
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