Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
4aa9e46f
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,发现更多精彩内容 >>
提交
4aa9e46f
编写于
6月 14, 2017
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleaned up ImageBitmapLoader example.
上级
ceb88071
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
32 deletion
+28
-32
examples/webgl_loader_imagebitmap.html
examples/webgl_loader_imagebitmap.html
+28
-32
未找到文件。
examples/webgl_loader_imagebitmap.html
浏览文件 @
4aa9e46f
...
...
@@ -59,9 +59,9 @@
<div
id=
"info"
>
<a
href=
"http://threejs.org"
target=
"_blank"
rel=
"noopener"
>
three.js
</a>
- Texture loader using ImageBitmap
<div
class=
"actions"
>
<span
id=
"add_ib_btn"
>
Press to a
dd ImageBitmap
</span>
<span
id=
"add_i_btn"
>
Press to a
dd Image
</span>
<span
id=
"clear_btn"
>
Clear
</span>
<span
id=
"add_ib_btn"
>
A
dd ImageBitmap
</span>
<span
id=
"add_i_btn"
>
A
dd Image
</span>
<span
id=
"clear_btn"
>
Clear
</span>
</div>
</div>
...
...
@@ -77,53 +77,49 @@
var
camera
,
scene
,
renderer
;
var
group
,
cubes
;
var
autoAddImageBitmap
=
false
;
var
autoAddImage
=
false
;
init
();
animate
();
function
addImageBitmap
()
{
new
THREE
.
ImageBitmapLoader
()
.
setOptions
(
{
imageOrientation
:
'
none
'
}
)
.
load
(
'
textures/planets/earth_atmos_2048.jpg
'
,
function
(
imageBitmap
)
{
.
setOptions
(
{
imageOrientation
:
'
none
'
}
)
.
load
(
'
textures/planets/earth_atmos_2048.jpg
'
,
function
(
imageBitmap
)
{
var
tex
=
new
THREE
.
Texture
(
imageBitmap
);
tex
.
needsUpdate
=
true
;
var
tex
=
new
THREE
.
CanvasTexture
(
imageBitmap
);
/* ImageBitmap should be disposed when done with it
Can't be done until it's actually uploaded to WebGLTexture */
/* ImageBitmap should be disposed when done with it
Can't be done until it's actually uploaded to WebGLTexture */
// imageBitmap.close();
// imageBitmap.close();
addCube
(
tex
);
addCube
(
tex
);
},
function
(
p
)
{
console
.
log
(
p
);
},
function
(
e
)
{
console
.
log
(
e
);
}
);
},
function
(
p
)
{
console
.
log
(
p
);
},
function
(
e
)
{
console
.
log
(
e
);
}
);
}
function
addImage
()
{
new
THREE
.
TextureLoader
().
load
(
'
textures/planets/earth_atmos_2048.jpg?
'
+
performance
.
now
(),
function
(
tex
)
{
addCube
(
tex
);
new
THREE
.
ImageLoader
()
.
load
(
'
textures/planets/earth_atmos_2048.jpg?
'
+
performance
.
now
(),
function
(
image
)
{
var
tex
=
new
THREE
.
CanvasTexture
(
image
);
addCube
(
tex
);
});
}
function
addCube
(
texture
)
{
var
geometry
=
new
THREE
.
BoxBufferGeometry
(
1
,
1
,
1
);
function
addCube
(
texture
)
{
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
map
:
texture
}
);
var
cube
=
new
THREE
.
Mesh
(
new
THREE
.
BoxBufferGeometry
(
1
,
1
,
1
),
new
THREE
.
MeshBasicMaterial
(
{
map
:
texture
})
);
var
cube
=
new
THREE
.
Mesh
(
geometry
,
material
);
cube
.
position
.
set
(
Math
.
random
()
*
2
-
1
,
Math
.
random
()
*
2
-
1
,
Math
.
random
()
*
2
-
1
);
cube
.
rotation
.
set
(
Math
.
random
()
*
2
*
Math
.
PI
,
Math
.
random
()
*
2
*
Math
.
PI
,
Math
.
random
()
*
2
*
Math
.
PI
);
cubes
.
add
(
cube
);
...
...
@@ -199,12 +195,12 @@
function
animate
()
{
requestAnimationFrame
(
animate
);
group
.
rotation
.
y
=
performance
.
now
()
/
2000
;
group
.
rotation
.
y
=
performance
.
now
()
/
3000
;
renderer
.
render
(
scene
,
camera
);
requestAnimationFrame
(
animate
);
}
</script>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录