Back to home page

EIC code displayed by LXR

 
 

    


Warning, /firebird/firebird-ng/src/app/painters/component-painter.ts is written in an unsupported language. File is not indexed.

0001 import { Object3D } from "three";
0002 import { EntryComponent } from "../model/entry-component";
0003 import {disposeNode} from "../utils/three.utils";
0004 
0005 
0006 /** Define the type for the constructor of ComponentPainter subclasses */
0007 export type ComponentPainterConstructor = new (node: Object3D, component: EntryComponent) => ComponentPainter;
0008 
0009 /** Paints all primitives for a given EntryComponent */
0010 export abstract class ComponentPainter {
0011 
0012   /** Constructor is public since we can instantiate directly */
0013   constructor(protected parentNode: Object3D, protected component: EntryComponent) {}
0014 
0015   /** Gets the `type` identifier for the component this class works with */
0016   public get componentType() {
0017     return this.component.type;
0018   }
0019 
0020   /**
0021    * Paints
0022    * @param time - time in [ns], null - draw in non-dynamic mode (all visible)
0023    */
0024   abstract paint(time: number | null): void;
0025 
0026   /** Dispose method to clean up resources */
0027   public dispose(): void {
0028     // Remove node from the scene
0029     if (this.parentNode) {
0030       disposeNode(this.parentNode);
0031     }
0032   }
0033 }