Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
0f8acdb6
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,发现更多精彩内容 >>
提交
0f8acdb6
编写于
7月 09, 2017
作者:
M
Mr.doob
提交者:
GitHub
7月 09, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11724 from WestLangley/dev-flat_shading
Remove Material.shading; add Material.flatShading
上级
fba4491a
be3e148d
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
40 addition
and
45 deletion
+40
-45
docs/api/constants/Materials.html
docs/api/constants/Materials.html
+0
-10
docs/api/materials/Material.html
docs/api/materials/Material.html
+2
-3
docs/api/materials/ShaderMaterial.html
docs/api/materials/ShaderMaterial.html
+2
-3
docs/scenes/bones-browser.html
docs/scenes/bones-browser.html
+1
-1
docs/scenes/geometry-browser.html
docs/scenes/geometry-browser.html
+1
-1
docs/scenes/js/geometry.js
docs/scenes/js/geometry.js
+0
-7
docs/scenes/js/material.js
docs/scenes/js/material.js
+4
-12
src/Three.Legacy.js
src/Three.Legacy.js
+14
-0
src/materials/Material.js
src/materials/Material.js
+13
-4
src/materials/MeshBasicMaterial.js
src/materials/MeshBasicMaterial.js
+0
-1
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+1
-1
src/renderers/webgl/WebGLPrograms.js
src/renderers/webgl/WebGLPrograms.js
+2
-2
未找到文件。
docs/api/constants/Materials.html
浏览文件 @
0f8acdb6
...
...
@@ -28,16 +28,6 @@
</div>
<h2>
Shading
</h2>
<code>
THREE.SmoothShading
THREE.FlatShading
</code>
<div>
[page:Constant SmoothShading] is the default and linearly interpolates color between vertices.
<br
/>
[page:Constant FlatShading] uses the color of the first vertex for every pixel in a face.
</div>
<h2>
Colors
</h2>
<code>
THREE.NoColors
...
...
docs/api/materials/Material.html
浏览文件 @
0f8acdb6
...
...
@@ -204,10 +204,9 @@
Default is *false*.
</div>
<h3>
[property:
Integer s
hading]
</h3>
<h3>
[property:
Boolean flatS
hading]
</h3>
<div>
Defines how the material is shaded.
This can be either [page:Materials THREE.SmoothShading] (default) or [page:Materials THREE.FlatShading].
Define whether the material is rendered with flat shading. Default is false.
</div>
<h3>
[property:Integer side]
</h3>
...
...
docs/api/materials/ShaderMaterial.html
浏览文件 @
0f8acdb6
...
...
@@ -371,10 +371,9 @@ this.extensions = {
You should not need to access this property.
</div>
<h3>
[property:
Number s
hading]
</h3>
<h3>
[property:
Boolean flatS
hading]
</h3>
<div>
Define shading type, which determines whether normals are smoothed between vertices;
possible values are [page:Materials THREE.SmoothShading] or [page:Materials THREE.FlatShading]. Default is THREE.SmoothShading.
Define whether the material is rendered with flat shading. Default is false.
</div>
...
...
docs/scenes/bones-browser.html
浏览文件 @
0f8acdb6
...
...
@@ -149,7 +149,7 @@
color
:
0x156289
,
emissive
:
0x072534
,
side
:
THREE
.
DoubleSide
,
shading
:
THREE
.
FlatShading
flatShading
:
true
}
);
var
mesh
=
new
THREE
.
SkinnedMesh
(
geometry
,
material
);
...
...
docs/scenes/geometry-browser.html
浏览文件 @
0f8acdb6
...
...
@@ -94,7 +94,7 @@
color
:
0x156289
,
emissive
:
0x072534
,
side
:
THREE
.
DoubleSide
,
shading
:
THREE
.
FlatShading
flatShading
:
true
}
)
)
);
...
...
docs/scenes/js/geometry.js
浏览文件 @
0f8acdb6
...
...
@@ -22,13 +22,6 @@ var constants = {
},
shading
:
{
"
THREE.FlatShading
"
:
THREE
.
FlatShading
,
"
THREE.SmoothShading
"
:
THREE
.
SmoothShading
},
colors
:
{
"
THREE.NoColors
"
:
THREE
.
NoColors
,
...
...
docs/scenes/js/material.js
浏览文件 @
0f8acdb6
...
...
@@ -20,13 +20,6 @@ var constants = {
},
shading
:
{
"
THREE.FlatShading
"
:
THREE
.
FlatShading
,
"
THREE.SmoothShading
"
:
THREE
.
SmoothShading
},
colors
:
{
"
THREE.NoColors
"
:
THREE
.
NoColors
,
...
...
@@ -202,7 +195,6 @@ function needsUpdate ( material, geometry ) {
return
function
()
{
material
.
shading
=
+
material
.
shading
;
//Ensure number
material
.
vertexColors
=
+
material
.
vertexColors
;
//Ensure number
material
.
side
=
+
material
.
side
;
//Ensure number
material
.
needsUpdate
=
true
;
...
...
@@ -330,7 +322,6 @@ function guiMeshBasicMaterial ( gui, mesh, material, geometry ) {
folder
.
addColor
(
data
,
'
color
'
).
onChange
(
handleColorChange
(
material
.
color
)
);
folder
.
add
(
material
,
'
wireframe
'
);
folder
.
add
(
material
,
'
wireframeLinewidth
'
,
0
,
10
);
folder
.
add
(
material
,
'
shading
'
,
constants
.
shading
);
folder
.
add
(
material
,
'
vertexColors
'
,
constants
.
colors
).
onChange
(
needsUpdate
(
material
,
geometry
)
);
folder
.
add
(
material
,
'
fog
'
);
...
...
@@ -360,6 +351,7 @@ function guiMeshNormalMaterial ( gui, mesh, material, geometry ) {
var
folder
=
gui
.
addFolder
(
'
THREE.MeshNormalMaterial
'
);
folder
.
add
(
material
,
'
flatShading
'
).
onChange
(
needsUpdate
(
material
,
geometry
)
);
folder
.
add
(
material
,
'
wireframe
'
);
folder
.
add
(
material
,
'
wireframeLinewidth
'
,
0
,
10
);
folder
.
add
(
material
,
'
morphTargets
'
).
onChange
(
updateMorphs
(
mesh
,
material
)
);
...
...
@@ -438,7 +430,7 @@ function guiMeshPhongMaterial ( gui, mesh, material, geometry ) {
folder
.
addColor
(
data
,
'
specular
'
).
onChange
(
handleColorChange
(
material
.
specular
)
);
folder
.
add
(
material
,
'
shininess
'
,
0
,
100
);
folder
.
add
(
material
,
'
shading
'
,
constants
.
shading
).
onChange
(
needsUpdate
(
material
,
geometry
)
);
folder
.
add
(
material
,
'
flatShading
'
).
onChange
(
needsUpdate
(
material
,
geometry
)
);
folder
.
add
(
material
,
'
wireframe
'
);
folder
.
add
(
material
,
'
wireframeLinewidth
'
,
0
,
10
);
folder
.
add
(
material
,
'
vertexColors
'
,
constants
.
colors
);
...
...
@@ -470,7 +462,7 @@ function guiMeshStandardMaterial ( gui, mesh, material, geometry ) {
folder
.
add
(
material
,
'
roughness
'
,
0
,
1
);
folder
.
add
(
material
,
'
metalness
'
,
0
,
1
);
folder
.
add
(
material
,
'
shading
'
,
constants
.
shading
).
onChange
(
needsUpdate
(
material
,
geometry
)
);
folder
.
add
(
material
,
'
flatShading
'
).
onChange
(
needsUpdate
(
material
,
geometry
)
);
folder
.
add
(
material
,
'
wireframe
'
);
folder
.
add
(
material
,
'
wireframeLinewidth
'
,
0
,
10
);
folder
.
add
(
material
,
'
vertexColors
'
,
constants
.
colors
);
...
...
@@ -533,7 +525,7 @@ function chooseFromHash ( gui, mesh, geometry ) {
case
"
MeshDepthMaterial
"
:
material
=
new
THREE
.
MeshDepthMaterial
(
{
color
:
0x2194CE
}
);
material
=
new
THREE
.
MeshDepthMaterial
();
guiMaterial
(
gui
,
mesh
,
material
,
geometry
);
guiMeshDepthMaterial
(
gui
,
mesh
,
material
,
geometry
);
...
...
src/Three.Legacy.js
浏览文件 @
0f8acdb6
...
...
@@ -1034,6 +1034,20 @@ Object.defineProperties( Material.prototype, {
console
.
warn
(
'
THREE.Material: .wrapRGB has been removed.
'
);
return
new
Color
();
}
},
shading
:
{
get
:
function
()
{
console
.
error
(
'
THREE.
'
+
this
.
type
+
'
: .shading has been removed. Use the boolean .flatShading instead.
'
);
},
set
:
function
(
value
)
{
console
.
warn
(
'
THREE.
'
+
this
.
type
+
'
: .shading has been removed. Use the boolean .flatShading instead.
'
);
this
.
flatShading
=
(
value
===
THREE
.
FlatShading
)
?
true
:
false
;
}
}
...
...
src/materials/Material.js
浏览文件 @
0f8acdb6
import
{
EventDispatcher
}
from
'
../core/EventDispatcher
'
;
import
{
NoColors
,
FrontSide
,
Smooth
Shading
,
NormalBlending
,
LessEqualDepth
,
AddEquation
,
OneMinusSrcAlphaFactor
,
SrcAlphaFactor
}
from
'
../constants
'
;
import
{
NoColors
,
FrontSide
,
Flat
Shading
,
NormalBlending
,
LessEqualDepth
,
AddEquation
,
OneMinusSrcAlphaFactor
,
SrcAlphaFactor
}
from
'
../constants
'
;
import
{
_Math
}
from
'
../math/Math
'
;
/**
...
...
@@ -23,7 +23,7 @@ function Material() {
this
.
blending
=
NormalBlending
;
this
.
side
=
FrontSide
;
this
.
shading
=
SmoothShading
;
// THREE.FlatShading, THREE.SmoothShading
this
.
flatShading
=
false
;
this
.
vertexColors
=
NoColors
;
// THREE.NoColors, THREE.VertexColors, THREE.FaceColors
this
.
opacity
=
1
;
...
...
@@ -86,6 +86,15 @@ Object.assign( Material.prototype, EventDispatcher.prototype, {
}
// for backward compatability if shading is set in the constructor
if
(
key
===
'
shading
'
)
{
console
.
warn
(
'
THREE.
'
+
this
.
type
+
'
: .shading has been removed. Use the boolean .flatShading instead.
'
);
this
.
flatShading
=
(
newValue
===
FlatShading
)
?
true
:
false
;
continue
;
}
var
currentValue
=
this
[
key
];
if
(
currentValue
===
undefined
)
{
...
...
@@ -201,7 +210,7 @@ Object.assign( Material.prototype, EventDispatcher.prototype, {
if
(
this
.
sizeAttenuation
!==
undefined
)
data
.
sizeAttenuation
=
this
.
sizeAttenuation
;
if
(
this
.
blending
!==
NormalBlending
)
data
.
blending
=
this
.
blending
;
if
(
this
.
shading
!==
SmoothShading
)
data
.
shading
=
this
.
s
hading
;
if
(
this
.
flatShading
===
true
)
data
.
flatShading
=
this
.
flatS
hading
;
if
(
this
.
side
!==
FrontSide
)
data
.
side
=
this
.
side
;
if
(
this
.
vertexColors
!==
NoColors
)
data
.
vertexColors
=
this
.
vertexColors
;
...
...
@@ -271,7 +280,7 @@ Object.assign( Material.prototype, EventDispatcher.prototype, {
this
.
blending
=
source
.
blending
;
this
.
side
=
source
.
side
;
this
.
shading
=
source
.
s
hading
;
this
.
flatShading
=
source
.
flatS
hading
;
this
.
vertexColors
=
source
.
vertexColors
;
this
.
opacity
=
source
.
opacity
;
...
...
src/materials/MeshBasicMaterial.js
浏览文件 @
0f8acdb6
...
...
@@ -26,7 +26,6 @@ import { Color } from '../math/Color';
* reflectivity: <float>,
* refractionRatio: <float>,
*
* shading: THREE.SmoothShading,
* depthTest: <bool>,
* depthWrite: <bool>,
*
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
0f8acdb6
...
...
@@ -629,7 +629,7 @@ function WebGLRenderer( parameters ) {
if
(
!
material
.
isMeshPhongMaterial
&&
!
material
.
isMeshStandardMaterial
&&
!
material
.
isMeshNormalMaterial
&&
material
.
shading
===
FlatShading
)
{
material
.
flatShading
===
true
)
{
for
(
var
i
=
0
,
l
=
object
.
count
*
3
;
i
<
l
;
i
+=
9
)
{
...
...
src/renderers/webgl/WebGLPrograms.js
浏览文件 @
0f8acdb6
...
...
@@ -2,7 +2,7 @@
* @author mrdoob / http://mrdoob.com/
*/
import
{
BackSide
,
DoubleSide
,
FlatShading
,
CubeUVRefractionMapping
,
CubeUVReflectionMapping
,
GammaEncoding
,
LinearEncoding
}
from
'
../../constants
'
;
import
{
BackSide
,
DoubleSide
,
CubeUVRefractionMapping
,
CubeUVReflectionMapping
,
GammaEncoding
,
LinearEncoding
}
from
'
../../constants
'
;
import
{
WebGLProgram
}
from
'
./WebGLProgram
'
;
function
WebGLPrograms
(
renderer
,
capabilities
)
{
...
...
@@ -162,7 +162,7 @@ function WebGLPrograms( renderer, capabilities ) {
useFog
:
material
.
fog
,
fogExp
:
(
fog
&&
fog
.
isFogExp2
),
flatShading
:
material
.
shading
===
F
latShading
,
flatShading
:
material
.
f
latShading
,
sizeAttenuation
:
material
.
sizeAttenuation
,
logarithmicDepthBuffer
:
capabilities
.
logarithmicDepthBuffer
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录