Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
04308451
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,发现更多精彩内容 >>
提交
04308451
编写于
3月 01, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added webgl_panorama_dualfisheye (Ricoh Theta S) example.
上级
ce318534
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
218 addition
and
0 deletion
+218
-0
examples/files.js
examples/files.js
+1
-0
examples/textures/ricoh_theta_s.jpg
examples/textures/ricoh_theta_s.jpg
+0
-0
examples/webgl_panorama_dualfisheye.html
examples/webgl_panorama_dualfisheye.html
+217
-0
未找到文件。
examples/files.js
浏览文件 @
04308451
...
@@ -160,6 +160,7 @@ var files = {
...
@@ -160,6 +160,7 @@ var files = {
"
webgl_objects_update
"
,
"
webgl_objects_update
"
,
"
webgl_octree
"
,
"
webgl_octree
"
,
"
webgl_octree_raycasting
"
,
"
webgl_octree_raycasting
"
,
"
webgl_panorama_dualfisheye
"
,
"
webgl_panorama_equirectangular
"
,
"
webgl_panorama_equirectangular
"
,
"
webgl_particles_general
"
,
"
webgl_particles_general
"
,
"
webgl_performance
"
,
"
webgl_performance
"
,
...
...
examples/textures/ricoh_theta_s.jpg
0 → 100644
浏览文件 @
04308451
373.5 KB
examples/webgl_panorama_dualfisheye.html
0 → 100644
浏览文件 @
04308451
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - dual fisheye panorama
</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
{
background-color
:
#000000
;
margin
:
0px
;
overflow
:
hidden
;
}
#info
{
position
:
absolute
;
top
:
0px
;
width
:
100%
;
color
:
#000000
;
padding
:
5px
;
font-family
:
Monospace
;
font-size
:
13px
;
font-weight
:
bold
;
text-align
:
center
;
}
a
{
color
:
#0000ff
;
}
</style>
</head>
<body>
<div
id=
"container"
></div>
<div
id=
"info"
>
<a
href=
"http://threejs.org"
target=
"_blank"
>
three.js webgl
</a>
- dualfisheye panorama.
</div>
<script
src=
"../build/three.min.js"
></script>
<script>
var
camera
,
scene
,
renderer
;
var
isUserInteracting
=
false
,
onMouseDownMouseX
=
0
,
onMouseDownMouseY
=
0
,
lon
=
0
,
onMouseDownLon
=
0
,
lat
=
0
,
onMouseDownLat
=
0
,
phi
=
0
,
theta
=
0
,
distance
=
500
;
init
();
animate
();
function
init
()
{
var
container
,
mesh
;
container
=
document
.
getElementById
(
'
container
'
);
camera
=
new
THREE
.
PerspectiveCamera
(
75
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2000
);
scene
=
new
THREE
.
Scene
();
var
geometry
=
new
THREE
.
SphereBufferGeometry
(
500
,
60
,
40
).
toNonIndexed
();
geometry
.
scale
(
-
1
,
1
,
1
);
// Remap UVs
var
normals
=
geometry
.
attributes
.
normal
.
array
;
var
uvs
=
geometry
.
attributes
.
uv
.
array
;
for
(
var
i
=
0
,
l
=
normals
.
length
/
3
;
i
<
l
;
i
++
)
{
var
x
=
normals
[
i
*
3
+
0
];
var
y
=
normals
[
i
*
3
+
1
];
var
z
=
normals
[
i
*
3
+
2
];
if
(
i
<
l
/
2
)
{
var
correction
=
(
x
==
0
&&
z
==
0
)
?
1
:
(
Math
.
acos
(
y
)
/
Math
.
sqrt
(
x
*
x
+
z
*
z
)
)
*
(
2
/
Math
.
PI
);
uvs
[
i
*
2
+
0
]
=
x
*
(
404
/
1920
)
*
correction
+
(
447
/
1920
);
uvs
[
i
*
2
+
1
]
=
z
*
(
404
/
1080
)
*
correction
+
(
582
/
1080
);
}
else
{
var
correction
=
(
x
==
0
&&
z
==
0
)
?
1
:
(
Math
.
acos
(
-
y
)
/
Math
.
sqrt
(
x
*
x
+
z
*
z
)
)
*
(
2
/
Math
.
PI
);
uvs
[
i
*
2
+
0
]
=
-
x
*
(
404
/
1920
)
*
correction
+
(
1460
/
1920
);
uvs
[
i
*
2
+
1
]
=
z
*
(
404
/
1080
)
*
correction
+
(
582
/
1080
);
}
}
geometry
.
rotateZ
(
-
Math
.
PI
/
2
);
//
var
texture
=
new
THREE
.
TextureLoader
().
load
(
'
textures/ricoh_theta_s.jpg
'
);
texture
.
format
=
THREE
.
RGBFormat
;
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
map
:
texture
}
);
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
scene
.
add
(
mesh
);
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
document
.
addEventListener
(
'
mousedown
'
,
onDocumentMouseDown
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mouseup
'
,
onDocumentMouseUp
,
false
);
document
.
addEventListener
(
'
mousewheel
'
,
onDocumentMouseWheel
,
false
);
document
.
addEventListener
(
'
MozMousePixelScroll
'
,
onDocumentMouseWheel
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
function
onDocumentMouseDown
(
event
)
{
event
.
preventDefault
();
isUserInteracting
=
true
;
onPointerDownPointerX
=
event
.
clientX
;
onPointerDownPointerY
=
event
.
clientY
;
onPointerDownLon
=
lon
;
onPointerDownLat
=
lat
;
}
function
onDocumentMouseMove
(
event
)
{
if
(
isUserInteracting
===
true
)
{
lon
=
(
onPointerDownPointerX
-
event
.
clientX
)
*
0.1
+
onPointerDownLon
;
lat
=
(
onPointerDownPointerY
-
event
.
clientY
)
*
0.1
+
onPointerDownLat
;
}
}
function
onDocumentMouseUp
(
event
)
{
isUserInteracting
=
false
;
}
function
onDocumentMouseWheel
(
event
)
{
// WebKit
if
(
event
.
wheelDeltaY
)
{
distance
-=
event
.
wheelDeltaY
*
0.05
;
// Opera / Explorer 9
}
else
if
(
event
.
wheelDelta
)
{
distance
-=
event
.
wheelDelta
*
0.05
;
// Firefox
}
else
if
(
event
.
detail
)
{
distance
+=
event
.
detail
*
1.0
;
}
}
function
animate
()
{
requestAnimationFrame
(
animate
);
update
();
}
function
update
()
{
if
(
isUserInteracting
===
false
)
{
lon
+=
0.1
;
}
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
lat
)
);
phi
=
THREE
.
Math
.
degToRad
(
90
-
lat
);
theta
=
THREE
.
Math
.
degToRad
(
lon
-
180
);
camera
.
position
.
x
=
distance
*
Math
.
sin
(
phi
)
*
Math
.
cos
(
theta
);
camera
.
position
.
y
=
distance
*
Math
.
cos
(
phi
);
camera
.
position
.
z
=
distance
*
Math
.
sin
(
phi
)
*
Math
.
sin
(
theta
);
camera
.
lookAt
(
scene
.
position
);
renderer
.
render
(
scene
,
camera
);
}
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录