projects/atft/src/lib/object/abstract-lazy-object-3d.ts
OnDestroy
Properties |
|
Methods |
|
Inputs |
Outputs |
layer | |
Type : number
|
|
Default value : 0
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:42
|
name | |
Type : string
|
|
Default value : uuidv4()
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:40
|
rotateX | |
Type : number
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:24
|
|
Rotation in Euler angles (radians) with order X, Y, Z. |
rotateY | |
Type : number
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:25
|
rotateZ | |
Type : number
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:26
|
scaleX | |
Type : number
|
|
Default value : 1
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:36
|
scaleY | |
Type : number
|
|
Default value : 1
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:37
|
scaleZ | |
Type : number
|
|
Default value : 1
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:38
|
translateX | |
Type : number
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:31
|
|
Translate the geometry. This is typically done as a one time operation, and not during a loop. |
translateY | |
Type : number
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:32
|
translateZ | |
Type : number
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:33
|
changed | |
Type : EventEmitter
|
|
Inherited from
AbstractObject3D
|
|
Defined in
AbstractObject3D:44
|
Protected afterInit |
afterInit()
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:33
|
Returns :
void
|
Protected Abstract loadLazyObject |
loadLazyObject()
|
Abstract method for lazy loading
Returns :
Promise<THREE.Object3D>
|
Protected newObject3DInstance |
newObject3DInstance()
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:68
|
Returns :
THREE.Object3D
|
ngOnDestroy |
ngOnDestroy()
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:62
|
Returns :
void
|
Protected startLoading |
startLoading()
|
Returns :
void
|
Public addChild | ||||||
addChild(object: AbstractObject3D<any>)
|
||||||
Inherited from
AbstractObject3D
|
||||||
Defined in
AbstractObject3D:143
|
||||||
Parameters :
Returns :
void
|
Public applyRotation |
applyRotation()
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:118
|
Returns :
void
|
Public applyScale |
applyScale()
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:135
|
Returns :
void
|
Public applyTranslation |
applyTranslation()
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:127
|
Returns :
void
|
Public findByName | ||||||
findByName(name: string)
|
||||||
Inherited from
AbstractObject3D
|
||||||
Defined in
AbstractObject3D:185
|
||||||
Parameters :
Returns :
any
|
Public getChildren |
getChildren()
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:202
|
Returns :
Array<AbstractObject3D<any>>
|
Public getObject |
getObject()
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:175
|
Returns :
T
|
Public ngAfterViewInit |
ngAfterViewInit()
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:181
|
Returns :
void
|
Public ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Inherited from
AbstractObject3D
|
||||||
Defined in
AbstractObject3D:57
|
||||||
Parameters :
Returns :
void
|
Public ngOnInit |
ngOnInit()
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:97
|
Returns :
void
|
Protected recursionByName | |||||||||
recursionByName(currentNode: AbstractObject3D<any>, name: string)
|
|||||||||
Inherited from
AbstractObject3D
|
|||||||||
Defined in
AbstractObject3D:192
|
|||||||||
Parameters :
Returns :
any
|
Public removeChild | ||||||
removeChild(object: AbstractObject3D<any>)
|
||||||
Inherited from
AbstractObject3D
|
||||||
Defined in
AbstractObject3D:160
|
||||||
Parameters :
Returns :
void
|
Public removeChildByName | ||||||
removeChildByName(name: string)
|
||||||
Inherited from
AbstractObject3D
|
||||||
Defined in
AbstractObject3D:206
|
||||||
Parameters :
Returns :
void
|
Public updateParent |
updateParent()
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:111
|
Returns :
void
|
Protected lazyObject |
Type : THREE.Object3D | undefined
|
This is reference to lazy loaded Object3D (async after init) |
Private parentInitialized |
Default value : false
|
Flag to signal whether the parentScene class instance AbstractObject3D called the overwritten method AbstractModelLoader yet. Unless that method was called, no methods and properties of AbstractObject3D may be safely accessed, especially AbstractObject3D and AbstractObject3D.renderer. |
Protected childlren |
Type : Array<AbstractObject3D<any>>
|
Default value : []
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:46
|
Protected object |
Type : T
|
Inherited from
AbstractObject3D
|
Defined in
AbstractObject3D:48
|
import {Directive, OnDestroy} from '@angular/core';
import {AbstractObject3D} from './abstract-object-3d';
import * as THREE from 'three';
@Directive()
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class AbstractLazyObject3D extends AbstractObject3D<THREE.Object3D> implements OnDestroy {
/**
* Flag to signal whether the parentScene class instance AbstractObject3D called the
* overwritten method {@link AbstractModelLoader#afterInit} yet.
*
* Unless that method was called, no methods and properties of {@link AbstractObject3D}
* may be safely accessed, especially {@link AbstractObject3D#addChild} and
* {@link AbstractObject3D.renderer}.
*/
private parentInitialized = false;
/**
* This is reference to lazy loaded Object3D (async after init)
*/
protected lazyObject: THREE.Object3D | undefined;
/**
* Abstract method for lazy loading
*
*/
protected abstract loadLazyObject(): Promise<THREE.Object3D>;
protected override afterInit() {
super.afterInit();
this.parentInitialized = true;
this.startLoading();
}
protected startLoading() {
// console.log('AbstractLazyObject3D.startLoading', this.name + ' / '+this.parentInitialized);
// Trigger model acquisition now that the parentScene has been initialized.
this.loadLazyObject().then(obj => {
// console.log('AbstractLazyObject3D loaded');
// remove old if exists
if (this.lazyObject) {
super.getObject().remove(this.lazyObject);
}
// add lazy object to scene
this.lazyObject = obj;
super.getObject().add(obj);
this.rendererService.render();
setTimeout(() => {
this.rendererService.render();
}, 10);
}).catch(err => {
console.error(err);
});
}
override ngOnDestroy(): void {
if (this.lazyObject) {
super.getObject().remove(this.lazyObject);
}
}
protected newObject3DInstance(): THREE.Object3D {
// Just empty object (holder of lazy object)
return new THREE.Object3D();
}
}