提交 64976be3 编写于 作者: M Mr.doob

Updated builds.

上级 089bbcfb
......@@ -15138,7 +15138,7 @@ THREE.Skeleton.prototype.addBone = function ( bone ) {
};
THREE.Skeleton.prototype.calculateInverses = function ( bone ) {
THREE.Skeleton.prototype.calculateInverses = function () {
this.boneInverses = [];
......@@ -18115,6 +18115,8 @@ THREE.ShaderLib = {
" #endif",
" }",
THREE.ShaderChunk[ "alphatest_fragment" ],
" if( enableSpecular )",
" specularTex = texture2D( tSpecular, vUv ).xyz;",
......@@ -22935,7 +22937,11 @@ THREE.WebGLRenderer = function ( parameters ) {
for ( u in material.__webglShader.uniforms ) {
material.uniformsList.push( [ material.__webglShader.uniforms[ u ], u ] );
var location = material.program.uniforms[ u ];
if ( location ) {
material.uniformsList.push( [ material.__webglShader.uniforms[ u ], location ] );
}
}
......@@ -22966,6 +22972,7 @@ THREE.WebGLRenderer = function ( parameters ) {
var refreshProgram = false;
var refreshMaterial = false;
var refreshLights = false;
var program = material.program,
p_uniforms = program.uniforms,
......@@ -22978,12 +22985,15 @@ THREE.WebGLRenderer = function ( parameters ) {
refreshProgram = true;
refreshMaterial = true;
refreshLights = true;
}
if ( material.id !== _currentMaterialId ) {
if ( _currentMaterialId === -1 ) refreshLights = true;
_currentMaterialId = material.id;
refreshMaterial = true;
}
......@@ -23089,12 +23099,17 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( _lightsNeedUpdate ) {
setupLights( program, lights );
refreshLights = true;
setupLights( lights );
_lightsNeedUpdate = false;
}
refreshUniformsLights( m_uniforms, _lights );
if ( refreshLights ) {
refreshUniformsLights( m_uniforms, _lights );
markUniformsLightsNeedsUpdate( m_uniforms, true );
} else {
markUniformsLightsNeedsUpdate( m_uniforms, false );
}
}
......@@ -23149,7 +23164,7 @@ THREE.WebGLRenderer = function ( parameters ) {
// load common uniforms
loadUniformsGeneric( program, material.uniformsList );
loadUniformsGeneric( material.uniformsList );
}
......@@ -23375,6 +23390,32 @@ THREE.WebGLRenderer = function ( parameters ) {
};
// If uniforms are marked as clean, they don't need to be loaded to the GPU.
function markUniformsLightsNeedsUpdate ( uniforms, boolean ) {
uniforms.ambientLightColor.needsUpdate = boolean;
uniforms.directionalLightColor.needsUpdate = boolean;
uniforms.directionalLightDirection.needsUpdate = boolean;
uniforms.pointLightColor.needsUpdate = boolean;
uniforms.pointLightPosition.needsUpdate = boolean;
uniforms.pointLightDistance.needsUpdate = boolean;
uniforms.spotLightColor.needsUpdate = boolean;
uniforms.spotLightPosition.needsUpdate = boolean;
uniforms.spotLightDistance.needsUpdate = boolean;
uniforms.spotLightDirection.needsUpdate = boolean;
uniforms.spotLightAngleCos.needsUpdate = boolean;
uniforms.spotLightExponent.needsUpdate = boolean;
uniforms.hemisphereLightSkyColor.needsUpdate = boolean;
uniforms.hemisphereLightGroundColor.needsUpdate = boolean;
uniforms.hemisphereLightDirection.needsUpdate = boolean;
};
function refreshUniformsShadow ( uniforms, lights ) {
if ( uniforms.shadowMatrix ) {
......@@ -23437,18 +23478,19 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function loadUniformsGeneric ( program, uniforms ) {
function loadUniformsGeneric ( uniforms ) {
var texture, textureUnit, offset;
for ( var j = 0, jl = uniforms.length; j < jl; j ++ ) {
var location = program.uniforms[ uniforms[ j ][ 1 ] ];
if ( ! location ) continue;
var location = uniforms[ j ][ 1 ];
var uniform = uniforms[ j ][ 0 ];
// needsUpdate property is not added to all uniforms.
if ( uniform.needsUpdate === false ) continue;
var type = uniform.type;
var value = uniform.value;
......@@ -23678,7 +23720,7 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function setupLights ( program, lights ) {
function setupLights ( lights ) {
var l, ll, light, n,
r = 0, g = 0, b = 0,
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册