@@ -179,7 +179,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
179
179
) ;
180
180
181
181
const maxSamples =
182
- vec3 . length ( vsize ) / model . renderable . getSampleDistance ( ) ;
182
+ vec3 . length ( vsize ) / publicAPI . getCurrentSampleDistance ( ren ) ;
183
183
184
184
FSSource = vtkShaderProgram . substitute (
185
185
FSSource ,
@@ -468,7 +468,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
468
468
) ;
469
469
470
470
const maxSamples =
471
- vec3 . length ( vsize ) / model . renderable . getSampleDistance ( ) ;
471
+ vec3 . length ( vsize ) / publicAPI . getCurrentSampleDistance ( ren ) ;
472
472
473
473
const state = {
474
474
interpolationType : actor . getProperty ( ) . getInterpolationType ( ) ,
@@ -593,7 +593,10 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
593
593
}
594
594
595
595
program . setUniformi ( 'texture1' , model . scalarTexture . getTextureUnit ( ) ) ;
596
- program . setUniformf ( 'sampleDistance' , model . renderable . getSampleDistance ( ) ) ;
596
+ program . setUniformf (
597
+ 'sampleDistance' ,
598
+ publicAPI . getCurrentSampleDistance ( ren )
599
+ ) ;
597
600
598
601
const volInfo = model . scalarTexture . getVolumeInfo ( ) ;
599
602
const ipScalarRange = model . renderable . getIpScalarRange ( ) ;
@@ -739,7 +742,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
739
742
) ;
740
743
741
744
const maxSamples =
742
- vec3 . length ( vsize ) / model . renderable . getSampleDistance ( ) ;
745
+ vec3 . length ( vsize ) / publicAPI . getCurrentSampleDistance ( ren ) ;
743
746
if ( maxSamples > model . renderable . getMaximumSamplesPerRay ( ) ) {
744
747
vtkWarningMacro ( `The number of steps required ${ Math . ceil (
745
748
maxSamples
@@ -1133,6 +1136,16 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
1133
1136
return [ lowerLeftU , lowerLeftV ] ;
1134
1137
} ;
1135
1138
1139
+ publicAPI . getCurrentSampleDistance = ( ren ) => {
1140
+ const rwi = ren . getVTKWindow ( ) . getInteractor ( ) ;
1141
+ const baseSampleDistance = model . renderable . getSampleDistance ( ) ;
1142
+ if ( rwi . isAnimating ( ) ) {
1143
+ const factor = model . renderable . getInteractionSampleDistanceFactor ( ) ;
1144
+ return baseSampleDistance * factor ;
1145
+ }
1146
+ return baseSampleDistance ;
1147
+ } ;
1148
+
1136
1149
publicAPI . renderPieceStart = ( ren , actor ) => {
1137
1150
const rwi = ren . getVTKWindow ( ) . getInteractor ( ) ;
1138
1151
@@ -1437,7 +1450,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
1437
1450
for ( let c = 0 ; c < numIComps ; ++ c ) {
1438
1451
const ofun = vprop . getScalarOpacity ( c ) ;
1439
1452
const opacityFactor =
1440
- model . renderable . getSampleDistance ( ) /
1453
+ publicAPI . getCurrentSampleDistance ( ren ) /
1441
1454
vprop . getScalarOpacityUnitDistance ( c ) ;
1442
1455
1443
1456
const oRange = ofun . getRange ( ) ;
0 commit comments