Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
7c06ac87
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,发现更多精彩内容 >>
提交
7c06ac87
编写于
10月 28, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed webgl_materials2 example.
上级
bccaa60f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
0 addition
and
193 deletion
+0
-193
examples/index.html
examples/index.html
+0
-1
examples/webgl_materials2.html
examples/webgl_materials2.html
+0
-192
未找到文件。
examples/index.html
浏览文件 @
7c06ac87
...
...
@@ -286,7 +286,6 @@
"
webgl_lod
"
,
"
webgl_marchingcubes
"
,
"
webgl_materials
"
,
"
webgl_materials2
"
,
"
webgl_materials_blending
"
,
"
webgl_materials_blending_custom
"
,
"
webgl_materials_bumpmap
"
,
...
...
examples/webgl_materials2.html
已删除
100644 → 0
浏览文件 @
bccaa60f
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - materials
</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
{
font-family
:
Monospace
;
background-color
:
#000
;
margin
:
0px
;
overflow
:
hidden
;
}
</style>
</head>
<body>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/Detector.js"
></script>
<script
src=
"js/libs/stats.min.js"
></script>
<script>
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
var
container
,
stats
;
var
camera
,
scene
,
renderer
,
objects
;
var
particleLight
;
init
();
animate
();
function
init
()
{
container
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
container
);
camera
=
new
THREE
.
PerspectiveCamera
(
40
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2000
);
camera
.
position
.
set
(
0
,
200
,
0
);
scene
=
new
THREE
.
Scene
();
// Materials
var
imgTexture2
=
THREE
.
ImageUtils
.
loadTexture
(
"
textures/planets/moon_1024.jpg
"
);
imgTexture2
.
wrapS
=
imgTexture2
.
wrapT
=
THREE
.
RepeatWrapping
;
imgTexture2
.
anisotropy
=
16
;
var
imgTexture
=
THREE
.
ImageUtils
.
loadTexture
(
"
textures/lava/lavatile.jpg
"
);
imgTexture
.
repeat
.
set
(
4
,
2
);
imgTexture
.
wrapS
=
imgTexture
.
wrapT
=
THREE
.
RepeatWrapping
;
imgTexture
.
anisotropy
=
16
;
var
shininess
=
50
,
specular
=
0x333333
,
bumpScale
=
1
,
shading
=
THREE
.
SmoothShading
;
var
materials
=
[];
materials
.
push
(
new
THREE
.
MeshPhongMaterial
(
{
map
:
imgTexture
,
bumpMap
:
imgTexture
,
bumpScale
:
bumpScale
,
color
:
0xffffff
,
specular
:
specular
,
shininess
:
shininess
,
shading
:
shading
}
)
);
materials
.
push
(
new
THREE
.
MeshPhongMaterial
(
{
map
:
imgTexture
,
bumpMap
:
imgTexture
,
bumpScale
:
bumpScale
,
color
:
0x00ff00
,
specular
:
specular
,
shininess
:
shininess
,
shading
:
shading
}
)
);
materials
.
push
(
new
THREE
.
MeshPhongMaterial
(
{
map
:
imgTexture
,
bumpMap
:
imgTexture
,
bumpScale
:
bumpScale
,
color
:
0x00ff00
,
specular
:
specular
,
shininess
:
shininess
,
shading
:
shading
}
)
);
materials
.
push
(
new
THREE
.
MeshPhongMaterial
(
{
map
:
imgTexture
,
bumpMap
:
imgTexture
,
bumpScale
:
bumpScale
,
color
:
0x000000
,
specular
:
specular
,
shininess
:
shininess
,
shading
:
shading
}
)
);
materials
.
push
(
new
THREE
.
MeshLambertMaterial
(
{
map
:
imgTexture
,
color
:
0xffffff
,
shading
:
shading
}
)
);
materials
.
push
(
new
THREE
.
MeshLambertMaterial
(
{
map
:
imgTexture
,
color
:
0xff0000
,
shading
:
shading
}
)
);
materials
.
push
(
new
THREE
.
MeshLambertMaterial
(
{
map
:
imgTexture
,
color
:
0xff0000
,
shading
:
shading
}
)
);
materials
.
push
(
new
THREE
.
MeshLambertMaterial
(
{
map
:
imgTexture
,
color
:
0x000000
,
shading
:
shading
}
)
);
shininess
=
15
;
materials
.
push
(
new
THREE
.
MeshPhongMaterial
(
{
map
:
imgTexture2
,
bumpMap
:
imgTexture2
,
bumpScale
:
bumpScale
,
color
:
0x000000
,
specular
:
0xffaa00
,
shininess
:
shininess
,
metal
:
true
,
shading
:
shading
}
)
);
materials
.
push
(
new
THREE
.
MeshPhongMaterial
(
{
map
:
imgTexture2
,
bumpMap
:
imgTexture2
,
bumpScale
:
bumpScale
,
color
:
0x000000
,
specular
:
0xaaff00
,
shininess
:
shininess
,
metal
:
true
,
shading
:
shading
}
)
);
materials
.
push
(
new
THREE
.
MeshPhongMaterial
(
{
map
:
imgTexture2
,
bumpMap
:
imgTexture2
,
bumpScale
:
bumpScale
,
color
:
0x000000
,
specular
:
0x00ffaa
,
shininess
:
shininess
,
metal
:
true
,
shading
:
shading
}
)
);
materials
.
push
(
new
THREE
.
MeshPhongMaterial
(
{
map
:
imgTexture2
,
bumpMap
:
imgTexture2
,
bumpScale
:
bumpScale
,
color
:
0x000000
,
specular
:
0x00aaff
,
shininess
:
shininess
,
metal
:
true
,
shading
:
shading
}
)
);
// Spheres geometry
var
geometry_smooth
=
new
THREE
.
SphereBufferGeometry
(
70
,
32
,
16
);
var
geometry_flat
=
new
THREE
.
SphereBufferGeometry
(
70
,
32
,
16
);
objects
=
[];
var
sphere
,
geometry
,
material
;
for
(
var
i
=
0
,
l
=
materials
.
length
;
i
<
l
;
i
++
)
{
material
=
materials
[
i
];
geometry
=
material
.
shading
==
THREE
.
FlatShading
?
geometry_flat
:
geometry_smooth
;
sphere
=
new
THREE
.
Mesh
(
geometry
,
material
);
sphere
.
position
.
x
=
(
i
%
4
)
*
200
-
200
;
sphere
.
position
.
z
=
Math
.
floor
(
i
/
4
)
*
200
-
200
;
objects
.
push
(
sphere
);
scene
.
add
(
sphere
);
}
particleLight
=
new
THREE
.
Mesh
(
new
THREE
.
SphereBufferGeometry
(
4
,
8
,
8
),
new
THREE
.
MeshBasicMaterial
(
{
color
:
0xffffff
}
)
);
scene
.
add
(
particleLight
);
// Lights
scene
.
add
(
new
THREE
.
AmbientLight
(
0x444444
)
);
var
directionalLight
=
new
THREE
.
DirectionalLight
(
0xffffff
,
1
);
directionalLight
.
position
.
set
(
1
,
1
,
1
).
normalize
();
scene
.
add
(
directionalLight
);
var
pointLight
=
new
THREE
.
PointLight
(
0xffffff
,
2
,
800
);
particleLight
.
add
(
pointLight
);
//
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setClearColor
(
0x0a0a0a
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
sortObjects
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
stats
=
new
Stats
();
stats
.
domElement
.
style
.
position
=
'
absolute
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
container
.
appendChild
(
stats
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
//
function
animate
()
{
requestAnimationFrame
(
animate
);
render
();
stats
.
update
();
}
function
render
()
{
var
timer
=
Date
.
now
()
*
0.00025
;
camera
.
position
.
x
=
Math
.
cos
(
timer
)
*
800
;
camera
.
position
.
z
=
Math
.
sin
(
timer
)
*
800
;
camera
.
lookAt
(
scene
.
position
);
for
(
var
i
=
0
,
l
=
objects
.
length
;
i
<
l
;
i
++
)
{
var
object
=
objects
[
i
];
object
.
rotation
.
y
+=
0.005
;
}
particleLight
.
position
.
x
=
Math
.
sin
(
timer
*
7
)
*
300
;
particleLight
.
position
.
y
=
Math
.
cos
(
timer
*
5
)
*
400
;
particleLight
.
position
.
z
=
Math
.
cos
(
timer
*
3
)
*
300
;
renderer
.
render
(
scene
,
camera
);
}
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录