提交 99f00ba3 编写于 作者: A alteredq

Removed enableLighting uniform from Lambert.

上级 9eb852db
此差异已折叠。
此差异已折叠。
......@@ -4827,7 +4827,6 @@ THREE.WebGLRenderer = function ( parameters ) {
function refreshUniformsLights ( uniforms, lights ) {
uniforms.enableLighting.value = lights.directional.length + lights.point.length;
uniforms.ambientLightColor.value = lights.ambient;
uniforms.directionalLightColor.value = lights.directional.colors;
......
......@@ -258,7 +258,6 @@ THREE.ShaderChunk = {
"uniform vec3 ambient;",
"uniform vec3 diffuse;",
"uniform bool enableLighting;",
"uniform vec3 ambientLightColor;",
"#if MAX_DIR_LIGHTS > 0",
......@@ -280,51 +279,43 @@ THREE.ShaderChunk = {
lights_lambert_vertex: [
"if ( !enableLighting ) {",
"vLightWeighting = vec3( 0.0 );",
"vLightWeighting = vec3( 1.0 );",
"} else {",
"vLightWeighting = vec3( 0.0 );",
"#if MAX_DIR_LIGHTS > 0",
"for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {",
"#if MAX_DIR_LIGHTS > 0",
"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );",
"float directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );",
"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;",
"for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {",
"}",
"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );",
"float directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );",
"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;",
"#endif",
"}",
"#if MAX_POINT_LIGHTS > 0",
"#endif",
"for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {",
"#if MAX_POINT_LIGHTS > 0",
"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );",
"for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {",
"vec3 lVector = lPosition.xyz - mvPosition.xyz;",
"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );",
"float lDistance = 1.0;",
"vec3 lVector = lPosition.xyz - mvPosition.xyz;",
"if ( pointLightDistance[ i ] > 0.0 )",
"lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );",
"float lDistance = 1.0;",
"lVector = normalize( lVector );",
"if ( pointLightDistance[ i ] > 0.0 )",
"lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );",
"float pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );",
"vLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;",
"lVector = normalize( lVector );",
"}",
"float pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );",
"vLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;",
"#endif",
"}",
"vLightWeighting = vLightWeighting * diffuse + ambient * ambientLightColor;",
"#endif",
"}"
"vLightWeighting = vLightWeighting * diffuse + ambient * ambientLightColor;",
].join("\n"),
......@@ -937,7 +928,6 @@ THREE.UniformsLib = {
lights: {
"enableLighting" : { type: "i", value: 1 },
"ambientLightColor" : { type: "fv", value: [] },
"directionalLightDirection" : { type: "fv", value: [] },
"directionalLightColor" : { type: "fv", value: [] },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册