@@ -265,7 +265,7 @@ function setValueV4f( gl, v ) {
265265
266266}
267267
268- // Single matrix (from flat array or MatrixN)
268+ // Single matrix (from flat array or THREE. MatrixN)
269269
270270function setValueM2 ( gl , v ) {
271271
@@ -348,133 +348,174 @@ function setValueM4( gl, v ) {
348348
349349}
350350
351- // Single texture (2D / Cube)
351+ // Single integer / boolean
352352
353- function setValueT1 ( gl , v , textures ) {
353+ function setValueV1i ( gl , v ) {
354354
355355 const cache = this . cache ;
356- const unit = textures . allocateTextureUnit ( ) ;
357356
358- if ( cache [ 0 ] !== unit ) {
359-
360- gl . uniform1i ( this . addr , unit ) ;
361- cache [ 0 ] = unit ;
357+ if ( cache [ 0 ] === v ) return ;
362358
363- }
359+ gl . uniform1i ( this . addr , v ) ;
364360
365- textures . safeSetTexture2D ( v || emptyTexture , unit ) ;
361+ cache [ 0 ] = v ;
366362
367363}
368364
369- function setValueT2DArray1 ( gl , v , textures ) {
365+ // Single integer / boolean vector (from flat array)
370366
371- const cache = this . cache ;
372- const unit = textures . allocateTextureUnit ( ) ;
367+ function setValueV2i ( gl , v ) {
373368
374- if ( cache [ 0 ] !== unit ) {
369+ const cache = this . cache ;
375370
376- gl . uniform1i ( this . addr , unit ) ;
377- cache [ 0 ] = unit ;
371+ if ( arraysEqual ( cache , v ) ) return ;
378372
379- }
373+ gl . uniform2iv ( this . addr , v ) ;
380374
381- textures . setTexture2DArray ( v || emptyTexture2dArray , unit ) ;
375+ copyArray ( cache , v ) ;
382376
383377}
384378
385- function setValueT3D1 ( gl , v , textures ) {
379+ function setValueV3i ( gl , v ) {
386380
387381 const cache = this . cache ;
388- const unit = textures . allocateTextureUnit ( ) ;
389-
390- if ( cache [ 0 ] !== unit ) {
391382
392- gl . uniform1i ( this . addr , unit ) ;
393- cache [ 0 ] = unit ;
383+ if ( arraysEqual ( cache , v ) ) return ;
394384
395- }
385+ gl . uniform3iv ( this . addr , v ) ;
396386
397- textures . setTexture3D ( v || emptyTexture3d , unit ) ;
387+ copyArray ( cache , v ) ;
398388
399389}
400390
401- function setValueT6 ( gl , v , textures ) {
391+ function setValueV4i ( gl , v ) {
402392
403393 const cache = this . cache ;
404- const unit = textures . allocateTextureUnit ( ) ;
405-
406- if ( cache [ 0 ] !== unit ) {
407394
408- gl . uniform1i ( this . addr , unit ) ;
409- cache [ 0 ] = unit ;
395+ if ( arraysEqual ( cache , v ) ) return ;
410396
411- }
397+ gl . uniform4iv ( this . addr , v ) ;
412398
413- textures . safeSetTextureCube ( v || emptyCubeTexture , unit ) ;
399+ copyArray ( cache , v ) ;
414400
415401}
416402
417- // Integer / Boolean vectors or arrays thereof (always flat arrays)
403+ // Single unsigned integer
418404
419- function setValueV1i ( gl , v ) {
405+ function setValueV1ui ( gl , v ) {
420406
421407 const cache = this . cache ;
422408
423409 if ( cache [ 0 ] === v ) return ;
424410
425- gl . uniform1i ( this . addr , v ) ;
411+ gl . uniform1ui ( this . addr , v ) ;
426412
427413 cache [ 0 ] = v ;
428414
429415}
430416
431- function setValueV2i ( gl , v ) {
417+ // Single unsigned integer vector (from flat array)
418+
419+ function setValueV2ui ( gl , v ) {
432420
433421 const cache = this . cache ;
434422
435423 if ( arraysEqual ( cache , v ) ) return ;
436424
437- gl . uniform2iv ( this . addr , v ) ;
425+ gl . uniform2uiv ( this . addr , v ) ;
438426
439427 copyArray ( cache , v ) ;
440428
441429}
442430
443- function setValueV3i ( gl , v ) {
431+ function setValueV3ui ( gl , v ) {
444432
445433 const cache = this . cache ;
446434
447435 if ( arraysEqual ( cache , v ) ) return ;
448436
449- gl . uniform3iv ( this . addr , v ) ;
437+ gl . uniform3uiv ( this . addr , v ) ;
450438
451439 copyArray ( cache , v ) ;
452440
453441}
454442
455- function setValueV4i ( gl , v ) {
443+ function setValueV4ui ( gl , v ) {
456444
457445 const cache = this . cache ;
458446
459447 if ( arraysEqual ( cache , v ) ) return ;
460448
461- gl . uniform4iv ( this . addr , v ) ;
449+ gl . uniform4uiv ( this . addr , v ) ;
462450
463451 copyArray ( cache , v ) ;
464452
465453}
466454
467- // uint
468455
469- function setValueV1ui ( gl , v ) {
456+ // Single texture (2D / Cube)
457+
458+ function setValueT1 ( gl , v , textures ) {
470459
471460 const cache = this . cache ;
461+ const unit = textures . allocateTextureUnit ( ) ;
472462
473- if ( cache [ 0 ] === v ) return ;
463+ if ( cache [ 0 ] !== unit ) {
474464
475- gl . uniform1ui ( this . addr , v ) ;
465+ gl . uniform1i ( this . addr , unit ) ;
466+ cache [ 0 ] = unit ;
476467
477- cache [ 0 ] = v ;
468+ }
469+
470+ textures . safeSetTexture2D ( v || emptyTexture , unit ) ;
471+
472+ }
473+
474+ function setValueT3D1 ( gl , v , textures ) {
475+
476+ const cache = this . cache ;
477+ const unit = textures . allocateTextureUnit ( ) ;
478+
479+ if ( cache [ 0 ] !== unit ) {
480+
481+ gl . uniform1i ( this . addr , unit ) ;
482+ cache [ 0 ] = unit ;
483+
484+ }
485+
486+ textures . setTexture3D ( v || emptyTexture3d , unit ) ;
487+
488+ }
489+
490+ function setValueT6 ( gl , v , textures ) {
491+
492+ const cache = this . cache ;
493+ const unit = textures . allocateTextureUnit ( ) ;
494+
495+ if ( cache [ 0 ] !== unit ) {
496+
497+ gl . uniform1i ( this . addr , unit ) ;
498+ cache [ 0 ] = unit ;
499+
500+ }
501+
502+ textures . safeSetTextureCube ( v || emptyCubeTexture , unit ) ;
503+
504+ }
505+
506+ function setValueT2DArray1 ( gl , v , textures ) {
507+
508+ const cache = this . cache ;
509+ const unit = textures . allocateTextureUnit ( ) ;
510+
511+ if ( cache [ 0 ] !== unit ) {
512+
513+ gl . uniform1i ( this . addr , unit ) ;
514+ cache [ 0 ] = unit ;
515+
516+ }
517+
518+ textures . setTexture2DArray ( v || emptyTexture2dArray , unit ) ;
478519
479520}
480521
@@ -499,6 +540,9 @@ function getSingularSetter( type ) {
499540 case 0x8b55 : case 0x8b59 : return setValueV4i ; // _VEC4
500541
501542 case 0x1405 : return setValueV1ui ; // UINT
543+ case 0x8dc6 : return setValueV2ui ; // _VEC2
544+ case 0x8dc7 : return setValueV3ui ; // _VEC3
545+ case 0x8dc8 : return setValueV4ui ; // _VEC4
502546
503547 case 0x8b5e : // SAMPLER_2D
504548 case 0x8d66 : // SAMPLER_EXTERNAL_OES
@@ -528,40 +572,16 @@ function getSingularSetter( type ) {
528572
529573}
530574
575+
531576// Array of scalars
577+
532578function setValueV1fArray ( gl , v ) {
533579
534580 gl . uniform1fv ( this . addr , v ) ;
535581
536582}
537583
538- // Integer / Boolean vectors or arrays thereof (always flat arrays)
539- function setValueV1iArray ( gl , v ) {
540-
541- gl . uniform1iv ( this . addr , v ) ;
542-
543- }
544-
545- function setValueV2iArray ( gl , v ) {
546-
547- gl . uniform2iv ( this . addr , v ) ;
548-
549- }
550-
551- function setValueV3iArray ( gl , v ) {
552-
553- gl . uniform3iv ( this . addr , v ) ;
554-
555- }
556-
557- function setValueV4iArray ( gl , v ) {
558-
559- gl . uniform4iv ( this . addr , v ) ;
560-
561- }
562-
563-
564- // Array of vectors (flat or from THREE classes)
584+ // Array of vectors (from flat array or array of THREE.VectorN)
565585
566586function setValueV2fArray ( gl , v ) {
567587
@@ -587,7 +607,7 @@ function setValueV4fArray( gl, v ) {
587607
588608}
589609
590- // Array of matrices (flat or from THREE clases )
610+ // Array of matrices (from flat array or array of THREE.MatrixN )
591611
592612function setValueM2Array ( gl , v ) {
593613
@@ -613,6 +633,63 @@ function setValueM4Array( gl, v ) {
613633
614634}
615635
636+ // Array of integer / boolean
637+
638+ function setValueV1iArray ( gl , v ) {
639+
640+ gl . uniform1iv ( this . addr , v ) ;
641+
642+ }
643+
644+ // Array of integer / boolean vectors (from flat array)
645+
646+ function setValueV2iArray ( gl , v ) {
647+
648+ gl . uniform2iv ( this . addr , v ) ;
649+
650+ }
651+
652+ function setValueV3iArray ( gl , v ) {
653+
654+ gl . uniform3iv ( this . addr , v ) ;
655+
656+ }
657+
658+ function setValueV4iArray ( gl , v ) {
659+
660+ gl . uniform4iv ( this . addr , v ) ;
661+
662+ }
663+
664+ // Array of unsigned integer
665+
666+ function setValueV1uiArray ( gl , v ) {
667+
668+ gl . uniform1uiv ( this . addr , v ) ;
669+
670+ }
671+
672+ // Array of unsigned integer vectors (from flat array)
673+
674+ function setValueV2uiArray ( gl , v ) {
675+
676+ gl . uniform2uiv ( this . addr , v ) ;
677+
678+ }
679+
680+ function setValueV3uiArray ( gl , v ) {
681+
682+ gl . uniform3uiv ( this . addr , v ) ;
683+
684+ }
685+
686+ function setValueV4uiArray ( gl , v ) {
687+
688+ gl . uniform4uiv ( this . addr , v ) ;
689+
690+ }
691+
692+
616693// Array of textures (2D / Cube)
617694
618695function setValueT1Array ( gl , v , textures ) {
@@ -667,6 +744,11 @@ function getPureArraySetter( type ) {
667744 case 0x8b54 : case 0x8b58 : return setValueV3iArray ; // _VEC3
668745 case 0x8b55 : case 0x8b59 : return setValueV4iArray ; // _VEC4
669746
747+ case 0x1405 : return setValueV1uiArray ; // UINT
748+ case 0x8dc6 : return setValueV2uiArray ; // _VEC2
749+ case 0x8dc7 : return setValueV3uiArray ; // _VEC3
750+ case 0x8dc8 : return setValueV4uiArray ; // _VEC4
751+
670752 case 0x8b5e : // SAMPLER_2D
671753 case 0x8d66 : // SAMPLER_EXTERNAL_OES
672754 case 0x8dca : // INT_SAMPLER_2D
0 commit comments