Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
2a7db739
T
three.js
项目概览
Ablesons
/
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,体验更适合开发者的 AI 搜索 >>
提交
2a7db739
编写于
2月 10, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8047 from rnixik/example-stereo-pano
Example stereo pano
上级
11414c7a
ebe81838
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
229 addition
and
1 deletion
+229
-1
examples/files.js
examples/files.js
+2
-1
examples/textures/cube/sun_temple_stripe_stereo.jpg
examples/textures/cube/sun_temple_stripe_stereo.jpg
+0
-0
examples/webvr_stereo_pano.html
examples/webvr_stereo_pano.html
+227
-0
未找到文件。
examples/files.js
浏览文件 @
2a7db739
...
...
@@ -229,7 +229,8 @@ var files = {
],
"
webvr
"
:
[
"
webvr_cubes
"
,
"
webvr_video
"
"
webvr_video
"
,
"
webvr_stereo_pano
"
],
"
css3d
"
:
[
"
css3d_molecules
"
,
...
...
examples/textures/cube/sun_temple_stripe_stereo.jpg
0 → 100644
浏览文件 @
2a7db739
681.8 KB
examples/webvr_stereo_pano.html
0 → 100644
浏览文件 @
2a7db739
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - stereo pano demo
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<meta
name=
"viewmode"
content=
"projection=stereo"
>
<style>
html
,
body
{
background-color
:
#000
;
margin
:
0px
;
padding
:
0px
;
overflow
:
hidden
;
}
#VrMode
{
position
:
absolute
;
top
:
0
;
left
:
0
;
margin
:
10px
;
background
:
black
;
border
:
0
;
color
:
#fff
;
padding
:
10px
;
font-size
:
1rem
;
}
</style>
</head>
<body>
<button
id=
"VrMode"
>
VR MODE
</button>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/controls/OrbitControls.js"
></script>
<script
src=
"js/controls/VRControls.js"
></script>
<script
src=
"js/effects/VREffect.js"
></script>
<script>
var
camera
;
var
vrControls
;
var
effect
;
var
renderer
;
var
scene
;
var
vrMode
=
false
;
function
init
()
{
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
?
window
.
devicePixelRatio
:
1
);
document
.
body
.
appendChild
(
renderer
.
domElement
);
scene
=
new
THREE
.
Scene
();
camera
=
new
THREE
.
PerspectiveCamera
(
90
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
10000
);
camera
.
position
.
z
=
0.0001
;
camera
.
layers
.
enable
(
1
);
effect
=
new
THREE
.
VREffect
(
renderer
);
if
(
navigator
.
getVRDevices
)
{
vrControls
=
new
THREE
.
VRControls
(
camera
,
vrFallback
);
}
else
{
vrFallback
();
}
var
textures
=
getTexturesFromAtlasFile
(
"
textures/cube/sun_temple_stripe_stereo.jpg
"
,
12
);
var
materials
=
[];
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
materials
.
push
(
new
THREE
.
MeshBasicMaterial
(
{
map
:
textures
[
i
]
}
)
);
}
var
skyBox
=
new
THREE
.
Mesh
(
new
THREE
.
CubeGeometry
(
1024
,
1024
,
1024
),
new
THREE
.
MeshFaceMaterial
(
materials
)
);
skyBox
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeScale
(
1
,
1
,
-
1
)
);
skyBox
.
layers
.
set
(
1
);
scene
.
add
(
skyBox
);
var
materialsR
=
[];
for
(
var
i
=
6
;
i
<
12
;
i
++
)
{
materialsR
.
push
(
new
THREE
.
MeshBasicMaterial
(
{
map
:
textures
[
i
]
}
)
);
}
var
skyBoxR
=
new
THREE
.
Mesh
(
new
THREE
.
CubeGeometry
(
1024
,
1024
,
1024
),
new
THREE
.
MeshFaceMaterial
(
materialsR
)
);
skyBoxR
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeScale
(
1
,
1
,
-
1
)
);
skyBoxR
.
layers
.
set
(
2
);
scene
.
add
(
skyBoxR
);
animate
();
onWindowResize
();
}
function
getTexturesFromAtlasFile
(
atlasImgUrl
,
tilesNum
)
{
var
textures
=
[];
for
(
var
i
=
0
;
i
<
tilesNum
;
i
++
)
{
textures
[
i
]
=
new
THREE
.
Texture
();
}
var
imageObj
=
new
Image
();
imageObj
.
onload
=
function
()
{
var
canvas
,
context
;
var
tileWidth
=
imageObj
.
height
;
for
(
var
i
=
0
;
i
<
textures
.
length
;
i
++
)
{
canvas
=
document
.
createElement
(
'
canvas
'
);
context
=
canvas
.
getContext
(
'
2d
'
);
canvas
.
height
=
tileWidth
;
canvas
.
width
=
tileWidth
;
context
.
drawImage
(
imageObj
,
tileWidth
*
i
,
0
,
tileWidth
,
tileWidth
,
0
,
0
,
tileWidth
,
tileWidth
);
textures
[
i
].
image
=
canvas
textures
[
i
].
needsUpdate
=
true
;
}
};
imageObj
.
src
=
atlasImgUrl
;
return
textures
;
}
function
vrFallback
()
{
vrControls
=
new
THREE
.
OrbitControls
(
camera
);
document
.
querySelector
(
'
#VrMode
'
).
style
.
textDecoration
=
"
line-through
"
;
}
function
requestFullscreen
()
{
effect
.
setFullScreen
(
true
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
if
(
vrMode
)
{
effect
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
else
{
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
onFullscreenChange
(
e
)
{
var
fsElement
=
document
.
fullscreenElement
||
document
.
mozFullScreenElement
||
document
.
webkitFullscreenElement
;
if
(
!
fsElement
)
{
vrMode
=
false
;
}
else
{
window
.
screen
.
orientation
.
lock
(
'
landscape
'
);
}
}
function
animate
()
{
if
(
vrMode
)
{
effect
.
render
(
scene
,
camera
);
}
else
{
renderer
.
setViewport
(
0
,
0
,
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
render
(
scene
,
camera
);
}
vrControls
.
update
();
requestAnimationFrame
(
animate
);
}
document
.
querySelector
(
'
#VrMode
'
).
addEventListener
(
'
click
'
,
function
()
{
vrMode
=
vrMode
?
false
:
true
;
requestFullscreen
();
onWindowResize
();
}
);
document
.
addEventListener
(
'
fullscreenchange
'
,
onFullscreenChange
);
document
.
addEventListener
(
'
mozfullscreenchange
'
,
onFullscreenChange
);
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
init
();
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录