Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
6e89128f
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,发现更多精彩内容 >>
未验证
提交
6e89128f
编写于
6月 16, 2018
作者:
M
Mr.doob
提交者:
GitHub
6月 16, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14239 from WestLangley/dev-object_space_normal_map
Support object-space normal maps
上级
0be64f57
e5f809a6
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
88 addition
and
27 deletion
+88
-27
docs/api/materials/MeshPhongMaterial.html
docs/api/materials/MeshPhongMaterial.html
+7
-0
docs/api/materials/MeshStandardMaterial.html
docs/api/materials/MeshStandardMaterial.html
+7
-0
src/constants.js
src/constants.js
+2
-0
src/materials/Material.js
src/materials/Material.js
+2
-1
src/materials/MeshNormalMaterial.js
src/materials/MeshNormalMaterial.js
+4
-0
src/materials/MeshPhongMaterial.js
src/materials/MeshPhongMaterial.js
+4
-1
src/materials/MeshStandardMaterial.js
src/materials/MeshStandardMaterial.js
+4
-0
src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl
src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl
+23
-1
src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl
...enderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl
+26
-18
src/renderers/shaders/ShaderLib/normal_frag.glsl
src/renderers/shaders/ShaderLib/normal_frag.glsl
+1
-1
src/renderers/shaders/ShaderLib/normal_vert.glsl
src/renderers/shaders/ShaderLib/normal_vert.glsl
+2
-2
src/renderers/webgl/WebGLProgram.js
src/renderers/webgl/WebGLProgram.js
+3
-1
src/renderers/webgl/WebGLPrograms.js
src/renderers/webgl/WebGLPrograms.js
+3
-2
未找到文件。
docs/api/materials/MeshPhongMaterial.html
浏览文件 @
6e89128f
...
@@ -178,6 +178,13 @@
...
@@ -178,6 +178,13 @@
the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting.
the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting.
</p>
</p>
<h3>
[property:Integer normalMapType]
</h3>
<p>
The type of normal map.
<br
/><br
/>
Options are [page:constant THREE.TangentSpaceNormalMap] (default), and [page:constant THREE.ObjectSpaceNormalMap].
</p>
<h3>
[property:Vector2 normalScale]
</h3>
<h3>
[property:Vector2 normalScale]
</h3>
<p>
<p>
How much the normal map affects the material. Typical ranges are 0-1.
How much the normal map affects the material. Typical ranges are 0-1.
...
...
docs/api/materials/MeshStandardMaterial.html
浏览文件 @
6e89128f
...
@@ -220,6 +220,13 @@
...
@@ -220,6 +220,13 @@
the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting.
the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting.
</p>
</p>
<h3>
[property:Integer normalMapType]
</h3>
<p>
The type of normal map.
<br
/><br
/>
Options are [page:constant THREE.TangentSpaceNormalMap] (default), and [page:constant THREE.ObjectSpaceNormalMap].
</p>
<h3>
[property:Vector2 normalScale]
</h3>
<h3>
[property:Vector2 normalScale]
</h3>
<p>
<p>
How much the normal map affects the material. Typical ranges are 0-1.
How much the normal map affects the material. Typical ranges are 0-1.
...
...
src/constants.js
浏览文件 @
6e89128f
...
@@ -137,3 +137,5 @@ export var RGBM16Encoding = 3005;
...
@@ -137,3 +137,5 @@ export var RGBM16Encoding = 3005;
export
var
RGBDEncoding
=
3006
;
export
var
RGBDEncoding
=
3006
;
export
var
BasicDepthPacking
=
3200
;
export
var
BasicDepthPacking
=
3200
;
export
var
RGBADepthPacking
=
3201
;
export
var
RGBADepthPacking
=
3201
;
export
var
TangentSpaceNormalMap
=
0
;
export
var
ObjectSpaceNormalMap
=
1
;
src/materials/Material.js
浏览文件 @
6e89128f
import
{
EventDispatcher
}
from
'
../core/EventDispatcher.js
'
;
import
{
EventDispatcher
}
from
'
../core/EventDispatcher.js
'
;
import
{
NoColors
,
FrontSide
,
FlatShading
,
NormalBlending
,
LessEqualDepth
,
AddEquation
,
OneMinusSrcAlphaFactor
,
SrcAlphaFactor
}
from
'
../constants.js
'
;
import
{
NoColors
,
FrontSide
,
FlatShading
,
NormalBlending
,
LessEqualDepth
,
AddEquation
,
OneMinusSrcAlphaFactor
,
SrcAlphaFactor
,
TangentSpaceNormalMap
}
from
'
../constants.js
'
;
import
{
_Math
}
from
'
../math/Math.js
'
;
import
{
_Math
}
from
'
../math/Math.js
'
;
/**
/**
...
@@ -194,6 +194,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -194,6 +194,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
if
(
this
.
normalMap
&&
this
.
normalMap
.
isTexture
)
{
if
(
this
.
normalMap
&&
this
.
normalMap
.
isTexture
)
{
data
.
normalMap
=
this
.
normalMap
.
toJSON
(
meta
).
uuid
;
data
.
normalMap
=
this
.
normalMap
.
toJSON
(
meta
).
uuid
;
if
(
this
.
normalMapType
!==
TangentSpaceNormalMap
)
data
.
normalMapType
=
this
.
normalMapType
;
data
.
normalScale
=
this
.
normalScale
.
toArray
();
data
.
normalScale
=
this
.
normalScale
.
toArray
();
}
}
...
...
src/materials/MeshNormalMaterial.js
浏览文件 @
6e89128f
import
{
TangentSpaceNormalMap
}
from
'
../constants.js
'
;
import
{
Material
}
from
'
./Material.js
'
;
import
{
Material
}
from
'
./Material.js
'
;
import
{
Vector2
}
from
'
../math/Vector2.js
'
;
import
{
Vector2
}
from
'
../math/Vector2.js
'
;
...
@@ -12,6 +13,7 @@ import { Vector2 } from '../math/Vector2.js';
...
@@ -12,6 +13,7 @@ import { Vector2 } from '../math/Vector2.js';
* bumpScale: <float>,
* bumpScale: <float>,
*
*
* normalMap: new THREE.Texture( <Image> ),
* normalMap: new THREE.Texture( <Image> ),
* normalMapType: THREE.TangentSpaceNormalMap,
* normalScale: <Vector2>,
* normalScale: <Vector2>,
*
*
* displacementMap: new THREE.Texture( <Image> ),
* displacementMap: new THREE.Texture( <Image> ),
...
@@ -37,6 +39,7 @@ function MeshNormalMaterial( parameters ) {
...
@@ -37,6 +39,7 @@ function MeshNormalMaterial( parameters ) {
this
.
bumpScale
=
1
;
this
.
bumpScale
=
1
;
this
.
normalMap
=
null
;
this
.
normalMap
=
null
;
this
.
normalMapType
=
TangentSpaceNormalMap
;
this
.
normalScale
=
new
Vector2
(
1
,
1
);
this
.
normalScale
=
new
Vector2
(
1
,
1
);
this
.
displacementMap
=
null
;
this
.
displacementMap
=
null
;
...
@@ -70,6 +73,7 @@ MeshNormalMaterial.prototype.copy = function ( source ) {
...
@@ -70,6 +73,7 @@ MeshNormalMaterial.prototype.copy = function ( source ) {
this
.
bumpScale
=
source
.
bumpScale
;
this
.
bumpScale
=
source
.
bumpScale
;
this
.
normalMap
=
source
.
normalMap
;
this
.
normalMap
=
source
.
normalMap
;
this
.
normalMapType
=
source
.
normalMapType
;
this
.
normalScale
.
copy
(
source
.
normalScale
);
this
.
normalScale
.
copy
(
source
.
normalScale
);
this
.
displacementMap
=
source
.
displacementMap
;
this
.
displacementMap
=
source
.
displacementMap
;
...
...
src/materials/MeshPhongMaterial.js
浏览文件 @
6e89128f
import
{
MultiplyOperation
,
TangentSpaceNormalMap
}
from
'
../constants.js
'
;
import
{
Material
}
from
'
./Material.js
'
;
import
{
Material
}
from
'
./Material.js
'
;
import
{
MultiplyOperation
}
from
'
../constants.js
'
;
import
{
Vector2
}
from
'
../math/Vector2.js
'
;
import
{
Vector2
}
from
'
../math/Vector2.js
'
;
import
{
Color
}
from
'
../math/Color.js
'
;
import
{
Color
}
from
'
../math/Color.js
'
;
...
@@ -29,6 +29,7 @@ import { Color } from '../math/Color.js';
...
@@ -29,6 +29,7 @@ import { Color } from '../math/Color.js';
* bumpScale: <float>,
* bumpScale: <float>,
*
*
* normalMap: new THREE.Texture( <Image> ),
* normalMap: new THREE.Texture( <Image> ),
* normalMapType: THREE.TangentSpaceNormalMap,
* normalScale: <Vector2>,
* normalScale: <Vector2>,
*
*
* displacementMap: new THREE.Texture( <Image> ),
* displacementMap: new THREE.Texture( <Image> ),
...
@@ -79,6 +80,7 @@ function MeshPhongMaterial( parameters ) {
...
@@ -79,6 +80,7 @@ function MeshPhongMaterial( parameters ) {
this
.
bumpScale
=
1
;
this
.
bumpScale
=
1
;
this
.
normalMap
=
null
;
this
.
normalMap
=
null
;
this
.
normalMapType
=
TangentSpaceNormalMap
;
this
.
normalScale
=
new
Vector2
(
1
,
1
);
this
.
normalScale
=
new
Vector2
(
1
,
1
);
this
.
displacementMap
=
null
;
this
.
displacementMap
=
null
;
...
@@ -136,6 +138,7 @@ MeshPhongMaterial.prototype.copy = function ( source ) {
...
@@ -136,6 +138,7 @@ MeshPhongMaterial.prototype.copy = function ( source ) {
this
.
bumpScale
=
source
.
bumpScale
;
this
.
bumpScale
=
source
.
bumpScale
;
this
.
normalMap
=
source
.
normalMap
;
this
.
normalMap
=
source
.
normalMap
;
this
.
normalMapType
=
source
.
normalMapType
;
this
.
normalScale
.
copy
(
source
.
normalScale
);
this
.
normalScale
.
copy
(
source
.
normalScale
);
this
.
displacementMap
=
source
.
displacementMap
;
this
.
displacementMap
=
source
.
displacementMap
;
...
...
src/materials/MeshStandardMaterial.js
浏览文件 @
6e89128f
import
{
TangentSpaceNormalMap
}
from
'
../constants.js
'
;
import
{
Material
}
from
'
./Material.js
'
;
import
{
Material
}
from
'
./Material.js
'
;
import
{
Vector2
}
from
'
../math/Vector2.js
'
;
import
{
Vector2
}
from
'
../math/Vector2.js
'
;
import
{
Color
}
from
'
../math/Color.js
'
;
import
{
Color
}
from
'
../math/Color.js
'
;
...
@@ -27,6 +28,7 @@ import { Color } from '../math/Color.js';
...
@@ -27,6 +28,7 @@ import { Color } from '../math/Color.js';
* bumpScale: <float>,
* bumpScale: <float>,
*
*
* normalMap: new THREE.Texture( <Image> ),
* normalMap: new THREE.Texture( <Image> ),
* normalMapType: THREE.TangentSpaceNormalMap,
* normalScale: <Vector2>,
* normalScale: <Vector2>,
*
*
* displacementMap: new THREE.Texture( <Image> ),
* displacementMap: new THREE.Texture( <Image> ),
...
@@ -81,6 +83,7 @@ function MeshStandardMaterial( parameters ) {
...
@@ -81,6 +83,7 @@ function MeshStandardMaterial( parameters ) {
this
.
bumpScale
=
1
;
this
.
bumpScale
=
1
;
this
.
normalMap
=
null
;
this
.
normalMap
=
null
;
this
.
normalMapType
=
TangentSpaceNormalMap
;
this
.
normalScale
=
new
Vector2
(
1
,
1
);
this
.
normalScale
=
new
Vector2
(
1
,
1
);
this
.
displacementMap
=
null
;
this
.
displacementMap
=
null
;
...
@@ -142,6 +145,7 @@ MeshStandardMaterial.prototype.copy = function ( source ) {
...
@@ -142,6 +145,7 @@ MeshStandardMaterial.prototype.copy = function ( source ) {
this
.
bumpScale
=
source
.
bumpScale
;
this
.
bumpScale
=
source
.
bumpScale
;
this
.
normalMap
=
source
.
normalMap
;
this
.
normalMap
=
source
.
normalMap
;
this
.
normalMapType
=
source
.
normalMapType
;
this
.
normalScale
.
copy
(
source
.
normalScale
);
this
.
normalScale
.
copy
(
source
.
normalScale
);
this
.
displacementMap
=
source
.
displacementMap
;
this
.
displacementMap
=
source
.
displacementMap
;
...
...
src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl
浏览文件 @
6e89128f
#ifdef USE_NORMALMAP
#ifdef USE_NORMALMAP
normal
=
perturbNormal2Arb
(
-
vViewPosition
,
normal
);
#ifdef OBJECTSPACE_NORMALMAP
normal
=
texture2D
(
normalMap
,
vUv
).
xyz
*
2
.
0
-
1
.
0
;
// overrides both flatShading and attribute normals
#ifdef FLIP_SIDED
normal
=
-
normal
;
#endif
#ifdef DOUBLE_SIDED
normal
=
normal
*
(
float
(
gl_FrontFacing
)
*
2
.
0
-
1
.
0
);
#endif
normal
=
normalize
(
normalMatrix
*
normal
);
#else // tangent-space normal map
normal
=
perturbNormal2Arb
(
-
vViewPosition
,
normal
);
#endif
#elif defined( USE_BUMPMAP )
#elif defined( USE_BUMPMAP )
...
...
src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl
浏览文件 @
6e89128f
...
@@ -3,32 +3,40 @@
...
@@ -3,32 +3,40 @@
uniform
sampler2D
normalMap
;
uniform
sampler2D
normalMap
;
uniform
vec2
normalScale
;
uniform
vec2
normalScale
;
// Per-Pixel Tangent Space Normal Mapping
#ifdef OBJECTSPACE_NORMALMAP
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
vec3
perturbNormal2Arb
(
vec3
eye_pos
,
vec3
surf_norm
)
{
uniform
mat3
normalMatrix
;
// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
#else
vec3
q0
=
vec3
(
dFdx
(
eye_pos
.
x
),
dFdx
(
eye_pos
.
y
),
dFdx
(
eye_pos
.
z
)
);
// Per-Pixel Tangent Space Normal Mapping
vec3
q1
=
vec3
(
dFdy
(
eye_pos
.
x
),
dFdy
(
eye_pos
.
y
),
dFdy
(
eye_pos
.
z
)
);
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
vec2
st0
=
dFdx
(
vUv
.
st
);
vec2
st1
=
dFdy
(
vUv
.
st
);
float
scale
=
sign
(
st1
.
t
*
st0
.
s
-
st0
.
t
*
st1
.
s
);
// we do not care about the magnitude
vec3
perturbNormal2Arb
(
vec3
eye_pos
,
vec3
surf_norm
)
{
vec3
S
=
normalize
(
(
q0
*
st1
.
t
-
q1
*
st0
.
t
)
*
scale
);
// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
vec3
T
=
normalize
(
(
-
q0
*
st1
.
s
+
q1
*
st0
.
s
)
*
scale
);
vec3
N
=
normalize
(
surf_norm
);
mat3
tsn
=
mat3
(
S
,
T
,
N
);
vec3
mapN
=
texture2D
(
normalMap
,
vUv
).
xyz
*
2
.
0
-
1
.
0
;
vec3
q0
=
vec3
(
dFdx
(
eye_pos
.
x
),
dFdx
(
eye_pos
.
y
),
dFdx
(
eye_pos
.
z
)
);
vec3
q1
=
vec3
(
dFdy
(
eye_pos
.
x
),
dFdy
(
eye_pos
.
y
),
dFdy
(
eye_pos
.
z
)
);
vec2
st0
=
dFdx
(
vUv
.
st
);
vec2
st1
=
dFdy
(
vUv
.
st
);
mapN
.
xy
*=
normalScale
;
float
scale
=
sign
(
st1
.
t
*
st0
.
s
-
st0
.
t
*
st1
.
s
);
// we do not care about the magnitude
mapN
.
xy
*=
(
float
(
gl_FrontFacing
)
*
2
.
0
-
1
.
0
);
return
normalize
(
tsn
*
mapN
);
vec3
S
=
normalize
(
(
q0
*
st1
.
t
-
q1
*
st0
.
t
)
*
scale
);
vec3
T
=
normalize
(
(
-
q0
*
st1
.
s
+
q1
*
st0
.
s
)
*
scale
);
vec3
N
=
normalize
(
surf_norm
);
mat3
tsn
=
mat3
(
S
,
T
,
N
);
}
vec3
mapN
=
texture2D
(
normalMap
,
vUv
).
xyz
*
2
.
0
-
1
.
0
;
mapN
.
xy
*=
normalScale
;
mapN
.
xy
*=
(
float
(
gl_FrontFacing
)
*
2
.
0
-
1
.
0
);
return
normalize
(
tsn
*
mapN
);
}
#endif
#endif
#endif
src/renderers/shaders/ShaderLib/normal_frag.glsl
浏览文件 @
6e89128f
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
uniform
float
opacity
;
uniform
float
opacity
;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) ||
defined( USE_NORMALMAP
)
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) ||
( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP )
)
varying
vec3
vViewPosition
;
varying
vec3
vViewPosition
;
...
...
src/renderers/shaders/ShaderLib/normal_vert.glsl
浏览文件 @
6e89128f
#define NORMAL
#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) ||
defined( USE_NORMALMAP
)
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) ||
( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP )
)
varying
vec3
vViewPosition
;
varying
vec3
vViewPosition
;
...
@@ -41,7 +41,7 @@ void main() {
...
@@ -41,7 +41,7 @@ void main() {
#include <project_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <logdepthbuf_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) ||
defined( USE_NORMALMAP
)
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) ||
( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP )
)
vViewPosition
=
-
mvPosition
.
xyz
;
vViewPosition
=
-
mvPosition
.
xyz
;
...
...
src/renderers/webgl/WebGLProgram.js
浏览文件 @
6e89128f
...
@@ -84,7 +84,7 @@ function generateExtensions( extensions, parameters, rendererExtensions ) {
...
@@ -84,7 +84,7 @@ function generateExtensions( extensions, parameters, rendererExtensions ) {
extensions
=
extensions
||
{};
extensions
=
extensions
||
{};
var
chunks
=
[
var
chunks
=
[
(
extensions
.
derivatives
||
parameters
.
envMapCubeUV
||
parameters
.
bumpMap
||
parameters
.
normalMap
||
parameters
.
flatShading
)
?
'
#extension GL_OES_standard_derivatives : enable
'
:
''
,
(
extensions
.
derivatives
||
parameters
.
envMapCubeUV
||
parameters
.
bumpMap
||
(
parameters
.
normalMap
&&
!
parameters
.
objectSpaceNormalMap
)
||
parameters
.
flatShading
)
?
'
#extension GL_OES_standard_derivatives : enable
'
:
''
,
(
extensions
.
fragDepth
||
parameters
.
logarithmicDepthBuffer
)
&&
rendererExtensions
.
get
(
'
EXT_frag_depth
'
)
?
'
#extension GL_EXT_frag_depth : enable
'
:
''
,
(
extensions
.
fragDepth
||
parameters
.
logarithmicDepthBuffer
)
&&
rendererExtensions
.
get
(
'
EXT_frag_depth
'
)
?
'
#extension GL_EXT_frag_depth : enable
'
:
''
,
(
extensions
.
drawBuffers
)
&&
rendererExtensions
.
get
(
'
WEBGL_draw_buffers
'
)
?
'
#extension GL_EXT_draw_buffers : require
'
:
''
,
(
extensions
.
drawBuffers
)
&&
rendererExtensions
.
get
(
'
WEBGL_draw_buffers
'
)
?
'
#extension GL_EXT_draw_buffers : require
'
:
''
,
(
extensions
.
shaderTextureLOD
||
parameters
.
envMap
)
&&
rendererExtensions
.
get
(
'
EXT_shader_texture_lod
'
)
?
'
#extension GL_EXT_shader_texture_lod : enable
'
:
''
(
extensions
.
shaderTextureLOD
||
parameters
.
envMap
)
&&
rendererExtensions
.
get
(
'
EXT_shader_texture_lod
'
)
?
'
#extension GL_EXT_shader_texture_lod : enable
'
:
''
...
@@ -349,6 +349,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
...
@@ -349,6 +349,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
parameters
.
emissiveMap
?
'
#define USE_EMISSIVEMAP
'
:
''
,
parameters
.
emissiveMap
?
'
#define USE_EMISSIVEMAP
'
:
''
,
parameters
.
bumpMap
?
'
#define USE_BUMPMAP
'
:
''
,
parameters
.
bumpMap
?
'
#define USE_BUMPMAP
'
:
''
,
parameters
.
normalMap
?
'
#define USE_NORMALMAP
'
:
''
,
parameters
.
normalMap
?
'
#define USE_NORMALMAP
'
:
''
,
(
parameters
.
normalMap
&&
parameters
.
objectSpaceNormalMap
)
?
'
#define OBJECTSPACE_NORMALMAP
'
:
''
,
parameters
.
displacementMap
&&
parameters
.
supportsVertexTextures
?
'
#define USE_DISPLACEMENTMAP
'
:
''
,
parameters
.
displacementMap
&&
parameters
.
supportsVertexTextures
?
'
#define USE_DISPLACEMENTMAP
'
:
''
,
parameters
.
specularMap
?
'
#define USE_SPECULARMAP
'
:
''
,
parameters
.
specularMap
?
'
#define USE_SPECULARMAP
'
:
''
,
parameters
.
roughnessMap
?
'
#define USE_ROUGHNESSMAP
'
:
''
,
parameters
.
roughnessMap
?
'
#define USE_ROUGHNESSMAP
'
:
''
,
...
@@ -455,6 +456,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
...
@@ -455,6 +456,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
parameters
.
emissiveMap
?
'
#define USE_EMISSIVEMAP
'
:
''
,
parameters
.
emissiveMap
?
'
#define USE_EMISSIVEMAP
'
:
''
,
parameters
.
bumpMap
?
'
#define USE_BUMPMAP
'
:
''
,
parameters
.
bumpMap
?
'
#define USE_BUMPMAP
'
:
''
,
parameters
.
normalMap
?
'
#define USE_NORMALMAP
'
:
''
,
parameters
.
normalMap
?
'
#define USE_NORMALMAP
'
:
''
,
(
parameters
.
normalMap
&&
parameters
.
objectSpaceNormalMap
)
?
'
#define OBJECTSPACE_NORMALMAP
'
:
''
,
parameters
.
specularMap
?
'
#define USE_SPECULARMAP
'
:
''
,
parameters
.
specularMap
?
'
#define USE_SPECULARMAP
'
:
''
,
parameters
.
roughnessMap
?
'
#define USE_ROUGHNESSMAP
'
:
''
,
parameters
.
roughnessMap
?
'
#define USE_ROUGHNESSMAP
'
:
''
,
parameters
.
metalnessMap
?
'
#define USE_METALNESSMAP
'
:
''
,
parameters
.
metalnessMap
?
'
#define USE_METALNESSMAP
'
:
''
,
...
...
src/renderers/webgl/WebGLPrograms.js
浏览文件 @
6e89128f
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
*/
*/
import
{
BackSide
,
DoubleSide
,
CubeUVRefractionMapping
,
CubeUVReflectionMapping
,
GammaEncoding
,
LinearEncoding
}
from
'
../../constants.js
'
;
import
{
BackSide
,
DoubleSide
,
CubeUVRefractionMapping
,
CubeUVReflectionMapping
,
GammaEncoding
,
LinearEncoding
,
ObjectSpaceNormalMap
}
from
'
../../constants.js
'
;
import
{
WebGLProgram
}
from
'
./WebGLProgram.js
'
;
import
{
WebGLProgram
}
from
'
./WebGLProgram.js
'
;
function
WebGLPrograms
(
renderer
,
extensions
,
capabilities
)
{
function
WebGLPrograms
(
renderer
,
extensions
,
capabilities
)
{
...
@@ -27,7 +27,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
...
@@ -27,7 +27,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
var
parameterNames
=
[
var
parameterNames
=
[
"
precision
"
,
"
supportsVertexTextures
"
,
"
map
"
,
"
mapEncoding
"
,
"
envMap
"
,
"
envMapMode
"
,
"
envMapEncoding
"
,
"
precision
"
,
"
supportsVertexTextures
"
,
"
map
"
,
"
mapEncoding
"
,
"
envMap
"
,
"
envMapMode
"
,
"
envMapEncoding
"
,
"
lightMap
"
,
"
aoMap
"
,
"
emissiveMap
"
,
"
emissiveMapEncoding
"
,
"
bumpMap
"
,
"
normalMap
"
,
"
displacementMap
"
,
"
specularMap
"
,
"
lightMap
"
,
"
aoMap
"
,
"
emissiveMap
"
,
"
emissiveMapEncoding
"
,
"
bumpMap
"
,
"
normalMap
"
,
"
objectSpaceNormalMap
"
,
"
displacementMap
"
,
"
specularMap
"
,
"
roughnessMap
"
,
"
metalnessMap
"
,
"
gradientMap
"
,
"
roughnessMap
"
,
"
metalnessMap
"
,
"
gradientMap
"
,
"
alphaMap
"
,
"
combine
"
,
"
vertexColors
"
,
"
fog
"
,
"
useFog
"
,
"
fogExp
"
,
"
alphaMap
"
,
"
combine
"
,
"
vertexColors
"
,
"
fog
"
,
"
useFog
"
,
"
fogExp
"
,
"
flatShading
"
,
"
sizeAttenuation
"
,
"
logarithmicDepthBuffer
"
,
"
skinning
"
,
"
flatShading
"
,
"
sizeAttenuation
"
,
"
logarithmicDepthBuffer
"
,
"
skinning
"
,
...
@@ -148,6 +148,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
...
@@ -148,6 +148,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
emissiveMapEncoding
:
getTextureEncodingFromMap
(
material
.
emissiveMap
,
renderer
.
gammaInput
),
emissiveMapEncoding
:
getTextureEncodingFromMap
(
material
.
emissiveMap
,
renderer
.
gammaInput
),
bumpMap
:
!!
material
.
bumpMap
,
bumpMap
:
!!
material
.
bumpMap
,
normalMap
:
!!
material
.
normalMap
,
normalMap
:
!!
material
.
normalMap
,
objectSpaceNormalMap
:
material
.
normalMapType
===
ObjectSpaceNormalMap
,
displacementMap
:
!!
material
.
displacementMap
,
displacementMap
:
!!
material
.
displacementMap
,
roughnessMap
:
!!
material
.
roughnessMap
,
roughnessMap
:
!!
material
.
roughnessMap
,
metalnessMap
:
!!
material
.
metalnessMap
,
metalnessMap
:
!!
material
.
metalnessMap
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录