Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
b6bce4f6
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,发现更多精彩内容 >>
提交
b6bce4f6
编写于
1月 31, 2012
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added handling of morph normals also for Phong material.
上级
a372d5ee
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
20 addition
and
16 deletion
+20
-16
build/Three.js
build/Three.js
+4
-4
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+1
-1
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+4
-4
examples/webgl_morphnormals.html
examples/webgl_morphnormals.html
+3
-3
src/materials/MeshPhongMaterial.js
src/materials/MeshPhongMaterial.js
+1
-0
src/renderers/WebGLShaders.js
src/renderers/WebGLShaders.js
+6
-3
未找到文件。
build/Three.js
浏览文件 @
b6bce4f6
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
b6bce4f6
...
...
@@ -115,7 +115,7 @@ THREE.MultiplyOperation;this.reflectivity=void 0!==a.reflectivity?a.reflectivity
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
;
this
.
morphNormals
=
void
0
!==
a
.
morphNormals
?
a
.
morphNormals
:
!
1
};
THREE
.
MeshLambertMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshLambertMaterial
.
prototype
.
constructor
=
THREE
.
MeshLambertMaterial
;
THREE
.
MeshPhongMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
16777215
);
this
.
specular
=
void
0
!==
a
.
specular
?
new
THREE
.
Color
(
a
.
specular
):
new
THREE
.
Color
(
1118481
);
this
.
shininess
=
void
0
!==
a
.
shininess
?
a
.
shininess
:
30
;
this
.
metal
=
void
0
!==
a
.
metal
?
a
.
metal
:
!
1
;
this
.
perPixel
=
void
0
!==
a
.
perPixel
?
a
.
perPixel
:
!
1
;
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshPhongMaterial
.
prototype
=
new
THREE
.
Material
;
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
;
this
.
morphNormals
=
void
0
!==
a
.
morphNormals
?
a
.
morphNormals
:
!
1
};
THREE
.
MeshPhongMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshPhongMaterial
.
prototype
.
constructor
=
THREE
.
MeshPhongMaterial
;
THREE
.
MeshDepthMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
};
THREE
.
MeshDepthMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshDepthMaterial
.
prototype
.
constructor
=
THREE
.
MeshDepthMaterial
;
THREE
.
MeshNormalMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
shading
=
a
.
shading
?
a
.
shading
:
THREE
.
FlatShading
;
this
.
wireframe
=
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
};
THREE
.
MeshNormalMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshNormalMaterial
.
prototype
.
constructor
=
THREE
.
MeshNormalMaterial
;
THREE
.
MeshFaceMaterial
=
function
(){};
THREE
.
ParticleBasicMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
size
=
void
0
!==
a
.
size
?
a
.
size
:
1
;
this
.
sizeAttenuation
=
void
0
!==
a
.
sizeAttenuation
?
a
.
sizeAttenuation
:
!
0
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
};
THREE
.
ParticleBasicMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
ParticleBasicMaterial
.
prototype
.
constructor
=
THREE
.
ParticleBasicMaterial
;
...
...
build/custom/ThreeSVG.js
浏览文件 @
b6bce4f6
...
...
@@ -115,7 +115,7 @@ THREE.MultiplyOperation;this.reflectivity=void 0!==a.reflectivity?a.reflectivity
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
;
this
.
morphNormals
=
void
0
!==
a
.
morphNormals
?
a
.
morphNormals
:
!
1
};
THREE
.
MeshLambertMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshLambertMaterial
.
prototype
.
constructor
=
THREE
.
MeshLambertMaterial
;
THREE
.
MeshPhongMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
16777215
);
this
.
specular
=
void
0
!==
a
.
specular
?
new
THREE
.
Color
(
a
.
specular
):
new
THREE
.
Color
(
1118481
);
this
.
shininess
=
void
0
!==
a
.
shininess
?
a
.
shininess
:
30
;
this
.
metal
=
void
0
!==
a
.
metal
?
a
.
metal
:
!
1
;
this
.
perPixel
=
void
0
!==
a
.
perPixel
?
a
.
perPixel
:
!
1
;
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshPhongMaterial
.
prototype
=
new
THREE
.
Material
;
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
;
this
.
morphNormals
=
void
0
!==
a
.
morphNormals
?
a
.
morphNormals
:
!
1
};
THREE
.
MeshPhongMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshPhongMaterial
.
prototype
.
constructor
=
THREE
.
MeshPhongMaterial
;
THREE
.
MeshDepthMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
};
THREE
.
MeshDepthMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshDepthMaterial
.
prototype
.
constructor
=
THREE
.
MeshDepthMaterial
;
THREE
.
MeshNormalMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
shading
=
a
.
shading
?
a
.
shading
:
THREE
.
FlatShading
;
this
.
wireframe
=
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
};
THREE
.
MeshNormalMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshNormalMaterial
.
prototype
.
constructor
=
THREE
.
MeshNormalMaterial
;
THREE
.
MeshFaceMaterial
=
function
(){};
THREE
.
ParticleBasicMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
size
=
void
0
!==
a
.
size
?
a
.
size
:
1
;
this
.
sizeAttenuation
=
void
0
!==
a
.
sizeAttenuation
?
a
.
sizeAttenuation
:
!
0
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
};
THREE
.
ParticleBasicMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
ParticleBasicMaterial
.
prototype
.
constructor
=
THREE
.
ParticleBasicMaterial
;
...
...
build/custom/ThreeWebGL.js
浏览文件 @
b6bce4f6
此差异已折叠。
点击以展开。
examples/webgl_morphnormals.html
浏览文件 @
b6bce4f6
...
...
@@ -83,13 +83,13 @@
//
var
loader
=
new
THREE
.
JSONLoader
(
true
);
var
loader
=
new
THREE
.
JSONLoader
();
loader
.
load
(
"
models/animated/flamingo.js
"
,
function
(
geometry
)
{
morphColorsToFaceColors
(
geometry
);
geometry
.
computeVertexNormals
();
var
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
morphTargets
:
true
,
morphNormals
:
fals
e
,
vertexColors
:
THREE
.
FaceColors
,
shading
:
THREE
.
FlatShading
}
);
var
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
morphTargets
:
true
,
morphNormals
:
tru
e
,
vertexColors
:
THREE
.
FaceColors
,
shading
:
THREE
.
FlatShading
}
);
var
meshAnim
=
new
THREE
.
MorphAnimMesh
(
geometry
,
material
);
meshAnim
.
duration
=
5000
;
...
...
@@ -107,7 +107,7 @@
morphColorsToFaceColors
(
geometry
);
geometry
.
computeVertexNormals
();
var
material
=
new
THREE
.
Mesh
LambertMaterial
(
{
color
:
0xffffff
,
morphTargets
:
true
,
morphNormals
:
true
,
vertexColors
:
THREE
.
FaceColors
,
shading
:
THREE
.
FlatShading
}
);
var
material
=
new
THREE
.
Mesh
PhongMaterial
(
{
color
:
0xffffff
,
specular
:
0xffffff
,
shininess
:
20
,
morphTargets
:
true
,
morphNormals
:
true
,
vertexColors
:
THREE
.
FaceColors
,
shading
:
THREE
.
SmoothShading
,
perPixel
:
false
}
);
var
meshAnim
=
new
THREE
.
MorphAnimMesh
(
geometry
,
material
);
meshAnim
.
duration
=
5000
;
...
...
src/materials/MeshPhongMaterial.js
浏览文件 @
b6bce4f6
...
...
@@ -71,6 +71,7 @@ THREE.MeshPhongMaterial = function ( parameters ) {
this
.
skinning
=
parameters
.
skinning
!==
undefined
?
parameters
.
skinning
:
false
;
this
.
morphTargets
=
parameters
.
morphTargets
!==
undefined
?
parameters
.
morphTargets
:
false
;
this
.
morphNormals
=
parameters
.
morphNormals
!==
undefined
?
parameters
.
morphNormals
:
false
;
};
...
...
src/renderers/WebGLShaders.js
浏览文件 @
b6bce4f6
...
...
@@ -289,6 +289,8 @@ THREE.ShaderChunk = {
"
#if MAX_DIR_LIGHTS > 0
"
,
"
transformedNormal = normalize( transformedNormal );
"
,
"
for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {
"
,
"
vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );
"
,
...
...
@@ -747,11 +749,11 @@ THREE.ShaderChunk = {
"
morphedNormal += normal;
"
,
"
vec3 transformedNormal = normal
ize( normalMatrix * morphedNormal )
;
"
,
"
vec3 transformedNormal = normal
Matrix * morphedNormal
;
"
,
"
#else
"
,
"
vec3 transformedNormal = normal
ize( normalMatrix * normal )
;
"
,
"
vec3 transformedNormal = normal
Matrix * normal
;
"
,
"
#endif
"
...
...
@@ -1438,7 +1440,8 @@ THREE.ShaderLib = {
"
vViewPosition = -mvPosition.xyz;
"
,
"
vec3 transformedNormal = normalMatrix * normal;
"
,
THREE
.
ShaderChunk
[
"
morphnormal_vertex
"
],
"
vNormal = transformedNormal;
"
,
THREE
.
ShaderChunk
[
"
lights_phong_vertex
"
],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录