Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
f8df139d
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,发现更多精彩内容 >>
提交
f8df139d
编写于
11月 05, 2016
作者:
W
WestLangley
提交者:
Mr.doob
11月 05, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MeshBasicMaterial: Add support for lightMap (#9975)
上级
f1edcc01
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
43 addition
and
28 deletion
+43
-28
docs/api/materials/MeshBasicMaterial.html
docs/api/materials/MeshBasicMaterial.html
+10
-2
src/materials/MeshBasicMaterial.js
src/materials/MeshBasicMaterial.js
+9
-0
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+7
-21
src/renderers/shaders/ShaderLib.js
src/renderers/shaders/ShaderLib.js
+1
-0
src/renderers/shaders/ShaderLib/meshbasic_frag.glsl
src/renderers/shaders/ShaderLib/meshbasic_frag.glsl
+16
-5
未找到文件。
docs/api/materials/MeshBasicMaterial.html
浏览文件 @
f8df139d
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
/>
<meta
charset=
"utf-8"
/>
<base
href=
"../../"
/>
<script
src=
"list.js"
></script>
<script
src=
"page.js"
></script>
...
...
@@ -41,6 +41,8 @@
<div>
color — geometry color in hexadecimal. Default is 0xffffff.
<br
/>
map — Set texture map. Default is null
<br
/>
lightMap — Set light map. Default is null.
<br
/>
lightMapIntensity — Set light map intensity. Default is 1.
<br
/>
aoMap — Set ao map. Default is null.
<br
/>
aoMapIntensity — Set ao map intensity. Default is 1.
<br
/>
specularMap — Set specular map. Default is null.
<br
/>
...
...
@@ -71,11 +73,17 @@
Set texture map. Default is null.
</div>
<h3>
[property:Texture lightMap]
</h3>
<div>
Set light map. Default is null. The lightMap requires a second set of UVs.
</div>
<h3>
[property:Float lightMapIntensity]
</h3>
<div>
Intensity of the baked light. Default is 1.
</div>
<h3>
[property:Texture aoMap]
</h3>
<div>
Set ambient occlusion map. Default is null.
</div>
<h3>
[property:Float aoMapIntensity]
</h3>
<div>
TODO
</div>
<div>
Intensity of the ambient occlusion effect. Default is 1. Zero is no occlusion effect.
</div>
<h3>
[property:Texture specularMap]
</h3>
<div>
Set specular map. Default is null.
</div>
...
...
src/materials/MeshBasicMaterial.js
浏览文件 @
f8df139d
...
...
@@ -11,6 +11,9 @@ import { Color } from '../math/Color';
* opacity: <float>,
* map: new THREE.Texture( <Image> ),
*
* lightMap: new THREE.Texture( <Image> ),
* lightMapIntensity: <float>
*
* aoMap: new THREE.Texture( <Image> ),
* aoMapIntensity: <float>
*
...
...
@@ -45,6 +48,9 @@ function MeshBasicMaterial( parameters ) {
this
.
map
=
null
;
this
.
lightMap
=
null
;
this
.
lightMapIntensity
=
1.0
;
this
.
aoMap
=
null
;
this
.
aoMapIntensity
=
1.0
;
...
...
@@ -84,6 +90,9 @@ MeshBasicMaterial.prototype.copy = function ( source ) {
this
.
map
=
source
.
map
;
this
.
lightMap
=
source
.
lightMap
;
this
.
lightMapIntensity
=
source
.
lightMapIntensity
;
this
.
aoMap
=
source
.
aoMap
;
this
.
aoMapIntensity
=
source
.
aoMapIntensity
;
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
f8df139d
...
...
@@ -1945,6 +1945,13 @@ function WebGLRenderer( parameters ) {
uniforms
.
specularMap
.
value
=
material
.
specularMap
;
uniforms
.
alphaMap
.
value
=
material
.
alphaMap
;
if
(
material
.
lightMap
)
{
uniforms
.
lightMap
.
value
=
material
.
lightMap
;
uniforms
.
lightMapIntensity
.
value
=
material
.
lightMapIntensity
;
}
if
(
material
.
aoMap
)
{
uniforms
.
aoMap
.
value
=
material
.
aoMap
;
...
...
@@ -2083,13 +2090,6 @@ function WebGLRenderer( parameters ) {
function
refreshUniformsLambert
(
uniforms
,
material
)
{
if
(
material
.
lightMap
)
{
uniforms
.
lightMap
.
value
=
material
.
lightMap
;
uniforms
.
lightMapIntensity
.
value
=
material
.
lightMapIntensity
;
}
if
(
material
.
emissiveMap
)
{
uniforms
.
emissiveMap
.
value
=
material
.
emissiveMap
;
...
...
@@ -2103,13 +2103,6 @@ function WebGLRenderer( parameters ) {
uniforms
.
specular
.
value
=
material
.
specular
;
uniforms
.
shininess
.
value
=
Math
.
max
(
material
.
shininess
,
1
e
-
4
);
// to prevent pow( 0.0, 0.0 )
if
(
material
.
lightMap
)
{
uniforms
.
lightMap
.
value
=
material
.
lightMap
;
uniforms
.
lightMapIntensity
.
value
=
material
.
lightMapIntensity
;
}
if
(
material
.
emissiveMap
)
{
uniforms
.
emissiveMap
.
value
=
material
.
emissiveMap
;
...
...
@@ -2157,13 +2150,6 @@ function WebGLRenderer( parameters ) {
}
if
(
material
.
lightMap
)
{
uniforms
.
lightMap
.
value
=
material
.
lightMap
;
uniforms
.
lightMapIntensity
.
value
=
material
.
lightMapIntensity
;
}
if
(
material
.
emissiveMap
)
{
uniforms
.
emissiveMap
.
value
=
material
.
emissiveMap
;
...
...
src/renderers/shaders/ShaderLib.js
浏览文件 @
f8df139d
...
...
@@ -16,6 +16,7 @@ var ShaderLib = {
uniforms
:
Object
.
assign
(
{},
UniformsLib
.
common
,
UniformsLib
.
aomap
,
UniformsLib
.
lightmap
,
UniformsLib
.
fog
),
...
...
src/renderers/shaders/ShaderLib/meshbasic_frag.glsl
浏览文件 @
f8df139d
...
...
@@ -14,6 +14,7 @@ uniform float opacity;
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
...
...
@@ -33,14 +34,24 @@ void main() {
#include <alphatest_fragment>
#include <specularmap_fragment>
ReflectedLight
reflectedLight
;
reflectedLight
.
directDiffuse
=
vec3
(
0
.
0
);
reflectedLight
.
directSpecular
=
vec3
(
0
.
0
);
reflectedLight
.
indirectDiffuse
=
diffuseColor
.
rgb
;
reflectedLight
.
indirectSpecular
=
vec3
(
0
.
0
);
ReflectedLight
reflectedLight
=
ReflectedLight
(
vec3
(
0
.
0
),
vec3
(
0
.
0
),
vec3
(
0
.
0
),
vec3
(
0
.
0
)
);
// accumulation (baked indirect lighting only)
#ifdef USE_LIGHTMAP
reflectedLight
.
indirectDiffuse
+=
texture2D
(
lightMap
,
vUv2
).
xyz
*
lightMapIntensity
;
#else
reflectedLight
.
indirectDiffuse
+=
vec3
(
1
.
0
);
#endif
// modulation
#include <aomap_fragment>
reflectedLight
.
indirectDiffuse
*=
diffuseColor
.
rgb
;
vec3
outgoingLight
=
reflectedLight
.
indirectDiffuse
;
#include <normal_flip>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录