@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.
46 lines (40 loc) • 1.32 kB
text/typescript
import { PerspectiveCamera } from "three";
let initialized = false;
// Wrap camera FOV to allow animation of fov
export function initCameraExtensions() {
if (initialized) return;
initialized = true;
Object.defineProperty(PerspectiveCamera.prototype, "fov", {
get: function () {
return this._fov;;
},
set: function (val) {
const changed = val !== this._fov;
this._fov = val;
if (changed && this.view !== undefined) this.updateProjectionMatrix();
},
configurable: true
});
Object.defineProperty(PerspectiveCamera.prototype, "near", {
get: function () {
return this._near;
},
set: function (val) {
const changed = val !== this._near;
this._near = val;
if (changed && this.view !== undefined) this.updateProjectionMatrix();
},
configurable: true
});
Object.defineProperty(PerspectiveCamera.prototype, "far", {
get: function () {
return this._far;
},
set: function (val) {
const changed = val !== this._far;
this._far = val;
if (changed && this.view !== undefined) this.updateProjectionMatrix();
},
configurable: true
});
}