Skip to content

Commit 088a2ee

Browse files
committed
cleanup
1 parent 69cb2f7 commit 088a2ee

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/renderers/WebGLRenderer.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,8 +1478,8 @@ function WebGLRenderer( parameters ) {
14781478
UniformsUtils.merge( [ UniformsUtils.clone( shader.uniforms ), material.shaderUniforms ] ) :
14791479
UniformsUtils.clone( shader.uniforms );
14801480

1481-
var shaderUniformsGLSLFrag = ''; //collect the GLSL in here
1482-
var shaderUniformsGLSLVert = ''; //collect the GLSL in here
1481+
var shaderUniformsGLSLFrag = '';
1482+
var shaderUniformsGLSLVert = '';
14831483

14841484
for ( var uniformName in material.shaderUniforms ) {
14851485

@@ -1489,12 +1489,17 @@ function WebGLRenderer( parameters ) {
14891489

14901490
if ( type ) {
14911491

1492-
if ( stage === 'vertex' ) { //dunno what to do here, maybe if not provided should inject into both
1492+
if ( stage === 'vertex' ) {
14931493

14941494
shaderUniformsGLSLVert += 'uniform ' + type + ' ' + uniformName + ';\n';
14951495

1496+
} else if ( stage === 'fragment' ) {
1497+
1498+
shaderUniformsGLSLFrag += 'uniform ' + type + ' ' + uniformName + ';\n';
1499+
14961500
} else {
14971501

1502+
shaderUniformsGLSLVert += 'uniform ' + type + ' ' + uniformName + ';\n';
14981503
shaderUniformsGLSLFrag += 'uniform ' + type + ' ' + uniformName + ';\n';
14991504

15001505
}
@@ -1507,7 +1512,7 @@ function WebGLRenderer( parameters ) {
15071512
name: material.type,
15081513
uniforms: combinedUniforms,
15091514
vertexShader: shaderUniformsGLSLVert + shader.vertexShader,
1510-
fragmentShader: shaderUniformsGLSLFrag + shader.fragmentShader //maybe not use the same
1515+
fragmentShader: shaderUniformsGLSLFrag + shader.fragmentShader
15111516

15121517
};
15131518

@@ -1827,7 +1832,7 @@ function WebGLRenderer( parameters ) {
18271832

18281833
}
18291834

1830-
//refresh custom provided uniforms
1835+
//refresh custom user provided uniforms if they exist
18311836
if ( undefined !== material.shaderUniforms ) {
18321837

18331838
refreshUniformsCustom( m_uniforms, material );
@@ -2077,7 +2082,6 @@ function WebGLRenderer( parameters ) {
20772082

20782083
}
20792084

2080-
//refresh custom provided uniforms
20812085
function refreshUniformsCustom( uniforms, material ) {
20822086

20832087
for ( var uniform in material.shaderUniforms ) {

src/renderers/webgl/WebGLProgram.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ function replaceClippingPlaneNums( string, parameters ) {
158158

159159
}
160160

161-
//consider provided dictionary when parsing the includes (not just THREE.ShaderChunk)
162161
function parseIncludes( string, materialIncludes ) {
163162

164163
var pattern = /^[ \t]*#include +<([\w\d.]+)>/gm;
@@ -291,7 +290,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
291290

292291
var customDefines = generateDefines( defines );
293292

294-
var customIncludes = undefined !== material.shaderIncludes ? material.shaderIncludes : {}; //user is not aware of this feature, fine
293+
var customIncludes = undefined !== material.shaderIncludes ? material.shaderIncludes : {}; //if the shaderIncludes dictionary is not provided
295294

296295
//
297296

0 commit comments

Comments
 (0)