Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
8b71831e
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,发现更多精彩内容 >>
未验证
提交
8b71831e
编写于
11月 20, 2019
作者:
M
Mr.doob
提交者:
GitHub
11月 20, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17968 from Mugen87/dev29
Material: Introduce version property.
上级
3f16519f
b521945d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
34 addition
and
11 deletion
+34
-11
docs/api/en/materials/Material.html
docs/api/en/materials/Material.html
+6
-2
docs/api/zh/materials/Material.html
docs/api/zh/materials/Material.html
+6
-2
examples/jsm/nodes/materials/NodeMaterial.js
examples/jsm/nodes/materials/NodeMaterial.js
+4
-3
src/materials/Material.d.ts
src/materials/Material.d.ts
+5
-0
src/materials/Material.js
src/materials/Material.js
+10
-1
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+3
-3
未找到文件。
docs/api/en/materials/Material.html
浏览文件 @
8b71831e
...
...
@@ -186,8 +186,7 @@
<h3>
[property:Boolean needsUpdate]
</h3>
<p>
Specifies that the material needs to be recompiled.
<br
/>
This property is automatically set to *true* when instancing a new material.
Specifies that the material needs to be recompiled.
</p>
<h3>
[property:Float opacity]
</h3>
...
...
@@ -296,6 +295,11 @@
This gets automatically assigned, so this shouldn't be edited.
</p>
<h3>
[property:Integer version]
</h3>
<p>
This starts at *0* and counts how many times [property:Boolean needsUpdate] is set to *true*.
</p>
<h3>
[property:Integer vertexColors]
</h3>
<p>
Defines whether vertex coloring is used.
...
...
docs/api/zh/materials/Material.html
浏览文件 @
8b71831e
...
...
@@ -163,8 +163,7 @@ Which stencil operation to perform when the comparison function returns true and
<p>
对象的可选名称(不必是唯一的)。默认值为空字符串。
</p>
<h3>
[property:Boolean needsUpdate]
</h3>
<p>
指定需要重新编译材质。
<br/>
实例化新材质时,此属性自动设置为true。
<p>
指定需要重新编译材质。
</p>
<h3>
[property:Float opacity]
</h3>
...
...
@@ -255,6 +254,11 @@ Defines whether this material is tone mapped according to the renderer's [page:W
<p>
此材质实例的[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID],会自动分配,不应该被更改。
</p>
<h3>
[property:Integer version]
</h3>
<p>
This starts at *0* and counts how many times [property:Boolean needsUpdate] is set to *true*.
</p>
<h3>
[property:Integer vertexColors]
</h3>
<p>
是否使用顶点着色。默认值为[page:Materials THREE.NoColors]。
其他选项有[page:Materials THREE.VertexColors] 和 [page:Materials THREE.FaceColors]。
...
...
examples/jsm/nodes/materials/NodeMaterial.js
浏览文件 @
8b71831e
...
...
@@ -30,7 +30,9 @@ function NodeMaterial( vertex, fragment ) {
this
.
onBeforeCompile
=
function
(
shader
,
renderer
)
{
if
(
this
.
needsUpdate
)
{
var
materialProperties
=
renderer
.
properties
.
get
(
this
);
if
(
this
.
version
!==
materialProperties
.
__version
)
{
this
.
build
(
{
renderer
:
renderer
}
);
...
...
@@ -74,6 +76,7 @@ Object.defineProperties( NodeMaterial.prototype, {
set
:
function
(
value
)
{
if
(
value
===
true
)
this
.
version
++
;
this
.
needsCompile
=
value
;
},
...
...
@@ -120,8 +123,6 @@ NodeMaterial.prototype.build = function ( params ) {
this
.
transparent
=
builder
.
requires
.
transparent
||
this
.
blending
>
NormalBlending
;
this
.
needsUpdate
=
false
;
return
this
;
};
...
...
src/materials/Material.d.ts
浏览文件 @
8b71831e
...
...
@@ -293,6 +293,11 @@ export class Material extends EventDispatcher {
*/
userData
:
any
;
/**
* This starts at 0 and counts how many times .needsUpdate is set to true.
*/
version
:
number
;
/**
* Return a new material with the same parameters as this material.
*/
...
...
src/materials/Material.js
浏览文件 @
8b71831e
...
...
@@ -74,7 +74,7 @@ function Material() {
this
.
userData
=
{};
this
.
needsUpdate
=
true
;
this
.
version
=
0
;
}
...
...
@@ -422,5 +422,14 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
}
);
Object
.
defineProperty
(
Material
.
prototype
,
'
needsUpdate
'
,
{
set
:
function
(
value
)
{
if
(
value
===
true
)
this
.
version
++
;
}
}
);
export
{
Material
};
src/renderers/WebGLRenderer.js
浏览文件 @
8b71831e
...
...
@@ -1675,7 +1675,7 @@ function WebGLRenderer( parameters ) {
}
if
(
material
.
needsUpdate
===
false
)
{
if
(
material
.
version
===
materialProperties
.
__version
)
{
if
(
materialProperties
.
program
===
undefined
)
{
...
...
@@ -1699,10 +1699,10 @@ function WebGLRenderer( parameters ) {
}
if
(
material
.
needsUpdate
)
{
if
(
material
.
version
!==
materialProperties
.
__version
)
{
initMaterial
(
material
,
fog
,
object
);
material
.
needsUpdate
=
false
;
material
Properties
.
__version
=
material
.
version
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录