@@ -498,6 +498,12 @@ function vtkCamera(publicAPI, model) {
498
498
publicAPI . computeViewParametersFromViewMatrix ( tmpMatrix ) ;
499
499
} ;
500
500
501
+ publicAPI . setModelTransformMatrix = ( mat ) => {
502
+ model . modelTransformMatrix = mat ;
503
+ } ;
504
+
505
+ publicAPI . getModelTransformMatrix = ( ) => model . modelTransformMatrix ;
506
+
501
507
publicAPI . setViewMatrix = ( mat ) => {
502
508
model . viewMatrix = mat ;
503
509
if ( model . viewMatrix ) {
@@ -509,6 +515,10 @@ function vtkCamera(publicAPI, model) {
509
515
510
516
publicAPI . getViewMatrix = ( ) => {
511
517
if ( model . viewMatrix ) {
518
+ if ( model . modelTransformMatrix ) {
519
+ mat4 . multiply ( tmpMatrix , model . viewMatrix , model . modelTransformMatrix ) ;
520
+ return tmpMatrix ;
521
+ }
512
522
return model . viewMatrix ;
513
523
}
514
524
@@ -522,7 +532,11 @@ function vtkCamera(publicAPI, model) {
522
532
mat4 . transpose ( tmpMatrix , tmpMatrix ) ;
523
533
524
534
const result = new Float64Array ( 16 ) ;
525
- mat4 . copy ( result , tmpMatrix ) ;
535
+ if ( model . modelTransformMatrix ) {
536
+ mat4 . multiply ( result , tmpMatrix , model . modelTransformMatrix ) ;
537
+ } else {
538
+ mat4 . copy ( result , tmpMatrix ) ;
539
+ }
526
540
return result ;
527
541
} ;
528
542
@@ -767,6 +781,7 @@ export const DEFAULT_VALUES = {
767
781
freezeFocalPoint : false ,
768
782
projectionMatrix : null ,
769
783
viewMatrix : null ,
784
+ modelTransformMatrix : null ,
770
785
cameraLightTransform : mat4 . create ( ) ,
771
786
772
787
// used for world to physical transformations
0 commit comments