Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
147fbb8a
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
GitCode(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
147fbb8a
编写于
6月 01, 2018
作者:
M
Moroine Bentefrit
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MapControls
上级
35ae830a
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
1298 addition
and
0 deletion
+1298
-0
examples/files.js
examples/files.js
+1
-0
examples/js/controls/MapControls.js
examples/js/controls/MapControls.js
+1144
-0
examples/misc_controls_map.html
examples/misc_controls_map.html
+153
-0
未找到文件。
examples/files.js
浏览文件 @
147fbb8a
...
...
@@ -336,6 +336,7 @@ var files = {
"
misc_animation_keys
"
,
"
misc_controls_deviceorientation
"
,
"
misc_controls_fly
"
,
"
misc_controls_map
"
,
"
misc_controls_orbit
"
,
"
misc_controls_pointerlock
"
,
"
misc_controls_trackball
"
,
...
...
examples/js/controls/MapControls.js
0 → 100644
浏览文件 @
147fbb8a
此差异已折叠。
点击以展开。
examples/misc_controls_map.html
0 → 100644
浏览文件 @
147fbb8a
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - map controls
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<style>
body
{
color
:
#000
;
font-family
:
Monospace
;
font-size
:
13px
;
text-align
:
center
;
font-weight
:
bold
;
background-color
:
#fff
;
margin
:
0px
;
overflow
:
hidden
;
}
#info
{
color
:
#000
;
position
:
absolute
;
top
:
0px
;
width
:
100%
;
padding
:
5px
;
}
a
{
color
:
red
;
}
</style>
</head>
<body>
<div
id=
"info"
>
<a
href=
"http://threejs.org"
target=
"_blank"
rel=
"noopener"
>
three.js
</a>
- map controls example
</div>
<script
src=
"../build/three.js"
></script>
<script
src=
"js/controls/MapControls.js"
></script>
<script
src=
"js/Detector.js"
></script>
<script
src=
'js/libs/dat.gui.min.js'
></script>
<script>
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
var
camera
,
controls
,
scene
,
renderer
;
init
();
//render(); // remove when using next line for animation loop (requestAnimationFrame)
animate
();
function
init
()
{
scene
=
new
THREE
.
Scene
();
scene
.
background
=
new
THREE
.
Color
(
0xcccccc
);
scene
.
fog
=
new
THREE
.
FogExp2
(
0xcccccc
,
0.002
);
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
document
.
body
.
appendChild
(
renderer
.
domElement
);
camera
=
new
THREE
.
PerspectiveCamera
(
60
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
1000
);
camera
.
position
.
set
(
400
,
200
,
0
);
// controls
controls
=
new
THREE
.
MapControls
(
camera
,
renderer
.
domElement
);
//controls.addEventListener( 'change', render ); // call this only in static scenes (i.e., if there is no animation loop)
controls
.
enableDamping
=
true
;
// an animation loop is required when either damping or auto-rotation are enabled
controls
.
dampingFactor
=
0.25
;
controls
.
screenSpacePanning
=
false
;
controls
.
minDistance
=
100
;
controls
.
maxDistance
=
500
;
controls
.
maxPolarAngle
=
Math
.
PI
/
2
;
// world
var
geometry
=
new
THREE
.
CylinderBufferGeometry
(
0
,
10
,
30
,
4
,
1
);
var
material
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0xffffff
,
flatShading
:
true
}
);
for
(
var
i
=
0
;
i
<
500
;
i
++
)
{
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
position
.
x
=
Math
.
random
()
*
1600
-
800
;
mesh
.
position
.
y
=
0
;
mesh
.
position
.
z
=
Math
.
random
()
*
1600
-
800
;
mesh
.
updateMatrix
();
mesh
.
matrixAutoUpdate
=
false
;
scene
.
add
(
mesh
);
}
// lights
var
light
=
new
THREE
.
DirectionalLight
(
0xffffff
);
light
.
position
.
set
(
1
,
1
,
1
);
scene
.
add
(
light
);
var
light
=
new
THREE
.
DirectionalLight
(
0x002288
);
light
.
position
.
set
(
-
1
,
-
1
,
-
1
);
scene
.
add
(
light
);
var
light
=
new
THREE
.
AmbientLight
(
0x222222
);
scene
.
add
(
light
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
var
gui
=
new
dat
.
GUI
();
gui
.
add
(
controls
,
'
screenSpacePanning
'
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
function
animate
()
{
requestAnimationFrame
(
animate
);
controls
.
update
();
// only required if controls.enableDamping = true, or if controls.autoRotate = true
render
();
}
function
render
()
{
renderer
.
render
(
scene
,
camera
);
}
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录