@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
31 lines • 1.04 kB
JavaScript
const $cameraController = "needle:cameraController";
/** Get the camera controller for the given camera (if any)
*/
export function getCameraController(cam) {
return cam[$cameraController];
}
/** Set the camera controller for the given camera */
export function setCameraController(cam, cameraController, active) {
if (active)
cam[$cameraController] = cameraController;
else {
if (cam[$cameraController] === cameraController)
cam[$cameraController] = null;
}
}
const autofit = "needle:autofit";
/** @internal */
export function useForAutoFit(obj) {
// if autofit is not defined we assume it may be included
if (obj[autofit] === undefined)
return true;
// otherwise if anything is set except false we assume it should be included
return obj[autofit] !== false;
}
/**
* Enable or disable autofitting for the given object
*/
export function setAutoFitEnabled(obj, enabled) {
obj[autofit] = enabled;
}
//# sourceMappingURL=engine_camera.js.map