Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
3
3DMobileRender
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xhw
3DMobileRender
Commits
a9dcf2ed
Commit
a9dcf2ed
authored
Jul 29, 2026
by
xhw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uploadImage
parent
3a29c1d7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
11 deletions
+36
-11
SparkSplatViewer.js
+36
-11
index.html
+0
-0
No files found.
SparkSplatViewer.js
View file @
a9dcf2ed
...
...
@@ -43,7 +43,7 @@ export class SparkSplatViewer {
// Spark渲染器配置
maxStdDev
:
options
.
maxStdDev
??
Math
.
sqrt
(
5
),
sortRadial
:
options
.
sortRadial
??
tru
e
,
sortRadial
:
options
.
sortRadial
??
fals
e
,
enableLod
:
options
.
enableLod
??
true
,
lodSplatScale
:
options
.
lodSplatScale
??
1.0
,
...
...
@@ -117,11 +117,17 @@ export class SparkSplatViewer {
antialias
:
false
,
alpha
:
false
,
canvas
:
options
.
canvas
||
undefined
,
powerPreference
:
"high-performance"
,
// 强制独显
depth
:
false
,
// 3DGS 不需要 depth
stencil
:
false
,
});
this
.
renderer
.
setSize
(
this
.
container
.
clientWidth
,
this
.
container
.
clientHeight
);
this
.
renderer
.
setPixelRatio
(
Math
.
min
(
window
.
devicePixelRatio
,
2
));
this
.
renderer
.
toneMapping
=
THREE
.
ACESFilmicToneMapping
;
this
.
renderer
.
toneMappingExposure
=
1
;
this
.
renderer
.
setPixelRatio
(
Math
.
min
(
window
.
devicePixelRatio
,
1
));
// this.renderer.toneMapping = THREE.ACESFilmicToneMapping;
// this.renderer.toneMappingExposure = 1;
// 改为:
this
.
renderer
.
toneMapping
=
THREE
.
NoToneMapping
;
// 或 LinearToneMapping
if
(
!
options
.
canvas
)
{
this
.
container
.
appendChild
(
this
.
renderer
.
domElement
);
...
...
@@ -293,17 +299,35 @@ export class SparkSplatViewer {
_startRenderLoop
()
{
const
animate
=
()
=>
{
if
(
this
.
isDestroyed
)
return
;
requestAnimationFrame
(
animate
);
// 先预约下一帧,避免掉帧
const
deltaTime
=
this
.
_clock
.
getDelta
();
// 自动旋转
(仅在用户未交互时)
// 自动旋转
if
(
this
.
options
.
autoRotate
&&
!
this
.
_isUserInteracting
)
{
this
.
_doAutoRotate
(
deltaTime
);
this
.
_needsRender
=
true
;
}
// 控制器阻尼更新
if
(
this
.
controls
.
enableDamping
)
{
const
oldPos
=
this
.
_lastCameraPos
.
clone
();
const
oldQuat
=
this
.
_lastCameraQuat
.
clone
();
this
.
controls
.
update
();
if
(
!
this
.
camera
.
position
.
equals
(
oldPos
)
||
!
this
.
camera
.
quaternion
.
equals
(
oldQuat
))
{
this
.
_needsRender
=
true
;
this
.
_lastCameraPos
.
copy
(
this
.
camera
.
position
);
this
.
_lastCameraQuat
.
copy
(
this
.
camera
.
quaternion
);
}
}
else
{
this
.
controls
.
update
();
}
// 只在需要时渲染
if
(
this
.
_needsRender
)
{
this
.
renderer
.
render
(
this
.
scene
,
this
.
camera
);
this
.
_needsRender
=
false
;
}
this
.
controls
.
update
();
this
.
renderer
.
render
(
this
.
scene
,
this
.
camera
);
requestAnimationFrame
(
animate
);
};
requestAnimationFrame
(
animate
);
}
...
...
@@ -316,6 +340,7 @@ export class SparkSplatViewer {
this
.
camera
.
aspect
=
w
/
h
;
this
.
camera
.
updateProjectionMatrix
();
this
.
renderer
.
setSize
(
w
,
h
);
this
.
renderer
.
setPixelRatio
(
Math
.
min
(
window
.
devicePixelRatio
,
1.0
));
// ← 保持限制
}
/** 获取设备类型 */
...
...
index.html
View file @
a9dcf2ed
This diff is collapsed.
Click to expand it.
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