@gov.nasa.jpl.honeycomb/view-cube
v0.0.6
Published
View cube to convey the cameras current orientation relative to world cooridnates.
Readme
View Cube
View cube to convey the cameras current orientation relative to world cooridnates.
See also https://github.com/nasa-jpl/ViewCubeHelper
Use
import { ViewCube } from '@gov.nasa.jpl.honeycomb/view-cube';
import { OrbitControls } from '@gov.nasa.jpl.honeycomb/view-cube';
import { PerspectiveCamera } from 'three';
// ...
const camera = new PerspectiveCamera();
const controls = new OrbitControls( camera, renderer.domElement );
const viewCube = new ViewCube(camera);
document.body.appendChild( viewCube.domElement );API
ViewCubeHelper
Class that renders a 3d cube for camera control manipulation.
camera
camera : CameraThe camera to mirror the angle of and control the transformation of.
domElement
domElement : CanvasThe dom element that the view cube is rendered to.
onLerpInitialize
onLerpInitialize : ( atTopOrBottomFace : Boolean ) => void = nullCalled before initializing the lerp (before recording start/end poses) supplies one boolean parameter: atTopOrBottomFace
onLerpStart
onLerpStart : ( ) => void = nullCalled after initializing the lerp (after recording start/end poses) supplies no parameters
onLerping
onLerping : ( lerpFactor : Number ) => void = nullCalled each frame after we've done some lerping supplies one parameter: the lerp factor (between 0 to 1)
onLerpFinished
onLerpFinished : ( ) => void = nullCalled after all lerping is finished supplies no parameters
getOrbitDistance
getOrbitDistance : ( ) => void = nullFunction that can be used for applications to manually specify the orbit distance to use. it's useful for if the camera is panning and we need to maintain a certain orbit distance even though the actual distance to this.orbitCenter may be large/small due to panning.
constructor
constructor( camera : Camera ) : voidsetAxesOrientation
setAxesOrientation( quatOrEuler : Quaternion | Euler ) : voidSet the axes orientation relative to the cube. This affects how the RGB lines representing the XYZ axes are rotated.
setFaceOrientation
setFaceOrientation( quatOrEuler : Quaternion | Euler ) : voidSet the face orientation so top, bottom, left, right, etc are aligned to the notional directions of the scene.
setTargetOrientation
setTargetOrientation( quatOrEuler : Quaternion | Euler ) : voidSets the scene orientation to match a scene target that is not necessarily world axis aligned.
dispose
dispose( ) : voidDisposes of the renderer used for the ViewCube.
