Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
061505cb
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,发现更多精彩内容 >>
提交
061505cb
编写于
11月 05, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Deprecated UniformsUtils. See #8016.
上级
6078e085
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
87 addition
and
120 deletion
+87
-120
src/Three.Legacy.js
src/Three.Legacy.js
+65
-0
src/Three.js
src/Three.js
+0
-1
src/materials/ShaderMaterial.js
src/materials/ShaderMaterial.js
+1
-2
src/materials/ShadowMaterial.js
src/materials/ShadowMaterial.js
+3
-4
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+1
-2
src/renderers/shaders/ShaderLib.js
src/renderers/shaders/ShaderLib.js
+16
-42
src/renderers/shaders/UniformsUtils.js
src/renderers/shaders/UniformsUtils.js
+0
-67
src/renderers/webgl/WebGLShadowMap.js
src/renderers/webgl/WebGLShadowMap.js
+1
-2
未找到文件。
src/Three.Legacy.js
浏览文件 @
061505cb
...
...
@@ -848,6 +848,71 @@ export var ImageUtils = {
};
export
var
UniformsUtils
=
{
merge
:
function
(
uniforms
)
{
console
.
warn
(
'
THREE.UniformsUtils.merge() has been deprecated. Use Object.assign() instead.
'
);
var
merged
=
{};
for
(
var
u
=
0
;
u
<
uniforms
.
length
;
u
++
)
{
var
tmp
=
this
.
clone
(
uniforms
[
u
]
);
for
(
var
p
in
tmp
)
{
merged
[
p
]
=
tmp
[
p
];
}
}
return
merged
;
},
clone
:
function
(
uniforms_src
)
{
console
.
warn
(
'
THREE.UniformsUtils.clone() has been deprecated.
'
);
var
uniforms_dst
=
{};
for
(
var
u
in
uniforms_src
)
{
uniforms_dst
[
u
]
=
{};
for
(
var
p
in
uniforms_src
[
u
]
)
{
var
parameter_src
=
uniforms_src
[
u
][
p
];
if
(
parameter_src
&&
(
parameter_src
.
isColor
||
parameter_src
.
isMatrix3
||
parameter_src
.
isMatrix4
||
parameter_src
.
isVector2
||
parameter_src
.
isVector3
||
parameter_src
.
isVector4
||
parameter_src
.
isTexture
)
)
{
uniforms_dst
[
u
][
p
]
=
parameter_src
.
clone
();
}
else
if
(
Array
.
isArray
(
parameter_src
)
)
{
uniforms_dst
[
u
][
p
]
=
parameter_src
.
slice
();
}
else
{
uniforms_dst
[
u
][
p
]
=
parameter_src
;
}
}
}
return
uniforms_dst
;
}
};
//
export
function
Projector
()
{
...
...
src/Three.js
浏览文件 @
061505cb
...
...
@@ -6,7 +6,6 @@ export { WebGLRenderer } from './renderers/WebGLRenderer.js';
export
{
WebGL2Renderer
}
from
'
./renderers/WebGL2Renderer.js
'
;
export
{
ShaderLib
}
from
'
./renderers/shaders/ShaderLib.js
'
;
export
{
UniformsLib
}
from
'
./renderers/shaders/UniformsLib.js
'
;
export
{
UniformsUtils
}
from
'
./renderers/shaders/UniformsUtils.js
'
;
export
{
ShaderChunk
}
from
'
./renderers/shaders/ShaderChunk.js
'
;
export
{
FogExp2
}
from
'
./scenes/FogExp2.js
'
;
export
{
Fog
}
from
'
./scenes/Fog.js
'
;
...
...
src/materials/ShaderMaterial.js
浏览文件 @
061505cb
import
{
Material
}
from
'
./Material
'
;
import
{
UniformsUtils
}
from
'
../renderers/shaders/UniformsUtils
'
;
/**
* @author alteredq / http://alteredqualia.com/
...
...
@@ -90,7 +89,7 @@ ShaderMaterial.prototype.copy = function ( source ) {
this
.
fragmentShader
=
source
.
fragmentShader
;
this
.
vertexShader
=
source
.
vertexShader
;
this
.
uniforms
=
UniformsUtils
.
clone
(
source
.
uniforms
);
this
.
uniforms
=
Object
.
assign
(
{},
source
.
uniforms
);
this
.
defines
=
source
.
defines
;
...
...
src/materials/ShadowMaterial.js
浏览文件 @
061505cb
import
{
ShaderMaterial
}
from
'
./ShaderMaterial
'
;
import
{
ShaderChunk
}
from
'
../renderers/shaders/ShaderChunk
'
;
import
{
UniformsLib
}
from
'
../renderers/shaders/UniformsLib
'
;
import
{
UniformsUtils
}
from
'
../renderers/shaders/UniformsUtils
'
;
/**
* @author mrdoob / http://mrdoob.com/
...
...
@@ -10,12 +9,12 @@ import { UniformsUtils } from '../renderers/shaders/UniformsUtils';
function
ShadowMaterial
()
{
ShaderMaterial
.
call
(
this
,
{
uniforms
:
UniformsUtils
.
merge
(
[
UniformsLib
[
"
lights
"
]
,
uniforms
:
Object
.
assign
(
{},
UniformsLib
.
lights
,
{
opacity
:
{
value
:
1.0
}
}
]
),
),
vertexShader
:
ShaderChunk
[
'
shadow_vert
'
],
fragmentShader
:
ShaderChunk
[
'
shadow_frag
'
]
}
);
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
061505cb
import
{
REVISION
,
MaxEquation
,
MinEquation
,
RGB_ETC1_Format
,
RGBA_PVRTC_2BPPV1_Format
,
RGBA_PVRTC_4BPPV1_Format
,
RGB_PVRTC_2BPPV1_Format
,
RGB_PVRTC_4BPPV1_Format
,
RGBA_S3TC_DXT5_Format
,
RGBA_S3TC_DXT3_Format
,
RGBA_S3TC_DXT1_Format
,
RGB_S3TC_DXT1_Format
,
SrcAlphaSaturateFactor
,
OneMinusDstColorFactor
,
DstColorFactor
,
OneMinusDstAlphaFactor
,
DstAlphaFactor
,
OneMinusSrcAlphaFactor
,
SrcAlphaFactor
,
OneMinusSrcColorFactor
,
SrcColorFactor
,
OneFactor
,
ZeroFactor
,
ReverseSubtractEquation
,
SubtractEquation
,
AddEquation
,
DepthFormat
,
DepthStencilFormat
,
LuminanceAlphaFormat
,
LuminanceFormat
,
RGBAFormat
,
RGBFormat
,
AlphaFormat
,
HalfFloatType
,
FloatType
,
UnsignedIntType
,
IntType
,
UnsignedShortType
,
ShortType
,
ByteType
,
UnsignedInt248Type
,
UnsignedShort565Type
,
UnsignedShort5551Type
,
UnsignedShort4444Type
,
UnsignedByteType
,
LinearMipMapLinearFilter
,
LinearMipMapNearestFilter
,
LinearFilter
,
NearestMipMapLinearFilter
,
NearestMipMapNearestFilter
,
NearestFilter
,
MirroredRepeatWrapping
,
ClampToEdgeWrapping
,
RepeatWrapping
,
FrontFaceDirectionCW
,
NoBlending
,
BackSide
,
DoubleSide
,
TriangleFanDrawMode
,
TriangleStripDrawMode
,
TrianglesDrawMode
,
NoColors
,
FlatShading
,
LinearToneMapping
}
from
'
../constants
'
;
import
{
Matrix4
}
from
'
../math/Matrix4
'
;
import
{
WebGLUniforms
}
from
'
./webgl/WebGLUniforms
'
;
import
{
UniformsUtils
}
from
'
./shaders/UniformsUtils
'
;
import
{
ShaderLib
}
from
'
./shaders/ShaderLib
'
;
import
{
LensFlarePlugin
}
from
'
./webgl/plugins/LensFlarePlugin
'
;
import
{
SpritePlugin
}
from
'
./webgl/plugins/SpritePlugin
'
;
...
...
@@ -1534,7 +1533,7 @@ function WebGLRenderer( parameters ) {
materialProperties
.
__webglShader
=
{
name
:
material
.
type
,
uniforms
:
UniformsUtils
.
clone
(
shader
.
uniforms
),
uniforms
:
Object
.
assign
(
{},
shader
.
uniforms
),
vertexShader
:
shader
.
vertexShader
,
fragmentShader
:
shader
.
fragmentShader
};
...
...
src/renderers/shaders/ShaderLib.js
浏览文件 @
061505cb
import
{
ShaderChunk
}
from
'
./ShaderChunk
'
;
import
{
UniformsUtils
}
from
'
./UniformsUtils
'
;
import
{
Vector3
}
from
'
../../math/Vector3
'
;
import
{
UniformsLib
}
from
'
./UniformsLib
'
;
import
{
Color
}
from
'
../../math/Color
'
;
...
...
@@ -14,13 +13,11 @@ var ShaderLib = {
basic
:
{
uniforms
:
UniformsUtils
.
merge
(
[
uniforms
:
Object
.
assign
(
{},
UniformsLib
.
common
,
UniformsLib
.
aomap
,
UniformsLib
.
fog
]
),
),
vertexShader
:
ShaderChunk
.
meshbasic_vert
,
fragmentShader
:
ShaderChunk
.
meshbasic_frag
...
...
@@ -29,20 +26,17 @@ var ShaderLib = {
lambert
:
{
uniforms
:
UniformsUtils
.
merge
(
[
uniforms
:
Object
.
assign
(
{},
UniformsLib
.
common
,
UniformsLib
.
aomap
,
UniformsLib
.
lightmap
,
UniformsLib
.
emissivemap
,
UniformsLib
.
fog
,
UniformsLib
.
lights
,
{
emissive
:
{
value
:
new
Color
(
0x000000
)
}
}
]
),
),
vertexShader
:
ShaderChunk
.
meshlambert_vert
,
fragmentShader
:
ShaderChunk
.
meshlambert_frag
...
...
@@ -51,8 +45,7 @@ var ShaderLib = {
phong
:
{
uniforms
:
UniformsUtils
.
merge
(
[
uniforms
:
Object
.
assign
(
{},
UniformsLib
.
common
,
UniformsLib
.
aomap
,
UniformsLib
.
lightmap
,
...
...
@@ -62,14 +55,12 @@ var ShaderLib = {
UniformsLib
.
displacementmap
,
UniformsLib
.
fog
,
UniformsLib
.
lights
,
{
emissive
:
{
value
:
new
Color
(
0x000000
)
},
specular
:
{
value
:
new
Color
(
0x111111
)
},
shininess
:
{
value
:
30
}
}
]
),
),
vertexShader
:
ShaderChunk
.
meshphong_vert
,
fragmentShader
:
ShaderChunk
.
meshphong_frag
...
...
@@ -78,8 +69,7 @@ var ShaderLib = {
standard
:
{
uniforms
:
UniformsUtils
.
merge
(
[
uniforms
:
Object
.
assign
(
{},
UniformsLib
.
common
,
UniformsLib
.
aomap
,
UniformsLib
.
lightmap
,
...
...
@@ -91,15 +81,13 @@ var ShaderLib = {
UniformsLib
.
metalnessmap
,
UniformsLib
.
fog
,
UniformsLib
.
lights
,
{
emissive
:
{
value
:
new
Color
(
0x000000
)
},
roughness
:
{
value
:
0.5
},
metalness
:
{
value
:
0
},
envMapIntensity
:
{
value
:
1
},
// temporary
}
]
),
),
vertexShader
:
ShaderChunk
.
meshphysical_vert
,
fragmentShader
:
ShaderChunk
.
meshphysical_frag
...
...
@@ -108,12 +96,10 @@ var ShaderLib = {
points
:
{
uniforms
:
UniformsUtils
.
merge
(
[
uniforms
:
Object
.
assign
(
{},
UniformsLib
.
points
,
UniformsLib
.
fog
]
),
),
vertexShader
:
ShaderChunk
.
points_vert
,
fragmentShader
:
ShaderChunk
.
points_frag
...
...
@@ -122,18 +108,15 @@ var ShaderLib = {
dashed
:
{
uniforms
:
UniformsUtils
.
merge
(
[
uniforms
:
Object
.
assign
(
{},
UniformsLib
.
common
,
UniformsLib
.
fog
,
{
scale
:
{
value
:
1
},
dashSize
:
{
value
:
1
},
totalSize
:
{
value
:
2
}
}
]
),
),
vertexShader
:
ShaderChunk
.
linedashed_vert
,
fragmentShader
:
ShaderChunk
.
linedashed_frag
...
...
@@ -142,12 +125,10 @@ var ShaderLib = {
depth
:
{
uniforms
:
UniformsUtils
.
merge
(
[
uniforms
:
Object
.
assign
(
{},
UniformsLib
.
common
,
UniformsLib
.
displacementmap
]
),
),
vertexShader
:
ShaderChunk
.
depth_vert
,
fragmentShader
:
ShaderChunk
.
depth_frag
...
...
@@ -157,9 +138,7 @@ var ShaderLib = {
normal
:
{
uniforms
:
{
opacity
:
{
value
:
1.0
}
},
vertexShader
:
ShaderChunk
.
normal_vert
,
...
...
@@ -203,9 +182,7 @@ var ShaderLib = {
distanceRGBA
:
{
uniforms
:
{
lightPos
:
{
value
:
new
Vector3
()
}
},
vertexShader
:
ShaderChunk
.
distanceRGBA_vert
,
...
...
@@ -217,16 +194,13 @@ var ShaderLib = {
ShaderLib
.
physical
=
{
uniforms
:
UniformsUtils
.
merge
(
[
uniforms
:
Object
.
assign
(
{},
ShaderLib
.
standard
.
uniforms
,
{
clearCoat
:
{
value
:
0
},
clearCoatRoughness
:
{
value
:
0
}
}
]
),
),
vertexShader
:
ShaderChunk
.
meshphysical_vert
,
fragmentShader
:
ShaderChunk
.
meshphysical_frag
...
...
src/renderers/shaders/UniformsUtils.js
已删除
100644 → 0
浏览文件 @
6078e085
/**
* Uniform Utilities
*/
var
UniformsUtils
=
{
merge
:
function
(
uniforms
)
{
var
merged
=
{};
for
(
var
u
=
0
;
u
<
uniforms
.
length
;
u
++
)
{
var
tmp
=
this
.
clone
(
uniforms
[
u
]
);
for
(
var
p
in
tmp
)
{
merged
[
p
]
=
tmp
[
p
];
}
}
return
merged
;
},
clone
:
function
(
uniforms_src
)
{
var
uniforms_dst
=
{};
for
(
var
u
in
uniforms_src
)
{
uniforms_dst
[
u
]
=
{};
for
(
var
p
in
uniforms_src
[
u
]
)
{
var
parameter_src
=
uniforms_src
[
u
][
p
];
if
(
parameter_src
&&
(
parameter_src
.
isColor
||
parameter_src
.
isMatrix3
||
parameter_src
.
isMatrix4
||
parameter_src
.
isVector2
||
parameter_src
.
isVector3
||
parameter_src
.
isVector4
||
parameter_src
.
isTexture
)
)
{
uniforms_dst
[
u
][
p
]
=
parameter_src
.
clone
();
}
else
if
(
Array
.
isArray
(
parameter_src
)
)
{
uniforms_dst
[
u
][
p
]
=
parameter_src
.
slice
();
}
else
{
uniforms_dst
[
u
][
p
]
=
parameter_src
;
}
}
}
return
uniforms_dst
;
}
};
export
{
UniformsUtils
};
src/renderers/webgl/WebGLShadowMap.js
浏览文件 @
061505cb
...
...
@@ -6,7 +6,6 @@
import
{
FrontSide
,
BackSide
,
DoubleSide
,
RGBAFormat
,
NearestFilter
,
PCFShadowMap
,
RGBADepthPacking
}
from
'
../../constants
'
;
import
{
WebGLRenderTarget
}
from
'
../WebGLRenderTarget
'
;
import
{
ShaderMaterial
}
from
'
../../materials/ShaderMaterial
'
;
import
{
UniformsUtils
}
from
'
../shaders/UniformsUtils
'
;
import
{
ShaderLib
}
from
'
../shaders/ShaderLib
'
;
import
{
MeshDepthMaterial
}
from
'
../../materials/MeshDepthMaterial
'
;
import
{
Vector4
}
from
'
../../math/Vector4
'
;
...
...
@@ -64,7 +63,7 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
depthMaterialTemplate
.
clipping
=
true
;
var
distanceShader
=
ShaderLib
[
"
distanceRGBA
"
];
var
distanceUniforms
=
UniformsUtils
.
clone
(
distanceShader
.
uniforms
);
var
distanceUniforms
=
Object
.
assign
(
{},
distanceShader
.
uniforms
);
for
(
var
i
=
0
;
i
!==
_NumberOfMaterialVariants
;
++
i
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录