Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zghywpc-vue
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
李苏
zghywpc-vue
Commits
890b44ea
Commit
890b44ea
authored
Aug 28, 2024
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
避免缓存运行卡顿,设置重新渲染方法
parent
cbfe8e71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
Viewer.js
src/common/threeModules/Viewer.js
+28
-1
No files found.
src/common/threeModules/Viewer.js
View file @
890b44ea
...
...
@@ -48,13 +48,33 @@ export default class Viewer {
const
animate
=
()
=>
{
if
(
this
.
canRequestAnimationFrame
){
requestAnimationFrame
(
animate
)
this
.
#
updateDom
()
this
.
#
renderDom
()
this
.
animateEventList
.
forEach
(
event
=>
{
event
.
fun
&&
event
.
content
&&
event
.
fun
(
event
.
content
)
})
requestAnimationFrame
(
animate
)
}
}
animate
()
}
reInit
(){
const
animate
=
()
=>
{
if
(
this
.
canRequestAnimationFrame
){
this
.
#
updateDom
()
this
.
#
renderDom
()
this
.
animateEventList
.
forEach
(
event
=>
{
event
.
fun
&&
event
.
content
&&
event
.
fun
(
event
.
content
)
})
requestAnimationFrame
(
animate
)
}
}
...
...
@@ -127,7 +147,14 @@ export default class Viewer {
alpha
:
true
,
// true/false 表示是否可以设置背景色透明
precision
:
"highp"
,
// highp/mediump/lowp 表示着色精度选择
premultipliedAlpha
:
true
,
// true/false 表示是否可以设置像素深度(用来度量图像的分辨率)
autoClear
:
true
,
preserveDrawingBuffer
:
false
,
antialias
:
true
,
shadowMap
:
false
,
physicalCorrectLights
:
false
})
this
.
renderer
.
clearDepth
();
// 设置深度缓冲区
this
.
renderer
.
shadowMap
.
enabled
=
true
// 场景中的阴影自动更新
this
.
viewerDom
.
appendChild
(
this
.
renderer
.
domElement
)
// 将渲染器添加到画布中
...
...
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