import { watcher } from '@feng3d/watcher'; import { IcosahedronGeometry } from '../../thirdparty/three/imports'; import { BufferGeometry3D } from '../core/BufferGeometry3D'; export class IcosahedronGeometry3D extends BufferGeometry3D { radius = 1; detail = 0; get _geometry() { if (!this.__geometry) { this.__geometry = new IcosahedronGeometry(this.radius, this.detail); } return this.__geometry; } declare protected __geometry: IcosahedronGeometry; constructor() { super(); watcher.watchs(this as IcosahedronGeometry3D, ['radius', 'detail'], this._invalidate, this); } destroy() { watcher.unwatchs(this as IcosahedronGeometry3D, ['radius', 'detail'], this._invalidate, this); } clone() { const geometry = new IcosahedronGeometry3D(); geometry.radius = this.radius; geometry.detail = this.detail; geometry.__geometry = this._geometry.clone() as IcosahedronGeometry; return geometry; } }