File tree Expand file tree Collapse file tree 4 files changed +17
-14
lines changed
Examples/Applications/GeometryViewer Expand file tree Collapse file tree 4 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -270,6 +270,8 @@ function createPipeline(fileName, fileContents) {
270
270
271
271
const lookupTable = vtkColorTransferFunction . newInstance ( ) ;
272
272
const source = vtpReader . getOutputData ( 0 ) ;
273
+ // interpolateScalarsBeforeMapping is only used when displaying point data
274
+ // This setting is not relevant for cell data
273
275
const mapper = vtkMapper . newInstance ( {
274
276
interpolateScalarsBeforeMapping : true ,
275
277
useLookupTableScalarRange : true ,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ interface IPrimitiveCount {
14
14
15
15
interface IAbstractScalars {
16
16
cellFlag : boolean ;
17
+ scalars : Nullable < vtkDataArray > ;
17
18
}
18
19
19
20
interface ICoincidentTopology {
@@ -55,9 +56,13 @@ export interface vtkMapper extends vtkAbstractMapper3D {
55
56
* When rendering multiblock datasets, if any 2 blocks provide different
56
57
* lookup tables for the scalars, then also we cannot use textures. This case
57
58
* can be handled if required.
58
- * @param input
59
+ * @param scalars
60
+ * @param cellFlag True when the scalars are per cell instead of per point
59
61
*/
60
- canUseTextureMapForColoring ( input : any ) : boolean ;
62
+ canUseTextureMapForColoring (
63
+ scalars : vtkDataArray ,
64
+ cellFlag : boolean
65
+ ) : boolean ;
61
66
62
67
/**
63
68
* Call to force a rebuild of color result arrays on next MapScalars.
Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ function vtkMapper(publicAPI, model) {
165
165
// Decide between texture color or vertex color.
166
166
// Cell data always uses vertex color.
167
167
// Only point data can use both texture and vertex coloring.
168
- if ( publicAPI . canUseTextureMapForColoring ( input ) ) {
168
+ if ( publicAPI . canUseTextureMapForColoring ( scalars , cellFlag ) ) {
169
169
publicAPI . mapScalarsToTexture ( scalars , alpha ) ;
170
170
} else {
171
171
model . colorCoordinates = null ;
@@ -413,7 +413,11 @@ function vtkMapper(publicAPI, model) {
413
413
return true ;
414
414
} ;
415
415
416
- publicAPI . canUseTextureMapForColoring = ( input ) => {
416
+ publicAPI . canUseTextureMapForColoring = ( scalars , cellFlag ) => {
417
+ if ( cellFlag ) {
418
+ return true ; // cell data always use textures.
419
+ }
420
+
417
421
if ( ! model . interpolateScalarsBeforeMapping ) {
418
422
return false ; // user doesn't want us to use texture maps at all.
419
423
}
@@ -423,15 +427,6 @@ function vtkMapper(publicAPI, model) {
423
427
return false ;
424
428
}
425
429
426
- const gasResult = publicAPI . getAbstractScalars (
427
- input ,
428
- model . scalarMode ,
429
- model . arrayAccessMode ,
430
- model . arrayId ,
431
- model . colorByArrayName
432
- ) ;
433
- const scalars = gasResult . scalars ;
434
-
435
430
if ( ! scalars ) {
436
431
// no scalars on this dataset, we don't care if texture is used at all.
437
432
return false ;
Original file line number Diff line number Diff line change @@ -198,7 +198,8 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
198
198
) . result ;
199
199
} else {
200
200
if (
201
- model . renderable . getInterpolateScalarsBeforeMapping ( ) &&
201
+ ( model . renderable . getAreScalarsMappedFromCells ( ) ||
202
+ model . renderable . getInterpolateScalarsBeforeMapping ( ) ) &&
202
203
model . renderable . getColorCoordinates ( ) &&
203
204
! model . drawingEdges
204
205
) {
You can’t perform that action at this time.
0 commit comments