@pmndrs/xr
Version:
VR/AR for threejs
15 lines (14 loc) • 483 B
JavaScript
import { Mesh } from 'three';
import { updateXRPlaneGeometry } from '../plane.js';
export class XRPlaneModel extends Mesh {
constructor(plane) {
super(updateXRPlaneGeometry(plane, undefined));
this.onBeforeRender = () => {
const newGeometry = updateXRPlaneGeometry(plane, this.geometry);
if (newGeometry != this.geometry) {
this.geometry.dispose();
}
this.geometry = newGeometry;
};
}
}