@@ -3,6 +3,7 @@ const msgpack = require('msgpack-lite');
3
3
4
4
const LilGUI = require ( 'lil-gui' ) . GUI ;
5
5
const { viewModes} = require ( './lib/viewMode' ) ;
6
+ const { cameraUpAxisModes} = require ( './lib/cameraUpAxis' ) ;
6
7
const _ = require ( '../lodash' ) ;
7
8
const { cameraModes} = require ( './lib/cameraMode' ) ;
8
9
const loader = require ( './lib/Loader' ) ;
@@ -14,6 +15,7 @@ const detachWindowGUI = require('./lib/detachWindow');
14
15
const fullscreen = require ( './lib/fullscreen' ) ;
15
16
const { viewModeGUI} = require ( './lib/viewMode' ) ;
16
17
const { cameraModeGUI} = require ( './lib/cameraMode' ) ;
18
+ const { cameraUpAxisGUI} = require ( './lib/cameraUpAxis' ) ;
17
19
const manipulate = require ( './lib/manipulate' ) ;
18
20
const { getColorLegend} = require ( './lib/colorMapLegend' ) ;
19
21
const objectsGUIProvider = require ( './lib/objectsGUIprovider' ) ;
@@ -132,6 +134,7 @@ function K3D(provider, targetDOMNode, parameters) {
132
134
133
135
viewModeGUI ( GUI . controls , self ) ;
134
136
cameraModeGUI ( GUI . controls , self ) ;
137
+ cameraUpAxisGUI ( GUI . controls , self ) ;
135
138
manipulate . manipulateGUI ( GUI . controls , self , changeParameters ) ;
136
139
137
140
GUI . controls . add ( self . parameters , 'cameraFov' ) . step ( 0.1 ) . min ( 1.0 ) . max ( 179 )
@@ -299,6 +302,7 @@ function K3D(provider, targetDOMNode, parameters) {
299
302
cameraDampingFactor : 0.0 ,
300
303
name : null ,
301
304
cameraFov : 60.0 ,
305
+ cameraUpAxis : cameraUpAxisModes . none ,
302
306
cameraAnimation : { } ,
303
307
autoRendering : true ,
304
308
axesHelper : 1.0 ,
@@ -722,14 +726,29 @@ function K3D(provider, targetDOMNode, parameters) {
722
726
self . parameters . cameraDampingFactor = factor ;
723
727
724
728
self . getWorld ( ) . changeControls ( true ) ;
729
+ } ;
730
+
731
+ /**
732
+ * Set camera up axis
733
+ * @memberof K3D.Core
734
+ * @param {String } axis
735
+ */
736
+ this . setCameraUpAxis = function ( axis ) {
737
+ self . parameters . cameraUpAxis = axis ;
738
+
739
+ self . getWorld ( ) . changeControls ( true ) ;
725
740
726
741
if ( GUI . controls ) {
727
742
GUI . controls . controllers . forEach ( ( controller ) => {
728
- if ( controller . property === 'damping_factor ' ) {
743
+ if ( controller . property === 'cameraUpAxis ' ) {
729
744
controller . updateDisplay ( ) ;
730
745
}
731
746
} ) ;
732
747
}
748
+
749
+ self . rebuildSceneData ( false ) . then ( ( ) => {
750
+ self . render ( ) ;
751
+ } ) ;
733
752
} ;
734
753
735
754
/**
@@ -1268,6 +1287,7 @@ function K3D(provider, targetDOMNode, parameters) {
1268
1287
self . setGrid ( self . parameters . grid ) ;
1269
1288
self . setCameraAutoFit ( self . parameters . cameraAutoFit ) ;
1270
1289
self . setCameraDampingFactor ( self . parameters . cameraDampingFactor ) ;
1290
+ self . setCameraUpAxis ( self . parameters . cameraUpAxis ) ;
1271
1291
self . setClippingPlanes ( self . parameters . clippingPlanes ) ;
1272
1292
self . setDirectionalLightingIntensity ( self . parameters . lighting ) ;
1273
1293
self . setColorMapLegend ( self . parameters . colorbarObjectId ) ;
0 commit comments