Skip to content

Commit d6ee54b

Browse files
committed
WebGLRenderer: MAX_ to NUM_. See 8c82186.
1 parent ad22822 commit d6ee54b

9 files changed

Lines changed: 58 additions & 58 deletions

File tree

examples/js/ShaderSkin.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ THREE.ShaderSkin = {
170170
"vec3 totalSpecularLight = vec3( 0.0 );",
171171
"vec3 totalDiffuseLight = vec3( 0.0 );",
172172

173-
"#if POINT_LIGHTS > 0",
173+
"#if NUM_POINT_LIGHTS > 0",
174174

175-
"for ( int i = 0; i < POINT_LIGHTS; i ++ ) {",
175+
"for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {",
176176

177177
"vec3 lVector = pointLights[ i ].position + vViewPosition.xyz;",
178178

@@ -195,9 +195,9 @@ THREE.ShaderSkin = {
195195

196196
// directional lights
197197

198-
"#if DIR_LIGHTS > 0",
198+
"#if NUM_DIR_LIGHTS > 0",
199199

200-
"for( int i = 0; i < DIR_LIGHTS; i++ ) {",
200+
"for( int i = 0; i < NUM_DIR_LIGHTS; i++ ) {",
201201

202202
"vec3 dirVector = directionalLights[ i ].direction;",
203203

@@ -216,9 +216,9 @@ THREE.ShaderSkin = {
216216

217217
// hemisphere lights
218218

219-
"#if HEMI_LIGHTS > 0",
219+
"#if NUM_HEMI_LIGHTS > 0",
220220

221-
"for ( int i = 0; i < HEMI_LIGHTS; i ++ ) {",
221+
"for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {",
222222

223223
"vec3 lVector = hemisphereLightDirection[ i ];",
224224

@@ -452,9 +452,9 @@ THREE.ShaderSkin = {
452452
"vec3 totalDiffuseLight = vec3( 0.0 );",
453453
"vec3 totalSpecularLight = vec3( 0.0 );",
454454

455-
"#if POINT_LIGHTS > 0",
455+
"#if NUM_POINT_LIGHTS > 0",
456456

457-
"for ( int i = 0; i < POINT_LIGHTS; i ++ ) {",
457+
"for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {",
458458

459459
"vec3 pointVector = normalize( pointLights[ i ].direction );",
460460
"float attenuation = calcLightAttenuation( length( lVector ), pointLights[ i ].distance, pointLights[ i ].decay );",
@@ -477,9 +477,9 @@ THREE.ShaderSkin = {
477477

478478
// directional lights
479479

480-
"#if DIR_LIGHTS > 0",
480+
"#if NUM_DIR_LIGHTS > 0",
481481

482-
"for( int i = 0; i < DIR_LIGHTS; i++ ) {",
482+
"for( int i = 0; i < NUM_DIR_LIGHTS; i++ ) {",
483483

484484
"vec3 dirVector = directionalLights[ i ].direction;",
485485

examples/js/ShaderTerrain.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ THREE.ShaderTerrain = {
142142

143143
// point lights
144144

145-
"#if POINT_LIGHTS > 0",
145+
"#if NUM_POINT_LIGHTS > 0",
146146

147-
"for ( int i = 0; i < POINT_LIGHTS; i ++ ) {",
147+
"for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {",
148148

149149
"vec3 lVector = pointLights[ i ].position + vViewPosition.xyz;",
150150

@@ -168,12 +168,12 @@ THREE.ShaderTerrain = {
168168

169169
// directional lights
170170

171-
"#if DIR_LIGHTS > 0",
171+
"#if NUM_DIR_LIGHTS > 0",
172172

173173
"vec3 dirDiffuse = vec3( 0.0 );",
174174
"vec3 dirSpecular = vec3( 0.0 );",
175175

176-
"for( int i = 0; i < DIR_LIGHTS; i++ ) {",
176+
"for( int i = 0; i < NUM_DIR_LIGHTS; i++ ) {",
177177

178178
"vec3 dirVector = directionalLights[ i ].direction;",
179179
"vec3 dirHalfVector = normalize( dirVector + viewPosition );",
@@ -192,12 +192,12 @@ THREE.ShaderTerrain = {
192192

193193
// hemisphere lights
194194

195-
"#if HEMI_LIGHTS > 0",
195+
"#if NUM_HEMI_LIGHTS > 0",
196196

197197
"vec3 hemiDiffuse = vec3( 0.0 );",
198198
"vec3 hemiSpecular = vec3( 0.0 );",
199199

200-
"for( int i = 0; i < HEMI_LIGHTS; i ++ ) {",
200+
"for( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {",
201201

202202
"vec3 lVector = hemisphereLightDirection[ i ];",
203203

examples/webgl_shaders_tonemapping.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@
166166
"void main() {",
167167
"vec3 normal = normalize( -vNormal );",
168168
"vec3 viewPosition = normalize( vViewPosition );",
169-
"#if DIR_LIGHTS > 0",
169+
"#if NUM_DIR_LIGHTS > 0",
170170

171171
"vec3 dirDiffuse = vec3( 0.0 );",
172172

173-
"for( int i = 0; i < DIR_LIGHTS; i ++ ) {",
173+
"for( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {",
174174

175175
"vec4 lDirection = viewMatrix * vec4( directionalLights[i].direction, 0.0 );",
176176
"vec3 dirVector = normalize( lDirection.xyz );",

src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ vLightFront = vec3( 0.0 );
99
vLightBack = vec3( 0.0 );
1010
#endif
1111

12-
#if POINT_LIGHTS > 0
12+
#if NUM_POINT_LIGHTS > 0
1313

14-
for ( int i = 0; i < POINT_LIGHTS; i ++ ) {
14+
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1515

1616
IncidentLight directLight = getPointDirectLight( pointLights[ i ], geometry );
1717

@@ -30,9 +30,9 @@ vLightFront = vec3( 0.0 );
3030

3131
#endif
3232

33-
#if SPOT_LIGHTS > 0
33+
#if NUM_SPOT_LIGHTS > 0
3434

35-
for ( int i = 0; i < SPOT_LIGHTS; i ++ ) {
35+
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
3636

3737
IncidentLight directLight = getSpotDirectLight( spotLights[ i ], geometry );
3838

@@ -50,9 +50,9 @@ vLightFront = vec3( 0.0 );
5050

5151
#endif
5252

53-
#if DIR_LIGHTS > 0
53+
#if NUM_DIR_LIGHTS > 0
5454

55-
for ( int i = 0; i < DIR_LIGHTS; i ++ ) {
55+
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
5656

5757
IncidentLight directLight = getDirectionalDirectLight( directionalLights[ i ], geometry );
5858

@@ -81,9 +81,9 @@ vLightFront = vec3( 0.0 );
8181

8282
#endif
8383

84-
#if HEMI_LIGHTS > 0
84+
#if NUM_HEMI_LIGHTS > 0
8585

86-
for ( int i = 0; i < HEMI_LIGHTS; i ++ ) {
86+
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
8787

8888
vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
8989

src/renderers/shaders/ShaderChunk/lights_pars.glsl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
77

88
}
99

10-
#if DIR_LIGHTS > 0
10+
#if NUM_DIR_LIGHTS > 0
1111

1212
struct DirectionalLight {
1313
vec3 direction;
1414
vec3 color;
1515
};
1616

17-
uniform DirectionalLight directionalLights[ DIR_LIGHTS ];
17+
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
1818

1919
IncidentLight getDirectionalDirectLight( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {
2020

@@ -29,7 +29,7 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
2929
#endif
3030

3131

32-
#if POINT_LIGHTS > 0
32+
#if NUM_POINT_LIGHTS > 0
3333

3434
struct PointLight {
3535
vec3 position;
@@ -38,7 +38,7 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
3838
float decay;
3939
};
4040

41-
uniform PointLight pointLights[ POINT_LIGHTS ];
41+
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
4242

4343
IncidentLight getPointDirectLight( const in PointLight pointLight, const in GeometricContext geometry ) {
4444

@@ -56,7 +56,7 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
5656
#endif
5757

5858

59-
#if SPOT_LIGHTS > 0
59+
#if NUM_SPOT_LIGHTS > 0
6060

6161
struct SpotLight {
6262
vec3 position;
@@ -68,7 +68,7 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
6868
float exponent;
6969
};
7070

71-
uniform SpotLight spotLights[ SPOT_LIGHTS ];
71+
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
7272

7373
IncidentLight getSpotDirectLight( const in SpotLight spotLight, const in GeometricContext geometry ) {
7474

@@ -100,15 +100,15 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
100100
#endif
101101

102102

103-
#if HEMI_LIGHTS > 0
103+
#if NUM_HEMI_LIGHTS > 0
104104

105105
struct HemisphereLight {
106106
vec3 direction;
107107
vec3 skyColor;
108108
vec3 groundColor;
109109
};
110110

111-
uniform HemisphereLight hemisphereLights[ HEMI_LIGHTS ];
111+
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
112112

113113
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
114114

src/renderers/shaders/ShaderChunk/lights_phong_pars_vertex.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
#endif
66

7-
#if POINT_LIGHTS > 0
7+
#if NUM_POINT_LIGHTS > 0
88

9-
uniform vec3 pointLightPosition[ POINT_LIGHTS ];
9+
uniform vec3 pointLightPosition[ NUM_POINT_LIGHTS ];
1010

1111
#endif

src/renderers/shaders/ShaderChunk/lights_template.glsl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
GeometricContext geometry = GeometricContext( -vViewPosition, normalize( normal ), normalize(vViewPosition ) );
1717

18-
#if ( POINT_LIGHTS > 0 ) && defined( Material_RE_DirectLight )
18+
#if ( NUM_POINT_LIGHTS > 0 ) && defined( Material_RE_DirectLight )
1919

20-
for ( int i = 0; i < POINT_LIGHTS; i ++ ) {
20+
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
2121

2222
IncidentLight directLight = getPointDirectLight( pointLights[ i ], geometry );
2323

@@ -27,9 +27,9 @@ GeometricContext geometry = GeometricContext( -vViewPosition, normalize( normal
2727

2828
#endif
2929

30-
#if ( SPOT_LIGHTS > 0 ) && defined( Material_RE_DirectLight )
30+
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( Material_RE_DirectLight )
3131

32-
for ( int i = 0; i < SPOT_LIGHTS; i ++ ) {
32+
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
3333

3434
IncidentLight directLight = getSpotDirectLight( spotLights[ i ], geometry );
3535

@@ -39,9 +39,9 @@ GeometricContext geometry = GeometricContext( -vViewPosition, normalize( normal
3939

4040
#endif
4141

42-
#if ( DIR_LIGHTS > 0 ) && defined( Material_RE_DirectLight )
42+
#if ( NUM_DIR_LIGHTS > 0 ) && defined( Material_RE_DirectLight )
4343

44-
for ( int i = 0; i < DIR_LIGHTS; i ++ ) {
44+
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
4545

4646
IncidentLight directLight = getDirectionalDirectLight( directionalLights[ i ], geometry );
4747

@@ -63,9 +63,9 @@ GeometricContext geometry = GeometricContext( -vViewPosition, normalize( normal
6363

6464
#endif
6565

66-
#if ( HEMI_LIGHTS > 0 )
66+
#if ( NUM_HEMI_LIGHTS > 0 )
6767

68-
for ( int i = 0; i < HEMI_LIGHTS; i ++ ) {
68+
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
6969

7070
indirectDiffuseIrradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
7171

src/renderers/webgl/WebGLProgram.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ THREE.WebGLProgram = ( function () {
245245
renderer.gammaOutput ? '#define GAMMA_OUTPUT' : '',
246246
'#define GAMMA_FACTOR ' + gammaFactorDefine,
247247

248-
'#define DIR_LIGHTS ' + parameters.dirLights,
249-
'#define POINT_LIGHTS ' + parameters.pointLights,
250-
'#define SPOT_LIGHTS ' + parameters.spotLights,
251-
'#define HEMI_LIGHTS ' + parameters.hemiLights,
248+
'#define NUM_DIR_LIGHTS ' + parameters.numDirLights,
249+
'#define NUM_POINT_LIGHTS ' + parameters.numPointLights,
250+
'#define NUM_SPOT_LIGHTS ' + parameters.numSpotLights,
251+
'#define NUM_HEMI_LIGHTS ' + parameters.numHemiLights,
252252

253253
'#define MAX_SHADOWS ' + parameters.maxShadows,
254254

@@ -356,10 +356,10 @@ THREE.WebGLProgram = ( function () {
356356

357357
customDefines,
358358

359-
'#define DIR_LIGHTS ' + parameters.dirLights,
360-
'#define POINT_LIGHTS ' + parameters.pointLights,
361-
'#define SPOT_LIGHTS ' + parameters.spotLights,
362-
'#define HEMI_LIGHTS ' + parameters.hemiLights,
359+
'#define NUM_DIR_LIGHTS ' + parameters.numDirLights,
360+
'#define NUM_POINT_LIGHTS ' + parameters.numPointLights,
361+
'#define NUM_SPOT_LIGHTS ' + parameters.numSpotLights,
362+
'#define NUM_HEMI_LIGHTS ' + parameters.numHemiLights,
363363

364364
'#define MAX_SHADOWS ' + parameters.maxShadows,
365365

src/renderers/webgl/WebGLPrograms.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ THREE.WebGLPrograms = function ( renderer, capabilities ) {
2121
"alphaMap", "combine", "vertexColors", "fog", "useFog", "fogExp",
2222
"flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning",
2323
"maxBones", "useVertexTexture", "morphTargets", "morphNormals",
24-
"maxMorphTargets", "maxMorphNormals", "dirLights", "pointLights",
25-
"spotLights", "hemiLights", "maxShadows", "shadowMapEnabled", "pointLightShadows",
24+
"maxMorphTargets", "maxMorphNormals", "numDirLights", "numPointLights",
25+
"numSpotLights", "numHemiLights", "maxShadows", "shadowMapEnabled", "pointLightShadows",
2626
"shadowMapType", "shadowMapDebug", "alphaTest", "doubleSided",
2727
"flipSided"
2828
];
@@ -131,10 +131,10 @@ THREE.WebGLPrograms = function ( renderer, capabilities ) {
131131
maxMorphTargets: renderer.maxMorphTargets,
132132
maxMorphNormals: renderer.maxMorphNormals,
133133

134-
dirLights: lights.directional.length,
135-
pointLights: lights.point.length,
136-
spotLights: lights.spot.length,
137-
hemiLights: lights.hemi.length,
134+
numDirLights: lights.directional.length,
135+
numPointLights: lights.point.length,
136+
numSpotLights: lights.spot.length,
137+
numHemiLights: lights.hemi.length,
138138

139139
maxShadows: lights.shadows,
140140
pointLightShadows: lights.shadowsPointLight,

0 commit comments

Comments
 (0)