Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
65fc6489
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
65fc6489
编写于
5月 10, 2021
作者:
M
Michael Herzog
提交者:
GitHub
5月 10, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Material: Convert to class syntax. (#21804)
上级
b13eccc8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
65 addition
and
69 deletion
+65
-69
src/materials/Material.js
src/materials/Material.js
+65
-69
未找到文件。
src/materials/Material.js
浏览文件 @
65fc6489
...
...
@@ -4,91 +4,89 @@ import * as MathUtils from '../math/MathUtils.js';
let
materialId
=
0
;
function
Material
()
{
class
Material
extends
EventDispatcher
{
Object
.
defineProperty
(
this
,
'
id
'
,
{
value
:
materialId
++
}
);
constructor
()
{
this
.
uuid
=
MathUtils
.
generateUUID
();
super
();
this
.
name
=
''
;
this
.
type
=
'
Material
'
;
Object
.
defineProperty
(
this
,
'
id
'
,
{
value
:
materialId
++
}
);
this
.
fog
=
true
;
this
.
uuid
=
MathUtils
.
generateUUID
()
;
this
.
blending
=
NormalBlending
;
this
.
side
=
FrontSide
;
this
.
vertexColors
=
false
;
this
.
name
=
''
;
this
.
type
=
'
Material
'
;
this
.
opacity
=
1
;
this
.
transparent
=
false
;
this
.
fog
=
true
;
this
.
blendSrc
=
SrcAlphaFactor
;
this
.
blendDst
=
OneMinusSrcAlphaFactor
;
this
.
blendEquation
=
AddEquation
;
this
.
blendSrcAlpha
=
null
;
this
.
blendDstAlpha
=
null
;
this
.
blendEquationAlpha
=
null
;
this
.
blending
=
NormalBlending
;
this
.
side
=
FrontSide
;
this
.
vertexColors
=
false
;
this
.
depthFunc
=
LessEqualDepth
;
this
.
depthTest
=
true
;
this
.
depthWrite
=
true
;
this
.
opacity
=
1
;
this
.
transparent
=
false
;
this
.
stencilWriteMask
=
0xff
;
this
.
stencilFunc
=
AlwaysStencilFunc
;
this
.
stencilRef
=
0
;
this
.
stencilFuncMask
=
0xff
;
this
.
stencilFail
=
KeepStencilOp
;
this
.
stencilZFail
=
KeepStencilOp
;
this
.
stencilZPass
=
KeepStencilOp
;
this
.
stencilWrite
=
false
;
this
.
blendSrc
=
SrcAlphaFactor
;
this
.
blendDst
=
OneMinusSrcAlphaFactor
;
this
.
blendEquation
=
AddEquation
;
this
.
blendSrcAlpha
=
null
;
this
.
blendDstAlpha
=
null
;
this
.
blendEquationAlpha
=
null
;
this
.
clippingPlanes
=
null
;
this
.
clipIntersection
=
fals
e
;
this
.
clipShadows
=
fals
e
;
this
.
depthFunc
=
LessEqualDepth
;
this
.
depthTest
=
tru
e
;
this
.
depthWrite
=
tru
e
;
this
.
shadowSide
=
null
;
this
.
stencilWriteMask
=
0xff
;
this
.
stencilFunc
=
AlwaysStencilFunc
;
this
.
stencilRef
=
0
;
this
.
stencilFuncMask
=
0xff
;
this
.
stencilFail
=
KeepStencilOp
;
this
.
stencilZFail
=
KeepStencilOp
;
this
.
stencilZPass
=
KeepStencilOp
;
this
.
stencilWrite
=
false
;
this
.
colorWrite
=
true
;
this
.
clippingPlanes
=
null
;
this
.
clipIntersection
=
false
;
this
.
clipShadows
=
false
;
this
.
precision
=
null
;
// override the renderer's default precision for this material
this
.
shadowSide
=
null
;
this
.
polygonOffset
=
false
;
this
.
polygonOffsetFactor
=
0
;
this
.
polygonOffsetUnits
=
0
;
this
.
colorWrite
=
true
;
this
.
dithering
=
false
;
this
.
precision
=
null
;
// override the renderer's default precision for this material
this
.
alphaTest
=
0
;
this
.
alphaToCoverage
=
false
;
this
.
premultipliedAlpha
=
false
;
this
.
polygonOffset
=
false
;
this
.
polygonOffsetFactor
=
0
;
this
.
polygonOffsetUnits
=
0
;
this
.
visible
=
tru
e
;
this
.
dithering
=
fals
e
;
this
.
toneMapped
=
true
;
this
.
alphaTest
=
0
;
this
.
alphaToCoverage
=
false
;
this
.
premultipliedAlpha
=
false
;
this
.
userData
=
{}
;
this
.
visible
=
true
;
this
.
version
=
0
;
this
.
toneMapped
=
true
;
}
Material
.
prototype
=
Object
.
assign
(
Object
.
create
(
EventDispatcher
.
prototype
),
{
this
.
userData
=
{};
constructor
:
Material
,
this
.
version
=
0
;
isMaterial
:
true
,
}
onBuild
:
function
(
/* shaderobject, renderer */
)
{},
onBuild
(
/* shaderobject, renderer */
)
{}
onBeforeCompile
:
function
(
/* shaderobject, renderer */
)
{},
onBeforeCompile
(
/* shaderobject, renderer */
)
{}
customProgramCacheKey
:
function
()
{
customProgramCacheKey
()
{
return
this
.
onBeforeCompile
.
toString
();
}
,
}
setValues
:
function
(
values
)
{
setValues
(
values
)
{
if
(
values
===
undefined
)
return
;
...
...
@@ -137,9 +135,9 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
}
}
,
}
toJSON
:
function
(
meta
)
{
toJSON
(
meta
)
{
const
isRoot
=
(
meta
===
undefined
||
typeof
meta
===
'
string
'
);
...
...
@@ -353,15 +351,15 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
return
data
;
}
,
}
clone
:
function
()
{
clone
()
{
return
new
this
.
constructor
().
copy
(
this
);
}
,
}
copy
:
function
(
source
)
{
copy
(
source
)
{
this
.
name
=
source
.
name
;
...
...
@@ -438,24 +436,22 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
return
this
;
}
,
}
dispose
:
function
()
{
dispose
()
{
this
.
dispatchEvent
(
{
type
:
'
dispose
'
}
);
}
}
);
Object
.
defineProperty
(
Material
.
prototype
,
'
needsUpdate
'
,
{
set
:
function
(
value
)
{
set
needsUpdate
(
value
)
{
if
(
value
===
true
)
this
.
version
++
;
}
}
);
}
Material
.
prototype
.
isMaterial
=
true
;
export
{
Material
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录