Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
86700091
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,发现更多精彩内容 >>
提交
86700091
编写于
7月 22, 2013
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MaterialLoader/MaterialExporter: Added blending and refactoring.
上级
9b3b209d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
15 addition
and
74 deletion
+15
-74
examples/js/exporters/MaterialExporter.js
examples/js/exporters/MaterialExporter.js
+5
-0
src/loaders/MaterialLoader.js
src/loaders/MaterialLoader.js
+10
-74
未找到文件。
examples/js/exporters/MaterialExporter.js
浏览文件 @
86700091
...
@@ -27,6 +27,7 @@ THREE.MaterialExporter.prototype = {
...
@@ -27,6 +27,7 @@ THREE.MaterialExporter.prototype = {
output
.
type
=
'
MeshBasicMaterial
'
;
output
.
type
=
'
MeshBasicMaterial
'
;
output
.
color
=
material
.
color
.
getHex
();
output
.
color
=
material
.
color
.
getHex
();
if
(
material
.
vertexColors
!==
THREE
.
NoColors
)
output
.
vertexColors
=
material
.
vertexColors
;
if
(
material
.
vertexColors
!==
THREE
.
NoColors
)
output
.
vertexColors
=
material
.
vertexColors
;
if
(
material
.
blending
!==
THREE
.
NormalBlending
)
output
.
blending
=
material
.
blending
;
output
.
opacity
=
material
.
opacity
;
output
.
opacity
=
material
.
opacity
;
output
.
transparent
=
material
.
transparent
;
output
.
transparent
=
material
.
transparent
;
output
.
wireframe
=
material
.
wireframe
;
output
.
wireframe
=
material
.
wireframe
;
...
@@ -38,6 +39,7 @@ THREE.MaterialExporter.prototype = {
...
@@ -38,6 +39,7 @@ THREE.MaterialExporter.prototype = {
output
.
ambient
=
material
.
ambient
.
getHex
();
output
.
ambient
=
material
.
ambient
.
getHex
();
output
.
emissive
=
material
.
emissive
.
getHex
();
output
.
emissive
=
material
.
emissive
.
getHex
();
if
(
material
.
vertexColors
!==
THREE
.
NoColors
)
output
.
vertexColors
=
material
.
vertexColors
;
if
(
material
.
vertexColors
!==
THREE
.
NoColors
)
output
.
vertexColors
=
material
.
vertexColors
;
if
(
material
.
blending
!==
THREE
.
NormalBlending
)
output
.
blending
=
material
.
blending
;
output
.
opacity
=
material
.
opacity
;
output
.
opacity
=
material
.
opacity
;
output
.
transparent
=
material
.
transparent
;
output
.
transparent
=
material
.
transparent
;
output
.
wireframe
=
material
.
wireframe
;
output
.
wireframe
=
material
.
wireframe
;
...
@@ -51,6 +53,7 @@ THREE.MaterialExporter.prototype = {
...
@@ -51,6 +53,7 @@ THREE.MaterialExporter.prototype = {
output
.
specular
=
material
.
specular
.
getHex
();
output
.
specular
=
material
.
specular
.
getHex
();
output
.
shininess
=
material
.
shininess
;
output
.
shininess
=
material
.
shininess
;
if
(
material
.
vertexColors
!==
THREE
.
NoColors
)
output
.
vertexColors
=
material
.
vertexColors
;
if
(
material
.
vertexColors
!==
THREE
.
NoColors
)
output
.
vertexColors
=
material
.
vertexColors
;
if
(
material
.
blending
!==
THREE
.
NormalBlending
)
output
.
blending
=
material
.
blending
;
output
.
opacity
=
material
.
opacity
;
output
.
opacity
=
material
.
opacity
;
output
.
transparent
=
material
.
transparent
;
output
.
transparent
=
material
.
transparent
;
output
.
wireframe
=
material
.
wireframe
;
output
.
wireframe
=
material
.
wireframe
;
...
@@ -58,6 +61,7 @@ THREE.MaterialExporter.prototype = {
...
@@ -58,6 +61,7 @@ THREE.MaterialExporter.prototype = {
}
else
if
(
material
instanceof
THREE
.
MeshNormalMaterial
)
{
}
else
if
(
material
instanceof
THREE
.
MeshNormalMaterial
)
{
output
.
type
=
'
MeshNormalMaterial
'
;
output
.
type
=
'
MeshNormalMaterial
'
;
if
(
material
.
blending
!==
THREE
.
NormalBlending
)
output
.
blending
=
material
.
blending
;
output
.
opacity
=
material
.
opacity
;
output
.
opacity
=
material
.
opacity
;
output
.
transparent
=
material
.
transparent
;
output
.
transparent
=
material
.
transparent
;
output
.
wireframe
=
material
.
wireframe
;
output
.
wireframe
=
material
.
wireframe
;
...
@@ -65,6 +69,7 @@ THREE.MaterialExporter.prototype = {
...
@@ -65,6 +69,7 @@ THREE.MaterialExporter.prototype = {
}
else
if
(
material
instanceof
THREE
.
MeshDepthMaterial
)
{
}
else
if
(
material
instanceof
THREE
.
MeshDepthMaterial
)
{
output
.
type
=
'
MeshDepthMaterial
'
;
output
.
type
=
'
MeshDepthMaterial
'
;
if
(
material
.
blending
!==
THREE
.
NormalBlending
)
output
.
blending
=
material
.
blending
;
output
.
opacity
=
material
.
opacity
;
output
.
opacity
=
material
.
opacity
;
output
.
transparent
=
material
.
transparent
;
output
.
transparent
=
material
.
transparent
;
output
.
wireframe
=
material
.
wireframe
;
output
.
wireframe
=
material
.
wireframe
;
...
...
src/loaders/MaterialLoader.js
浏览文件 @
86700091
...
@@ -34,82 +34,18 @@ THREE.MaterialLoader.prototype = {
...
@@ -34,82 +34,18 @@ THREE.MaterialLoader.prototype = {
parse
:
function
(
json
)
{
parse
:
function
(
json
)
{
var
material
;
var
material
=
new
THREE
[
json
.
type
];
switch
(
json
.
type
)
{
case
'
MeshBasicMaterial
'
:
material
=
new
THREE
.
MeshBasicMaterial
(
{
color
:
json
.
color
,
opacity
:
json
.
opacity
,
transparent
:
json
.
transparent
,
wireframe
:
json
.
wireframe
}
);
break
;
case
'
MeshLambertMaterial
'
:
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
json
.
color
,
ambient
:
json
.
ambient
,
emissive
:
json
.
emissive
,
opacity
:
json
.
opacity
,
transparent
:
json
.
transparent
,
wireframe
:
json
.
wireframe
}
);
break
;
case
'
MeshPhongMaterial
'
:
material
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
json
.
color
,
ambient
:
json
.
ambient
,
emissive
:
json
.
emissive
,
specular
:
json
.
specular
,
shininess
:
json
.
shininess
,
opacity
:
json
.
opacity
,
transparent
:
json
.
transparent
,
wireframe
:
json
.
wireframe
}
);
break
;
case
'
MeshNormalMaterial
'
:
material
=
new
THREE
.
MeshNormalMaterial
(
{
opacity
:
json
.
opacity
,
transparent
:
json
.
transparent
,
wireframe
:
json
.
wireframe
}
);
break
;
case
'
MeshDepthMaterial
'
:
material
=
new
THREE
.
MeshDepthMaterial
(
{
opacity
:
json
.
opacity
,
transparent
:
json
.
transparent
,
wireframe
:
json
.
wireframe
}
);
break
;
}
if
(
json
.
color
!==
undefined
)
material
.
color
.
setHex
(
json
.
color
);
if
(
json
.
ambient
!==
undefined
)
material
.
ambient
.
setHex
(
json
.
ambient
);
if
(
json
.
emissive
!==
undefined
)
material
.
emissive
.
setHex
(
json
.
emissive
);
if
(
json
.
specular
!==
undefined
)
material
.
specular
.
setHex
(
json
.
specular
);
if
(
json
.
shininess
!==
undefined
)
material
.
shininess
=
json
.
shininess
;
if
(
json
.
vertexColors
!==
undefined
)
material
.
vertexColors
=
json
.
vertexColors
;
if
(
json
.
vertexColors
!==
undefined
)
material
.
vertexColors
=
json
.
vertexColors
;
if
(
json
.
blending
!==
undefined
)
material
.
blending
=
json
.
blending
;
if
(
json
.
opacity
!==
undefined
)
material
.
opacity
=
json
.
opacity
;
if
(
json
.
transparent
!==
undefined
)
material
.
transparent
=
json
.
transparent
;
if
(
json
.
wireframe
!==
undefined
)
material
.
wireframe
=
json
.
wireframe
;
return
material
;
return
material
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录