Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
b80a91ac
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,发现更多精彩内容 >>
提交
b80a91ac
编写于
2月 13, 2020
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Examples: Added FlakeTexture generator.
上级
e0e541ba
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
4 deletion
+50
-4
examples/jsm/textures/FlakeTexture.js
examples/jsm/textures/FlakeTexture.js
+44
-0
examples/textures/flakes.png
examples/textures/flakes.png
+0
-0
examples/webgl_materials_physical_clearcoat.html
examples/webgl_materials_physical_clearcoat.html
+6
-4
未找到文件。
examples/jsm/textures/FlakeTexture.js
0 → 100644
浏览文件 @
b80a91ac
/**
* @author mr.doob / http://mrdoob.com/
*/
class
FlakeTexture
{
constructor
(
width
=
512
,
height
=
512
)
{
var
canvas
=
document
.
createElement
(
'
canvas
'
);
canvas
.
width
=
width
;
canvas
.
height
=
height
;
var
context
=
canvas
.
getContext
(
'
2d
'
);
context
.
fillStyle
=
'
rgb(127,127,255)
'
;
context
.
fillRect
(
0
,
0
,
width
,
height
);
for
(
var
i
=
0
;
i
<
4000
;
i
++
)
{
var
x
=
Math
.
random
()
*
width
;
var
y
=
Math
.
random
()
*
height
;
var
r
=
Math
.
random
()
*
3
+
3
;
var
nx
=
Math
.
random
()
*
2
-
1
;
var
ny
=
Math
.
random
()
*
2
-
1
;
var
nz
=
1.5
;
var
l
=
Math
.
sqrt
(
nx
*
nx
+
ny
*
ny
+
nz
*
nz
);
nx
/=
l
;
ny
/=
l
;
nz
/=
l
;
context
.
fillStyle
=
'
rgb(
'
+
(
nx
*
127
+
127
)
+
'
,
'
+
(
ny
*
127
+
127
)
+
'
,
'
+
(
nz
*
255
)
+
'
)
'
;
context
.
beginPath
();
context
.
arc
(
x
,
y
,
r
,
0
,
Math
.
PI
*
2
);
context
.
fill
();
}
return
canvas
;
}
}
export
{
FlakeTexture
};
examples/textures/flakes.png
已删除
100644 → 0
浏览文件 @
e0e541ba
999.0 KB
examples/webgl_materials_physical_clearcoat.html
浏览文件 @
b80a91ac
...
...
@@ -20,6 +20,8 @@
import
{
OrbitControls
}
from
'
./jsm/controls/OrbitControls.js
'
;
import
{
HDRCubeTextureLoader
}
from
'
./jsm/loaders/HDRCubeTextureLoader.js
'
;
import
{
FlakeTexture
}
from
'
./jsm/textures/FlakeTexture.js
'
;
var
container
,
stats
;
var
camera
,
scene
,
renderer
;
...
...
@@ -70,11 +72,11 @@
var
normalMap2
=
textureLoader
.
load
(
"
textures/water/Water_1_M_Normal.jpg
"
);
var
normalMap3
=
textureLoader
.
load
(
"
textures/flakes.png
"
);
var
normalMap3
=
new
THREE
.
CanvasTexture
(
new
FlakeTexture
()
);
normalMap3
.
wrapS
=
THREE
.
RepeatWrapping
;
normalMap3
.
wrapT
=
THREE
.
RepeatWrapping
;
normalMap3
.
repeat
.
x
=
10
;
normalMap3
.
repeat
.
y
=
10
;
normalMap3
.
repeat
.
y
=
6
;
normalMap3
.
anisotropy
=
16
;
var
normalMap4
=
textureLoader
.
load
(
"
textures/golfball.jpg
"
);
...
...
@@ -122,7 +124,7 @@
clearcoatNormalMap
:
clearcoatNormaMap
,
// y scale is negated to compensate for normal map handedness.
clearcoatNormalScale
:
new
THREE
.
Vector2
(
2.0
,
-
2.0
)
clearcoatNormalScale
:
new
THREE
.
Vector2
(
2.0
,
-
2.0
)
}
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
position
.
x
=
-
100
;
...
...
@@ -140,7 +142,7 @@
clearcoatNormalMap
:
clearcoatNormaMap
,
// y scale is negated to compensate for normal map handedness.
clearcoatNormalScale
:
new
THREE
.
Vector2
(
2.0
,
-
2.0
)
clearcoatNormalScale
:
new
THREE
.
Vector2
(
2.0
,
-
2.0
)
}
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
position
.
x
=
100
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录