-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
'Turntable' option for camera_mode? #446
- Loading branch information
1 parent
1e50d0b
commit ecfc809
Showing
10 changed files
with
115 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const cameraUpAxisModes = { | ||
x: 'x', | ||
y: 'y', | ||
z: 'z', | ||
none: 'none' | ||
}; | ||
|
||
function cameraUpAxisGUI(gui, K3D) { | ||
gui.add(K3D.parameters, 'cameraUpAxis', { | ||
x: cameraUpAxisModes.x, | ||
y: cameraUpAxisModes.y, | ||
z: cameraUpAxisModes.z, | ||
none: cameraUpAxisModes.none | ||
}).name('CameraUpAxis').onChange( | ||
(axis) => { | ||
K3D.setCameraUpAxis(axis); | ||
|
||
K3D.dispatch(K3D.events.PARAMETERS_CHANGE, { | ||
key: 'camera_up_axis', | ||
value: axis | ||
}); | ||
}, | ||
); | ||
} | ||
|
||
function setupUpVector(camera, cameraUpAxis) { | ||
if (cameraUpAxis === cameraUpAxisModes.x) { | ||
camera.up.set(1, 0, 0); | ||
} else if (cameraUpAxis === cameraUpAxisModes.y) { | ||
camera.up.set(0, 1, 0); | ||
} else if (cameraUpAxis === cameraUpAxisModes.z) { | ||
camera.up.set(0, 0, 1); | ||
} | ||
} | ||
|
||
module.exports = { | ||
cameraUpAxisGUI, | ||
cameraUpAxisModes, | ||
setupUpVector | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters