提交 b9c7b79a 编写于 作者: G gero3

make sure uniforms don't get loaded when they are not in the shader

上级 a73fb6ed
......@@ -2132,7 +2132,7 @@ THREE.WebGLRenderer = function ( parameters ) {
material instanceof THREE.MeshPhongMaterial ||
material.envMap ) {
if ( p_uniforms.cameraPosition !== null ) {
if ( p_uniforms.cameraPosition !== undefined ) {
_vector3.setFromMatrixPosition( camera.matrixWorld );
_gl.uniform3f( p_uniforms.cameraPosition, _vector3.x, _vector3.y, _vector3.z );
......@@ -2147,10 +2147,9 @@ THREE.WebGLRenderer = function ( parameters ) {
material instanceof THREE.ShaderMaterial ||
material.skinning ) {
if ( p_uniforms.viewMatrix !== null ) {
if ( p_uniforms.viewMatrix !== undefined ) {
_gl.uniformMatrix4fv( p_uniforms.viewMatrix, false, camera.matrixWorldInverse.elements );
}
}
......@@ -2163,13 +2162,13 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( material.skinning ) {
if ( object.bindMatrix && p_uniforms.bindMatrix !== null ) {
if ( object.bindMatrix && p_uniforms.bindMatrix !== undefined ) {
_gl.uniformMatrix4fv( p_uniforms.bindMatrix, false, object.bindMatrix.elements );
}
if ( object.bindMatrixInverse && p_uniforms.bindMatrixInverse !== null ) {
if ( object.bindMatrixInverse && p_uniforms.bindMatrixInverse !== undefined ) {
_gl.uniformMatrix4fv( p_uniforms.bindMatrixInverse, false, object.bindMatrixInverse.elements );
......@@ -2177,7 +2176,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( _supportsBoneTextures && object.skeleton && object.skeleton.useVertexTexture ) {
if ( p_uniforms.boneTexture !== null ) {
if ( p_uniforms.boneTexture !== undefined ) {
var textureUnit = getTextureUnit();
......@@ -2186,13 +2185,13 @@ THREE.WebGLRenderer = function ( parameters ) {
}
if ( p_uniforms.boneTextureWidth !== null ) {
if ( p_uniforms.boneTextureWidth !== undefined ) {
_gl.uniform1i( p_uniforms.boneTextureWidth, object.skeleton.boneTextureWidth );
}
if ( p_uniforms.boneTextureHeight !== null ) {
if ( p_uniforms.boneTextureHeight !== undefined ) {
_gl.uniform1i( p_uniforms.boneTextureHeight, object.skeleton.boneTextureHeight );
......@@ -2200,10 +2199,11 @@ THREE.WebGLRenderer = function ( parameters ) {
} else if ( object.skeleton && object.skeleton.boneMatrices ) {
if ( p_uniforms.boneGlobalMatrices !== null ) {
if ( p_uniforms.boneGlobalMatrices !== undefined ) {
_gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.skeleton.boneMatrices );
}
}
......@@ -2301,10 +2301,10 @@ THREE.WebGLRenderer = function ( parameters ) {
loadUniformsMatrices( p_uniforms, object );
if ( p_uniforms.modelMatrix !== null ) {
if ( p_uniforms.modelMatrix !== undefined ) {
_gl.uniformMatrix4fv( p_uniforms.modelMatrix, false, object.matrixWorld.elements );
}
return program;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册