Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
ed9412dc
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,体验更适合开发者的 AI 搜索 >>
提交
ed9412dc
编写于
6月 03, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added webgl_panorama_cube example.
上级
8ff7a4ba
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
147 addition
and
1 deletion
+147
-1
examples/files.js
examples/files.js
+1
-0
examples/textures/cube/sun_temple_stripe.jpg
examples/textures/cube/sun_temple_stripe.jpg
+0
-0
examples/webgl_panorama_cube.html
examples/webgl_panorama_cube.html
+146
-0
examples/webvr_panorama.html
examples/webvr_panorama.html
+0
-1
未找到文件。
examples/files.js
浏览文件 @
ed9412dc
...
...
@@ -173,6 +173,7 @@ var files = {
"
webgl_objects_update
"
,
"
webgl_octree
"
,
"
webgl_octree_raycasting
"
,
"
webgl_panorama_cube
"
,
"
webgl_panorama_dualfisheye
"
,
"
webgl_panorama_equirectangular
"
,
"
webgl_performance
"
,
...
...
examples/textures/cube/sun_temple_stripe.jpg
0 → 100644
浏览文件 @
ed9412dc
1.7 MB
examples/webgl_panorama_cube.html
0 → 100644
浏览文件 @
ed9412dc
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webvr - panorama
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0, user-scalable=no"
>
<style>
html
,
body
{
background-color
:
#000
;
margin
:
0px
;
padding
:
0px
;
overflow
:
hidden
;
}
#info
{
position
:
absolute
;
top
:
0px
;
width
:
100%
;
color
:
#ffffff
;
padding
:
5px
;
font-family
:
Monospace
;
font-size
:
13px
;
font-weight
:
bold
;
text-align
:
center
;
}
a
{
color
:
#ffffff
;
}
</style>
</head>
<body>
<div
id=
"container"
></div>
<div
id=
"info"
>
<a
href=
"http://threejs.org"
target=
"_blank"
>
three.js webgl
</a>
- cube panorama demo.
</div>
<script
src=
"../build/three.js"
></script>
<script
src=
"js/controls/OrbitControls.js"
></script>
<script>
var
camera
;
var
effect
,
controls
;
var
renderer
;
var
scene
;
init
();
animate
();
function
init
()
{
var
container
=
document
.
getElementById
(
'
container
'
);
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
scene
=
new
THREE
.
Scene
();
camera
=
new
THREE
.
PerspectiveCamera
(
90
,
window
.
innerWidth
/
window
.
innerHeight
,
0.1
,
100
);
camera
.
position
.
z
=
0.01
;
controls
=
new
THREE
.
OrbitControls
(
camera
);
controls
.
enableZoom
=
false
;
controls
.
enablePan
=
false
;
var
textures
=
getTexturesFromAtlasFile
(
"
textures/cube/sun_temple_stripe.jpg
"
,
6
);
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
(
1
,
1
,
1
),
new
THREE
.
MeshFaceMaterial
(
materials
)
);
skyBox
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeScale
(
1
,
1
,
-
1
)
);
scene
.
add
(
skyBox
);
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
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
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
function
animate
()
{
controls
.
update
();
// camera.rotation.y = - performance.now() / 10000;
renderer
.
render
(
scene
,
camera
);
requestAnimationFrame
(
animate
);
}
</script>
</body>
</html>
examples/webvr_panorama.html
浏览文件 @
ed9412dc
...
...
@@ -16,7 +16,6 @@
</head>
<body>
<script
src=
"../build/three.js"
></script>
<script
src=
"js/controls/OrbitControls.js"
></script>
<script
src=
"js/WebVR.js"
></script>
<script
src=
"js/controls/VRControls.js"
></script>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录