Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
15544dfa
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,发现更多精彩内容 >>
提交
15544dfa
编写于
11月 19, 2016
作者:
T
Takahiro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add missing Toon Material and shader files
上级
b1634350
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
294 addition
and
0 deletion
+294
-0
src/materials/MeshToonMaterial.js
src/materials/MeshToonMaterial.js
+171
-0
src/renderers/shaders/ShaderLib/meshtoon_frag.glsl
src/renderers/shaders/ShaderLib/meshtoon_frag.glsl
+68
-0
src/renderers/shaders/ShaderLib/meshtoon_vert.glsl
src/renderers/shaders/ShaderLib/meshtoon_vert.glsl
+55
-0
未找到文件。
src/materials/MeshToonMaterial.js
0 → 100644
浏览文件 @
15544dfa
import
{
Material
}
from
'
./Material
'
;
import
{
MultiplyOperation
}
from
'
../constants
'
;
import
{
Vector2
}
from
'
../math/Vector2
'
;
import
{
Color
}
from
'
../math/Color
'
;
/**
* @author takahirox / http://github.com/takahirox
*
* parameters = {
* color: <hex>,
* specular: <hex>,
* shininess: <float>,
* opacity: <float>,
*
* map: new THREE.Texture( <Image> ),
*
* lightMap: new THREE.Texture( <Image> ),
* lightMapIntensity: <float>
*
* aoMap: new THREE.Texture( <Image> ),
* aoMapIntensity: <float>
*
* emissive: <hex>,
* emissiveIntensity: <float>
* emissiveMap: new THREE.Texture( <Image> ),
*
* bumpMap: new THREE.Texture( <Image> ),
* bumpScale: <float>,
*
* normalMap: new THREE.Texture( <Image> ),
* normalScale: <Vector2>,
*
* displacementMap: new THREE.Texture( <Image> ),
* displacementScale: <float>,
* displacementBias: <float>,
*
* specularMap: new THREE.Texture( <Image> ),
*
* alphaMap: new THREE.Texture( <Image> ),
*
* envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
* combine: THREE.Multiply,
* reflectivity: <float>,
* refractionRatio: <float>,
*
* gradientMap: new THREE.Texture( <Image> ),
*
* wireframe: <boolean>,
* wireframeLinewidth: <float>,
*
* skinning: <bool>,
* morphTargets: <bool>,
* morphNormals: <bool>
* }
*/
function
MeshToonMaterial
(
parameters
)
{
Material
.
call
(
this
);
this
.
type
=
'
MeshToonMaterial
'
;
this
.
color
=
new
Color
(
0xffffff
);
// diffuse
this
.
specular
=
new
Color
(
0x111111
);
this
.
shininess
=
30
;
this
.
map
=
null
;
this
.
lightMap
=
null
;
this
.
lightMapIntensity
=
1.0
;
this
.
aoMap
=
null
;
this
.
aoMapIntensity
=
1.0
;
this
.
emissive
=
new
Color
(
0x000000
);
this
.
emissiveIntensity
=
1.0
;
this
.
emissiveMap
=
null
;
this
.
bumpMap
=
null
;
this
.
bumpScale
=
1
;
this
.
normalMap
=
null
;
this
.
normalScale
=
new
Vector2
(
1
,
1
);
this
.
displacementMap
=
null
;
this
.
displacementScale
=
1
;
this
.
displacementBias
=
0
;
this
.
specularMap
=
null
;
this
.
alphaMap
=
null
;
this
.
envMap
=
null
;
this
.
combine
=
MultiplyOperation
;
this
.
reflectivity
=
1
;
this
.
refractionRatio
=
0.98
;
this
.
gradientMap
=
null
;
this
.
wireframe
=
false
;
this
.
wireframeLinewidth
=
1
;
this
.
wireframeLinecap
=
'
round
'
;
this
.
wireframeLinejoin
=
'
round
'
;
this
.
skinning
=
false
;
this
.
morphTargets
=
false
;
this
.
morphNormals
=
false
;
this
.
setValues
(
parameters
);
}
MeshToonMaterial
.
prototype
=
Object
.
create
(
Material
.
prototype
);
MeshToonMaterial
.
prototype
.
constructor
=
MeshToonMaterial
;
MeshToonMaterial
.
prototype
.
isMeshToonMaterial
=
true
;
MeshToonMaterial
.
prototype
.
copy
=
function
(
source
)
{
Material
.
prototype
.
copy
.
call
(
this
,
source
);
this
.
color
.
copy
(
source
.
color
);
this
.
specular
.
copy
(
source
.
specular
);
this
.
shininess
=
source
.
shininess
;
this
.
map
=
source
.
map
;
this
.
lightMap
=
source
.
lightMap
;
this
.
lightMapIntensity
=
source
.
lightMapIntensity
;
this
.
aoMap
=
source
.
aoMap
;
this
.
aoMapIntensity
=
source
.
aoMapIntensity
;
this
.
emissive
.
copy
(
source
.
emissive
);
this
.
emissiveMap
=
source
.
emissiveMap
;
this
.
emissiveIntensity
=
source
.
emissiveIntensity
;
this
.
bumpMap
=
source
.
bumpMap
;
this
.
bumpScale
=
source
.
bumpScale
;
this
.
normalMap
=
source
.
normalMap
;
this
.
normalScale
.
copy
(
source
.
normalScale
);
this
.
displacementMap
=
source
.
displacementMap
;
this
.
displacementScale
=
source
.
displacementScale
;
this
.
displacementBias
=
source
.
displacementBias
;
this
.
specularMap
=
source
.
specularMap
;
this
.
alphaMap
=
source
.
alphaMap
;
this
.
envMap
=
source
.
envMap
;
this
.
combine
=
source
.
combine
;
this
.
reflectivity
=
source
.
reflectivity
;
this
.
refractionRatio
=
source
.
refractionRatio
;
this
.
wireframe
=
source
.
wireframe
;
this
.
wireframeLinewidth
=
source
.
wireframeLinewidth
;
this
.
wireframeLinecap
=
source
.
wireframeLinecap
;
this
.
wireframeLinejoin
=
source
.
wireframeLinejoin
;
this
.
skinning
=
source
.
skinning
;
this
.
morphTargets
=
source
.
morphTargets
;
this
.
morphNormals
=
source
.
morphNormals
;
return
this
;
};
export
{
MeshToonMaterial
};
src/renderers/shaders/ShaderLib/meshtoon_frag.glsl
0 → 100644
浏览文件 @
15544dfa
#define TOON
uniform
vec3
diffuse
;
uniform
vec3
emissive
;
uniform
vec3
specular
;
uniform
float
shininess
;
uniform
float
opacity
;
#include <common>
#include <packing>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void
main
()
{
#include <clipping_planes_fragment>
vec4
diffuseColor
=
vec4
(
diffuse
,
opacity
);
ReflectedLight
reflectedLight
=
ReflectedLight
(
vec3
(
0
.
0
),
vec3
(
0
.
0
),
vec3
(
0
.
0
),
vec3
(
0
.
0
)
);
vec3
totalEmissiveRadiance
=
emissive
;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
#include <normal_flip>
#include <normal_fragment>
#include <emissivemap_fragment>
// accumulation
#include <lights_phong_fragment>
#include <lights_template>
// modulation
#include <aomap_fragment>
vec3
outgoingLight
=
reflectedLight
.
directDiffuse
+
reflectedLight
.
indirectDiffuse
+
reflectedLight
.
directSpecular
+
reflectedLight
.
indirectSpecular
+
totalEmissiveRadiance
;
#include <envmap_fragment>
gl_FragColor
=
vec4
(
outgoingLight
,
diffuseColor
.
a
);
#include <premultiplied_alpha_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
}
src/renderers/shaders/ShaderLib/meshtoon_vert.glsl
0 → 100644
浏览文件 @
15544dfa
#define TOON
varying
vec3
vViewPosition
;
#ifndef FLAT_SHADED
varying
vec3
vNormal
;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void
main
()
{
#include <uv_vertex>
#include <uv2_vertex>
#include <color_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
vNormal
=
normalize
(
transformedNormal
);
#endif
#include <begin_vertex>
#include <displacementmap_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition
=
-
mvPosition
.
xyz
;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录