Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
e1f4bb88
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,发现更多精彩内容 >>
提交
e1f4bb88
编写于
6月 06, 2014
作者:
D
drakh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added digital glitch example
上级
c7ffc512
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
143 addition
and
0 deletion
+143
-0
examples/index.html
examples/index.html
+1
-0
examples/webgl_postprocessing_glitch.html
examples/webgl_postprocessing_glitch.html
+142
-0
未找到文件。
examples/index.html
浏览文件 @
e1f4bb88
...
...
@@ -241,6 +241,7 @@
"
webgl_postprocessing_dof2
"
,
"
webgl_postprocessing_godrays
"
,
"
webgl_postprocessing_crossfade
"
,
"
webgl_postprocessing_glitch
"
,
"
webgl_rtt
"
,
"
webgl_sandbox
"
,
"
webgl_shader
"
,
...
...
examples/webgl_postprocessing_glitch.html
0 → 100644
浏览文件 @
e1f4bb88
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - postprocessing - digital glitch
</title>
<meta
charset=
"utf-8"
>
<style>
body
{
margin
:
0px
;
background-color
:
#000000
;
overflow
:
hidden
;
}
div
{
position
:
absolute
;
z-index
:
10
;
color
:
#fff
;
font-family
:
monospace
;
text-align
:
center
;
margin
:
10px
;
width
:
100%
;
}
label
,
input
{
cursor
:
pointer
;
}
</style>
</head>
<body>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/shaders/CopyShader.js"
></script>
<script
src=
"js/shaders/DigitalGlitch.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
<script
src=
"js/postprocessing/MaskPass.js"
></script>
<script
src=
"js/postprocessing/ShaderPass.js"
></script>
<script
src=
"js/postprocessing/GlitchPass.js"
></script>
<div>
<label
for=
"dotScreen"
>
Glitch me wild:
</label><input
id=
"wildGlitch"
type=
"checkbox"
onchange=
"updateOptions()"
/><br
/>
</div>
<script>
var
camera
,
scene
,
renderer
,
composer
;
var
object
,
light
;
var
glitchPass
;
init
();
animate
();
function
updateOptions
()
{
var
wildGlitch
=
document
.
getElementById
(
'
wildGlitch
'
);
glitchPass
.
goWild
=
wildGlitch
.
checked
;
}
function
init
()
{
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
document
.
body
.
appendChild
(
renderer
.
domElement
);
//
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
1000
);
camera
.
position
.
z
=
400
;
scene
=
new
THREE
.
Scene
();
scene
.
fog
=
new
THREE
.
Fog
(
0x000000
,
1
,
1000
);
object
=
new
THREE
.
Object3D
();
scene
.
add
(
object
);
var
geometry
=
new
THREE
.
SphereGeometry
(
1
,
4
,
4
);
var
material
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0xffffff
,
shading
:
THREE
.
FlatShading
}
);
for
(
var
i
=
0
;
i
<
100
;
i
++
)
{
material
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0xffffff
*
Math
.
random
(),
shading
:
THREE
.
FlatShading
}
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
position
.
set
(
Math
.
random
()
-
0.5
,
Math
.
random
()
-
0.5
,
Math
.
random
()
-
0.5
).
normalize
();
mesh
.
position
.
multiplyScalar
(
Math
.
random
()
*
400
);
mesh
.
rotation
.
set
(
Math
.
random
()
*
2
,
Math
.
random
()
*
2
,
Math
.
random
()
*
2
);
mesh
.
scale
.
x
=
mesh
.
scale
.
y
=
mesh
.
scale
.
z
=
Math
.
random
()
*
50
;
object
.
add
(
mesh
);
}
scene
.
add
(
new
THREE
.
AmbientLight
(
0x222222
)
);
light
=
new
THREE
.
DirectionalLight
(
0xffffff
);
light
.
position
.
set
(
1
,
1
,
1
);
scene
.
add
(
light
);
// postprocessing
composer
=
new
THREE
.
EffectComposer
(
renderer
);
composer
.
addPass
(
new
THREE
.
RenderPass
(
scene
,
camera
)
);
glitchPass
=
new
THREE
.
GlitchPass
();
glitchPass
.
renderToScreen
=
true
;
composer
.
addPass
(
glitchPass
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
updateOptions
();
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
function
animate
()
{
requestAnimationFrame
(
animate
);
var
time
=
Date
.
now
();
object
.
rotation
.
x
+=
0.005
;
object
.
rotation
.
y
+=
0.01
;
composer
.
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录