Guest User

Threejs LOD Lights

a guest
Jun 20th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 17.06 KB | None | 0 0
  1. diff --git a/src/Three.js b/src/Three.js
  2. index 86c86576d..86ca48939 100644
  3. --- a/src/Three.js
  4. +++ b/src/Three.js
  5. @@ -48,8 +48,8 @@ export { Loader } from './loaders/Loader.js';
  6.  export { Cache } from './loaders/Cache.js';
  7.  export { AudioLoader } from './loaders/AudioLoader.js';
  8.  export { SpotLightShadow } from './lights/SpotLightShadow.js';
  9. -export { SpotLight } from './lights/SpotLight.js';
  10. -export { PointLight } from './lights/PointLight.js';
  11. +export { LODPointLight as PointLight } from './lights/LODPointLight.js';
  12. +export { LODSpotLight as SpotLight } from './lights/LODSpotLight.js';
  13.  export { RectAreaLight } from './lights/RectAreaLight.js';
  14.  export { HemisphereLight } from './lights/HemisphereLight.js';
  15.  export { DirectionalLightShadow } from './lights/DirectionalLightShadow.js';
  16. diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js
  17. index 09dcd7589..c779874de 100644
  18. --- a/src/renderers/WebGLRenderer.js
  19. +++ b/src/renderers/WebGLRenderer.js
  20. @@ -36,6 +36,8 @@ import { WebGLClipping } from './webgl/WebGLClipping';
  21.  import { Frustum } from '../math/Frustum';
  22.  import { Vector4 } from '../math/Vector4';
  23.  import { Color } from '../math/Color';
  24. +import { PointLight } from '../lights/PointLight';
  25. +import { SpotLight } from '../lights/SpotLight';
  26.  
  27.  /**
  28.   * @author supereggbert / http://www.paulbrunt.co.uk/
  29. @@ -185,6 +187,8 @@ function WebGLRenderer( parameters ) {
  30.             pointShadowMap: [],
  31.             pointShadowMatrix: [],
  32.             hemi: [],
  33. +           LODPoint: [],
  34. +           LODSpot: [],
  35.  
  36.             shadows: []
  37.  
  38. @@ -1035,7 +1039,7 @@ function WebGLRenderer( parameters ) {
  39.     // Compile
  40.  
  41.     this.compile = function ( scene, camera ) {
  42. -
  43. +      
  44.         lights = [];
  45.  
  46.         scene.traverse( function ( object ) {
  47. @@ -1048,6 +1052,8 @@ function WebGLRenderer( parameters ) {
  48.  
  49.         } );
  50.  
  51. +       replaceLODLights( lights, scene, camera );
  52. +
  53.         setupLights( lights, camera );
  54.  
  55.         scene.traverse( function ( object ) {
  56. @@ -1130,6 +1136,8 @@ function WebGLRenderer( parameters ) {
  57.  
  58.         if ( _clippingEnabled ) _clipping.beginShadows();
  59.  
  60. +       replaceLODLights( lights, scene, camera );
  61. +
  62.         setupShadows( lights );
  63.  
  64.         shadowMap.render( scene, camera );
  65. @@ -1634,6 +1642,8 @@ function WebGLRenderer( parameters ) {
  66.             uniforms.rectAreaLights.value = _lights.rectArea;
  67.             uniforms.pointLights.value = _lights.point;
  68.             uniforms.hemisphereLights.value = _lights.hemi;
  69. +           uniforms.LODPointLights.value = _lights.LODPoint;
  70. +           uniforms.LODSpotLights.value = _lights.LODSpot;
  71.  
  72.             uniforms.directionalShadowMap.value = _lights.directionalShadowMap;
  73.             uniforms.directionalShadowMatrix.value = _lights.directionalShadowMatrix;
  74. @@ -2278,11 +2288,135 @@ function WebGLRenderer( parameters ) {
  75.         uniforms.spotLights.needsUpdate = value;
  76.         uniforms.rectAreaLights.needsUpdate = value;
  77.         uniforms.hemisphereLights.needsUpdate = value;
  78. +       uniforms.LODPointLights.needsUpdate = value;
  79. +       uniforms.LODSpotLights.needsUpdate = value;
  80.  
  81.     }
  82.  
  83.     // Lighting
  84.  
  85. +   var MAX_TOTAL = 125, //not sure how to determine this programmatically
  86. +           MAX_LOCAL = 16, //nor this, given lights are probably not the only textures required. I guess these should be set optimistically low, and then presented as a user option?
  87. +           LOCAL_LIGHTS = [], //cache
  88. +           PRIORITY_LIGHT_TYPES = /DirectionalLight|AmbientLight|HemisphereLight|RectAreaLight|^PointLight$|^SpotLight$/,//all Lights that are outside of our localized system here
  89. +           UNLOD_LIGHT_TYPES = /DirectionalLight/; //Only lights that will have shadows we aren't controlling. RectAreaLight needs to be added here when it has shadows, presumably.
  90. +
  91. +   function depthSort( objectsArray, camera ) {
  92. +
  93. +       return objectsArray.sort((a, b) => {
  94. +           var aMatch = a.type.match(PRIORITY_LIGHT_TYPES),
  95. +                   bMatch = b.type.match(PRIORITY_LIGHT_TYPES);
  96. +
  97. +           if( aMatch && !bMatch ) return -1;
  98. +           if( bMatch && !aMatch ) return 1;
  99. +
  100. +           return a.position.distanceTo(camera.position) - b.position.distanceTo(camera.position)
  101. +       })
  102. +
  103. +   }
  104. +
  105. +
  106. +   function countUnLODLights( lights ) {
  107. +
  108. +       var dir = 0, light;
  109. +
  110. +       for ( var i = 0, l = lights.length; i < l; i++ ) {
  111. +
  112. +           light = lights[ i ];
  113. +
  114. +           if ( light.type.match(UNLOD_LIGHT_TYPES) ) {
  115. +
  116. +                   dir ++;
  117. +
  118. +           }
  119. +
  120. +       }
  121. +
  122. +       return dir;
  123. +
  124. +   }
  125. +
  126. +
  127. +   function getGrossLights( lights ) {
  128. +
  129. +       var gross = 0, light;
  130. +
  131. +       for ( var i = 0, l = lights.length; i < l; i++ ) {
  132. +
  133. +           light = lights[i];
  134. +
  135. +           if ( light.type.match(PRIORITY_LIGHT_TYPES) ) {
  136. +
  137. +                   gross ++;
  138. +
  139. +           }
  140. +
  141. +       }
  142. +
  143. +       return gross;
  144. +
  145. +   }
  146. +
  147. +   function replaceLODLights( lights, scene, camera ) {
  148. +
  149. +       depthSort( lights, camera );
  150. +
  151. +
  152. +       var light;
  153. +
  154. +
  155. +       for ( var i = 0, l = lights.length, p = 0, m = MAX_LOCAL - countUnLODLights( lights ); i < l && p < m; i++ ) {
  156. +
  157. +           light = lights[ i ];
  158. +
  159. +           if ( light.castShadow ) {
  160. +
  161. +               var isPoint = light.isLODPointLight;
  162. +
  163. +               if ( isPoint || light.isLODSpotLight ) {
  164. +
  165. +
  166. +                   if ( !LOCAL_LIGHTS[ p ] || isPoint !== LOCAL_LIGHTS[ p ].isPointLight ) {
  167. +
  168. +                       LOCAL_LIGHTS[ p ] = isPoint? new PointLight() : new SpotLight();
  169. +
  170. +                       LOCAL_LIGHTS[ p ].castShadow = true;
  171. +
  172. +                   }
  173. +
  174. +                   var local = LOCAL_LIGHTS[ p ];
  175. +
  176. +                   local.color = light.color;
  177. +                   local.position.copy( light.position );
  178. +
  179. +                   local.distance = light.distance;
  180. +                   local.decay = light.decay;
  181. +                   local.intensity = light.intensity;
  182. +
  183. +                   if ( !isPoint ) {
  184. +
  185. +                       local.angle = light.angle;
  186. +                       local.penumbra = light.penumbra;
  187. +                       local.target = light.target;
  188. +
  189. +                   }
  190. +
  191. +                   local.updateMatrix();
  192. +                   local.updateMatrixWorld(true);
  193. +
  194. +                   lights[ i ] = LOCAL_LIGHTS[ p ];
  195. +
  196. +                   p ++;
  197. +               }
  198. +
  199. +           }
  200. +
  201. +       }
  202. +
  203. +       return lights;
  204. +
  205. +   }
  206. +
  207.     function setupShadows( lights ) {
  208.  
  209.         var lightShadowsLength = 0;
  210. @@ -2291,7 +2425,7 @@ function WebGLRenderer( parameters ) {
  211.  
  212.             var light = lights[ i ];
  213.  
  214. -           if ( light.castShadow ) {
  215. +           if ( light.castShadow && !( light.isLODPointLight || light.isLODSpotLight ) ) {
  216.  
  217.                 _lights.shadows[ lightShadowsLength ] = light;
  218.                 lightShadowsLength ++;
  219. @@ -2319,7 +2453,12 @@ function WebGLRenderer( parameters ) {
  220.             pointLength = 0,
  221.             spotLength = 0,
  222.             rectAreaLength = 0,
  223. -           hemiLength = 0;
  224. +           hemiLength = 0,
  225. +
  226. +           p = 0,
  227. +           m = MAX_TOTAL - getGrossLights( lights ),
  228. +           LODPointLength = 0,
  229. +           LODSpotLength = 0;
  230.  
  231.         for ( l = 0, ll = lights.length; l < ll; l ++ ) {
  232.  
  233. @@ -2480,6 +2619,46 @@ function WebGLRenderer( parameters ) {
  234.  
  235.                 hemiLength ++;
  236.  
  237. +           } else if ( light.isLODPointLight && p < m ) {
  238. +
  239. +               var uniforms = lightCache.get( light );
  240. +
  241. +               uniforms.position.setFromMatrixPosition( light.matrixWorld );
  242. +               uniforms.position.applyMatrix4( viewMatrix );
  243. +
  244. +               uniforms.color.copy( light.color ).multiplyScalar( light.intensity );
  245. +               uniforms.distance = light.distance;
  246. +               uniforms.decay = ( light.distance === 0 ) ? 0.0 : light.decay;
  247. +
  248. +               _lights.LODPoint[ LODPointLength ] = uniforms;
  249. +
  250. +               LODPointLength ++;
  251. +               p ++;
  252. +
  253. +           } else if ( light.isLODSpotLight && p < m ) {
  254. +
  255. +               var uniforms = lightCache.get( light );
  256. +
  257. +               uniforms.position.setFromMatrixPosition( light.matrixWorld );
  258. +               uniforms.position.applyMatrix4( viewMatrix );
  259. +
  260. +               uniforms.color.copy( color ).multiplyScalar( intensity );
  261. +               uniforms.distance = distance;
  262. +
  263. +               uniforms.direction.setFromMatrixPosition( light.matrixWorld );
  264. +               _vector3.setFromMatrixPosition( light.target.matrixWorld );
  265. +               uniforms.direction.sub( _vector3 );
  266. +               uniforms.direction.transformDirection( viewMatrix );
  267. +
  268. +               uniforms.coneCos = Math.cos( light.angle );
  269. +               uniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) );
  270. +               uniforms.decay = ( light.distance === 0 ) ? 0.0 : light.decay;
  271. +
  272. +               _lights.LODSpot[ LODSpotLength ] = uniforms;
  273. +
  274. +               LODSpotLength ++;
  275. +               p ++;
  276. +
  277.             }
  278.  
  279.         }
  280. @@ -2494,8 +2673,11 @@ function WebGLRenderer( parameters ) {
  281.         _lights.point.length = pointLength;
  282.         _lights.hemi.length = hemiLength;
  283.  
  284. +       _lights.LODPoint.length = LODPointLength;
  285. +       _lights.LODSpot.length = LODSpotLength;
  286. +
  287.         // TODO (sam-g-steel) why aren't we using join
  288. -       _lights.hash = directionalLength + ',' + pointLength + ',' + spotLength + ',' + rectAreaLength + ',' + hemiLength + ',' + _lights.shadows.length;
  289. +       _lights.hash = directionalLength + ',' + pointLength + ',' + spotLength + ',' + rectAreaLength + ',' + hemiLength + ',' + LODPointLength + ',' + LODSpotLength + ',' + _lights.shadows.length;
  290.  
  291.     }
  292.  
  293. diff --git a/src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl b/src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl
  294. index cd50e0362..3a9e6dce5 100644
  295. --- a/src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl
  296. +++ b/src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl
  297. @@ -61,6 +61,47 @@ vec3 directLightColor_Diffuse;
  298.  
  299.  #endif
  300.  
  301. +#if NUM_LOD_POINT_LIGHTS > 0
  302. +
  303. +   for ( int i = 0; i < NUM_LOD_POINT_LIGHTS; i ++ ) {
  304. +
  305. +       getLODPointDirectLightIrradiance( LODPointLights[ i ], geometry, directLight );
  306. +
  307. +       dotNL = dot( geometry.normal, directLight.direction );
  308. +       directLightColor_Diffuse = PI * directLight.color;
  309. +
  310. +       vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
  311. +
  312. +       #ifdef DOUBLE_SIDED
  313. +
  314. +           vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
  315. +
  316. +       #endif
  317. +
  318. +   }
  319. +
  320. +#endif
  321. +
  322. +#if NUM_LOD_SPOT_LIGHTS > 0
  323. +
  324. +   for ( int i = 0; i < NUM_LOD_SPOT_LIGHTS; i ++ ) {
  325. +
  326. +       getLODSpotDirectLightIrradiance( LODSpotLights[ i ], geometry, directLight );
  327. +
  328. +       dotNL = dot( geometry.normal, directLight.direction );
  329. +       directLightColor_Diffuse = PI * directLight.color;
  330. +
  331. +       vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
  332. +
  333. +       #ifdef DOUBLE_SIDED
  334. +
  335. +           vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
  336. +
  337. +       #endif
  338. +   }
  339. +
  340. +#endif
  341. +
  342.  /*
  343.  #if NUM_RECT_AREA_LIGHTS > 0
  344.  
  345. diff --git a/src/renderers/shaders/ShaderChunk/lights_pars.glsl b/src/renderers/shaders/ShaderChunk/lights_pars.glsl
  346. index 6bb83b281..a56999215 100644
  347. --- a/src/renderers/shaders/ShaderChunk/lights_pars.glsl
  348. +++ b/src/renderers/shaders/ShaderChunk/lights_pars.glsl
  349. @@ -167,6 +167,73 @@ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  350.  
  351.  #endif
  352.  
  353. +#if NUM_LOD_POINT_LIGHTS > 0
  354. +
  355. +   struct LODPointLight {
  356. +       vec3 position;
  357. +       vec3 color;
  358. +       float distance;
  359. +       float decay;
  360. +   };
  361. +
  362. +   uniform LODPointLight LODPointLights[ NUM_LOD_POINT_LIGHTS ];
  363. +
  364. +   // directLight is an out parameter as having it as a return value caused compiler errors on some devices
  365. +   void getLODPointDirectLightIrradiance( const in LODPointLight lodPointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
  366. +
  367. +       vec3 lVector = lodPointLight.position - geometry.position;
  368. +       directLight.direction = normalize( lVector );
  369. +
  370. +       float lightDistance = length( lVector );
  371. +
  372. +       directLight.color = lodPointLight.color;
  373. +       directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, lodPointLight.distance, lodPointLight.decay );
  374. +       directLight.visible = ( directLight.color != vec3( 0.0 ) );
  375. +
  376. +   }
  377. +
  378. +#endif
  379. +
  380. +#if NUM_LOD_SPOT_LIGHTS > 0
  381. +
  382. +   struct LODSpotLight {
  383. +       vec3 position;
  384. +       vec3 direction;
  385. +       vec3 color;
  386. +       float distance;
  387. +       float decay;
  388. +       float coneCos;
  389. +       float penumbraCos;
  390. +   };
  391. +
  392. +   uniform LODSpotLight LODSpotLights[ NUM_LOD_SPOT_LIGHTS ];
  393. +
  394. +   // directLight is an out parameter as having it as a return value caused compiler errors on some devices
  395. +   void getLODSpotDirectLightIrradiance( const in LODSpotLight lodSpotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {
  396. +
  397. +       vec3 lVector = lodSpotLight.position - geometry.position;
  398. +       directLight.direction = normalize( lVector );
  399. +
  400. +       float lightDistance = length( lVector );
  401. +       float angleCos = dot( directLight.direction, lodSpotLight.direction );
  402. +
  403. +       if ( angleCos > lodSpotLight.coneCos ) {
  404. +
  405. +           float spotEffect = smoothstep( lodSpotLight.coneCos, lodSpotLight.penumbraCos, angleCos );
  406. +
  407. +           directLight.color = lodSpotLight.color;
  408. +           directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, lodSpotLight.distance, lodSpotLight.decay );
  409. +           directLight.visible = true;
  410. +
  411. +       } else {
  412. +
  413. +           directLight.color = vec3( 0.0 );
  414. +           directLight.visible = false;
  415. +
  416. +       }
  417. +   }
  418. +
  419. +#endif
  420.  
  421.  #if defined( USE_ENVMAP ) && defined( PHYSICAL )
  422.  
  423. diff --git a/src/renderers/shaders/ShaderChunk/lights_template.glsl b/src/renderers/shaders/ShaderChunk/lights_template.glsl
  424. index 219e7956e..e5bf24d69 100644
  425. --- a/src/renderers/shaders/ShaderChunk/lights_template.glsl
  426. +++ b/src/renderers/shaders/ShaderChunk/lights_template.glsl
  427. @@ -94,6 +94,38 @@ IncidentLight directLight;
  428.  
  429.  #endif
  430.  
  431. +#if ( NUM_LOD_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  432. +
  433. +   LODPointLight lodPointLight;
  434. +
  435. +   for ( int i = 0; i < NUM_LOD_POINT_LIGHTS; i ++ ) {
  436. +
  437. +       lodPointLight = LODPointLights[ i ];
  438. +
  439. +       getLODPointDirectLightIrradiance( lodPointLight, geometry, directLight );
  440. +
  441. +       RE_Direct( directLight, geometry, material, reflectedLight );
  442. +
  443. +   }
  444. +
  445. +#endif
  446. +
  447. +#if ( NUM_LOD_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  448. +
  449. +   LODSpotLight lodSpotLight;
  450. +
  451. +   for ( int i = 0; i < NUM_LOD_SPOT_LIGHTS; i ++ ) {
  452. +
  453. +       lodSpotLight = LODSpotLights[ i ];
  454. +
  455. +       getLODSpotDirectLightIrradiance( lodSpotLight, geometry, directLight );
  456. +
  457. +       RE_Direct( directLight, geometry, material, reflectedLight );
  458. +
  459. +   }
  460. +
  461. +#endif
  462. +
  463.  #if defined( RE_IndirectDiffuse )
  464.  
  465.     vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  466. diff --git a/src/renderers/shaders/UniformsLib.js b/src/renderers/shaders/UniformsLib.js
  467. index 3dc12e2a5..5fdd64ae9 100644
  468. --- a/src/renderers/shaders/UniformsLib.js
  469. +++ b/src/renderers/shaders/UniformsLib.js
  470. @@ -128,6 +128,16 @@ var UniformsLib = {
  471.             shadowMapSize: {}
  472.         } },
  473.  
  474. +       LODSpotLights: { value: [], properties: {
  475. +           color: {},
  476. +           position: {},
  477. +           direction: {},
  478. +           distance: {},
  479. +           coneCos: {},
  480. +           penumbraCos: {},
  481. +           decay: {}
  482. +       } },
  483. +
  484.         spotShadowMap: { value: [] },
  485.         spotShadowMatrix: { value: [] },
  486.  
  487. @@ -143,6 +153,13 @@ var UniformsLib = {
  488.             shadowMapSize: {}
  489.         } },
  490.  
  491. +       LODPointLights: { value: [], properties: {
  492. +           color: {},
  493. +           position: {},
  494. +           decay: {},
  495. +           distance: {}
  496. +       } },
  497. +
  498.         pointShadowMap: { value: [] },
  499.         pointShadowMatrix: { value: [] },
  500.  
  501. diff --git a/src/renderers/webgl/WebGLLights.js b/src/renderers/webgl/WebGLLights.js
  502. index 1ef409578..757cb3b84 100644
  503. --- a/src/renderers/webgl/WebGLLights.js
  504. +++ b/src/renderers/webgl/WebGLLights.js
  505. @@ -85,6 +85,27 @@ function WebGLLights() {
  506.                     };
  507.                     break;
  508.  
  509. +               case 'LODPointLight':
  510. +                   uniforms = {
  511. +                       position: new Vector3(),
  512. +                       color: new Color(),
  513. +                       distance: 0,
  514. +                       decay: 0
  515. +                   };
  516. +                   break;
  517. +
  518. +               case 'LODSpotLight':
  519. +                   uniforms = {
  520. +                       position: new Vector3(),
  521. +                       direction: new Vector3(),
  522. +                       color: new Color(),
  523. +                       distance: 0,
  524. +                       coneCos: 0,
  525. +                       penumbraCos: 0,
  526. +                       decay: 0
  527. +                   };
  528. +                   break;
  529. +
  530.             }
  531.  
  532.             lights[ light.id ] = uniforms;
  533. diff --git a/src/renderers/webgl/WebGLProgram.js b/src/renderers/webgl/WebGLProgram.js
  534. index 30c6e8b08..931a2c276 100644
  535. --- a/src/renderers/webgl/WebGLProgram.js
  536. +++ b/src/renderers/webgl/WebGLProgram.js
  537. @@ -146,7 +146,9 @@ function replaceLightNums( string, parameters ) {
  538.         .replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights )
  539.         .replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights )
  540.         .replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights )
  541. -       .replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights );
  542. +       .replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights )
  543. +       .replace( /NUM_LOD_POINT_LIGHTS/g, parameters.numLODPointLights )
  544. +       .replace( /NUM_LOD_SPOT_LIGHTS/g, parameters.numLODSpotLights );
  545.  
  546.  }
  547.  
  548. diff --git a/src/renderers/webgl/WebGLPrograms.js b/src/renderers/webgl/WebGLPrograms.js
  549. index d07e65e33..89553b1ce 100644
  550. --- a/src/renderers/webgl/WebGLPrograms.js
  551. +++ b/src/renderers/webgl/WebGLPrograms.js
  552. @@ -32,6 +32,7 @@ function WebGLPrograms( renderer, capabilities ) {
  553.         "maxBones", "useVertexTexture", "morphTargets", "morphNormals",
  554.         "maxMorphTargets", "maxMorphNormals", "premultipliedAlpha",
  555.         "numDirLights", "numPointLights", "numSpotLights", "numHemiLights", "numRectAreaLights",
  556. +       "numLODPointLights", "numLODSpotLights",
  557.         "shadowMapEnabled", "shadowMapType", "toneMapping", 'physicallyCorrectLights',
  558.         "alphaTest", "doubleSided", "flipSided", "numClippingPlanes", "numClipIntersection", "depthPacking", "dithering"
  559.     ];
  560. @@ -126,7 +127,7 @@ function WebGLPrograms( renderer, capabilities ) {
  561.         }
  562.  
  563.         var currentRenderTarget = renderer.getRenderTarget();
  564. -
  565. +      
  566.         var parameters = {
  567.  
  568.             shaderID: shaderID,
  569. @@ -181,6 +182,8 @@ function WebGLPrograms( renderer, capabilities ) {
  570.             numSpotLights: lights.spot.length,
  571.             numRectAreaLights: lights.rectArea.length,
  572.             numHemiLights: lights.hemi.length,
  573. +           numLODPointLights: lights.LODPoint.length,
  574. +           numLODSpotLights: lights.LODSpot.length,
  575.  
  576.             numClippingPlanes: nClipPlanes,
  577.             numClipIntersection: nClipIntersection,
Advertisement
Add Comment
Please, Sign In to add comment