Skip to content

Commit

Permalink
simple method for light creation and deletion at runtime.
Browse files Browse the repository at this point in the history
  • Loading branch information
idflood committed Oct 4, 2011
1 parent b2e633a commit 1ab47a5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ THREE.WebGLRenderer = function ( parameters ) {
_viewportWidth = 0,
_viewportHeight = 0,

// lights cache
_oldSceneLights = [],

// camera matrices caches

_frustum = [
Expand Down Expand Up @@ -2655,8 +2658,7 @@ THREE.WebGLRenderer = function ( parameters ) {
};

function setProgram( camera, lights, fog, material, object ) {

if ( ! material.program ) {
if ( ! material.program || _this._oldSceneLights != lights.length ) {

_this.initMaterial( material, lights, fog, object );

Expand Down Expand Up @@ -3865,6 +3867,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}

//_gl.finish();
_this._oldSceneLights = lights.length;

};

Expand Down

0 comments on commit 1ab47a5

Please sign in to comment.