@@ -1438,23 +1438,36 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
1438
1438
model . currentValidInputs . push ( { imageData, inputIndex } ) ;
1439
1439
}
1440
1440
}
1441
- const volumeProperties = actor . getProperties ( ) ;
1442
- const firstValidInput = model . currentValidInputs [ 0 ] ;
1443
- const firstImageData = firstValidInput . imageData ;
1444
- const firstScalars = firstImageData . getPointData ( ) . getScalars ( ) ;
1445
- const firstVolumeProperty = volumeProperties [ firstValidInput . inputIndex ] ;
1446
-
1447
- // Get the number of lights
1448
1441
let newNumberOfLights = 0 ;
1449
- if (
1450
- firstVolumeProperty . getShade ( ) &&
1451
- model . renderable . getBlendMode ( ) === BlendMode . COMPOSITE_BLEND
1452
- ) {
1453
- ren . getLights ( ) . forEach ( ( light ) => {
1454
- if ( light . getSwitch ( ) > 0 ) {
1455
- newNumberOfLights ++ ;
1456
- }
1457
- } ) ;
1442
+ if ( model . currentValidInputs . length > 0 ) {
1443
+ const volumeProperties = actor . getProperties ( ) ;
1444
+ const firstValidInput = model . currentValidInputs [ 0 ] ;
1445
+ const firstImageData = firstValidInput . imageData ;
1446
+ const firstScalars = firstImageData . getPointData ( ) . getScalars ( ) ;
1447
+ const firstVolumeProperty = volumeProperties [ firstValidInput . inputIndex ] ;
1448
+
1449
+ // Get the number of lights
1450
+ if (
1451
+ firstVolumeProperty . getShade ( ) &&
1452
+ model . renderable . getBlendMode ( ) === BlendMode . COMPOSITE_BLEND
1453
+ ) {
1454
+ ren . getLights ( ) . forEach ( ( light ) => {
1455
+ if ( light . getSwitch ( ) > 0 ) {
1456
+ newNumberOfLights ++ ;
1457
+ }
1458
+ } ) ;
1459
+ }
1460
+
1461
+ // Number of components
1462
+ const numberOfValidInputs = model . currentValidInputs . length ;
1463
+ const multiTexturePerVolumeEnabled = numberOfValidInputs > 1 ;
1464
+ model . numberOfComponents = multiTexturePerVolumeEnabled
1465
+ ? numberOfValidInputs
1466
+ : firstScalars . getNumberOfComponents ( ) ;
1467
+ model . useIndependentComponents = getUseIndependentComponents (
1468
+ firstVolumeProperty ,
1469
+ model . numberOfComponents
1470
+ ) ;
1458
1471
}
1459
1472
if ( newNumberOfLights !== model . numberOfLights ) {
1460
1473
model . numberOfLights = newNumberOfLights ;
@@ -1467,17 +1480,6 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
1467
1480
return ;
1468
1481
}
1469
1482
1470
- // Number of components
1471
- const numberOfValidInputs = model . currentValidInputs . length ;
1472
- const multiTexturePerVolumeEnabled = numberOfValidInputs > 1 ;
1473
- model . numberOfComponents = multiTexturePerVolumeEnabled
1474
- ? numberOfValidInputs
1475
- : firstScalars . getNumberOfComponents ( ) ;
1476
- model . useIndependentComponents = getUseIndependentComponents (
1477
- firstVolumeProperty ,
1478
- model . numberOfComponents
1479
- ) ;
1480
-
1481
1483
publicAPI . renderPieceStart ( ren , actor ) ;
1482
1484
publicAPI . renderPieceDraw ( ren , actor ) ;
1483
1485
publicAPI . renderPieceFinish ( ren , actor ) ;
0 commit comments