import { Dictionary } from "../common" ; import * as Specification from "../specification" ; import { Binding , ShiftBinding , TextureBinding } from "../binding/binding" ; import { Mark } from "../mark/mark" ; export abstract class PlatformMarkData { } export abstract class PlatformMark { /** Is the input attribute compiled as uniform? */ public abstract isUniform ( name ) ; /** Update a uniform in the spec, on isUniform(name) == true */ public abstract updateUniform ( name , value ) ; public abstract updateTexture ( name , value ) ; public abstract uploadData ( data ) ; /** Render the graphics */ public abstract render ( data , onRender ) ; } export class Viewport { } export class Viewport2D extends Viewport { constructor ( public width , public height ) { super ( ) ; } } export class Viewport3D extends Viewport { constructor ( public width , public height , public fov ) { super ( ) ; } } let platformConstructors = new Dictionary < ( ... args : any [ ] ) => Platform > ( ) ; export abstract class Platform { /** Compile a mark specification to PlatformMark object */ public abstract compile ( mark , spec , shader , bindings , shfitBindings ) ; /** Register a platform */ public static Register ( name , ctor ) { platformConstructors . set ( name , ctor ) ; } /** Create a platform */ public static Create ( name , ... args ) { return platformConstructors . get ( name ) ( ... args ) ; } } export function platform ( name , ... args ) { return Platform . Create ( name , ... args ) ; }