module import { AbstractProgram , IProgram , RenderParams } from "./program" ; import { EdgeDisplayData , NodeDisplayData } from "../../../../types" ; import Sigma from "../../../../sigma" ; export interface IEdgeProgram extends IProgram { computeIndices ( ) : void ; process ( sourceData , targetData , data , hidden , offset ) : void ; render ( params ) : void ; } constructor export abstract class AbstractEdgeProgram extends AbstractProgram implements IEdgeProgram { constructor ( gl , vertexShaderSource , fragmentShaderSource , points , attributes ) { super ( gl , vertexShaderSource , fragmentShaderSource , points , attributes ) ; } abstract bind ( ) ; abstract computeIndices ( ) ; abstract process ( sourceData , targetData , data , hidden , offset ) ; abstract render ( params ) ; } export interface EdgeProgramConstructor { new ( gl , renderer ) : IEdgeProgram ; } export function createEdgeCompoundProgram ( programClasses ) { return class EdgeCompoundProgram implements IEdgeProgram { programs : Array < IEdgeProgram > ; constructor ( gl , renderer ) { this . programs = programClasses . map ( ( ProgramClass ) => new ProgramClass ( gl , renderer ) ) ; } bufferData ( ) { this . programs . forEach ( ( program ) => program . bufferData ( ) ) ; } allocate ( capacity ) { this . programs . forEach ( ( program ) => program . allocate ( capacity ) ) ; } bind ( ) { } computeIndices ( ) { this . programs . forEach ( ( program ) => program . computeIndices ( ) ) ; } render ( params ) { this . programs . forEach ( ( program ) => { program . bind ( ) ; program . bufferData ( ) ; program . render ( params ) ; } ) ; } process ( sourceData , targetData , data , hidden , offset ) { this . programs . forEach ( ( program ) => program . process ( sourceData , targetData , data , hidden , offset ) ) ; } } ; }