dist/videocontext.js
/**
	    * Initialise an instance of a ProcessingNode.
	    *
	    * This class is not used directly, but is extended to create CompositingNodes, TransitionNodes, and EffectNodes.
	    */
Initialise an instance of a ProcessingNode.
This class is not used directly, but is extended to create CompositingNodes, TransitionNodes, and EffectNodes.
Initialise an instance of a ProcessingNode . This class is not used directly but is extended to create CompositingNodes TransitionNodes and EffectNodes .
function ProcessingNode(gl, renderGraph, definition, inputNames, limitConnections) {
	        var _this = this;
	        _classCallCheck(this, ProcessingNode);
	        _get(Object.getPrototypeOf(ProcessingNode.prototype), "constructor", this).call(this, gl, renderGraph, inputNames, limitConnections);
	        this._vertexShader = (0, _utilsJs.compileShader)(gl, definition.vertexShader, gl.VERTEX_SHADER);
	        this._fragmentShader = (0, _utilsJs.compileShader)(gl, definition.fragmentShader, gl.FRAGMENT_SHADER);
	        this._definition = definition;
	        this._properties = {}; 
	        for (var propertyName in definition.properties) {
	            var propertyValue = definition.properties[propertyName].value;
	            if (Object.prototype.toString.call(propertyValue) === "[object Array]") {
	                propertyValue = definition.properties[propertyName].value.slice();
	            }
	            var propertyType = definition.properties[propertyName].type;
	            this._properties[propertyName] = { type: propertyType, value: propertyValue };
	        }
	        this._inputTextureUnitMapping = [];
	        this._maxTextureUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
	        this._boundTextureUnits = 0;
	        this._parameterTextureCount = 0;
	        this._inputTextureCount = 0;
	        this._texture = (0, _utilsJs.createElementTexutre)(gl);
	        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.canvas.width, gl.canvas.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
	        this._program = (0, _utilsJs.createShaderProgram)(gl, this._vertexShader, this._fragmentShader);
	        this._framebuffer = gl.createFramebuffer();
	        gl.bindFramebuffer(gl.FRAMEBUFFER, this._framebuffer);
	        gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._texture, 0);
	        gl.bindFramebuffer(gl.FRAMEBUFFER, null);
	        var _loop = function (propertyName) {
	            Object.defineProperty(_this, propertyName, {
	                get: function get() {
	                    return this._properties[propertyName].value;
	                },
	                set: function set(passedValue) {
	                    this._properties[propertyName].value = passedValue;
	                }
	            });
	        };
	        for (var propertyName in this._properties) {
	            _loop(propertyName);
	        }
	        for (var propertyName in this._properties) {
	            var propertyValue = this._properties[propertyName].value;
	            if (propertyValue instanceof Image) {
	                this._properties[propertyName].texture = (0, _utilsJs.createElementTexutre)(gl);
	                this._properties[propertyName].texutreUnit = gl.TEXTURE0 + this._boundTextureUnits;
	                this._boundTextureUnits += 1;
	                this._parameterTextureCount += 1;
	                if (this._boundTextureUnits > this._maxTextureUnits) {
	                    throw new _exceptionsJs.RenderException("Trying to bind more than available textures units to shader");
	                }
	            }
	        }
	        var _iteratorNormalCompletion = true;
	        var _didIteratorError = false;
	        var _iteratorError = undefined;
	        try {
	            for (var _iterator = definition.inputs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
	                var inputName = _step.value;
	                this._inputTextureUnitMapping.push({ name: inputName, textureUnit: gl.TEXTURE0 + this._boundTextureUnits });
	                this._boundTextureUnits += 1;
	                this._inputTextureCount += 1;
	                if (this._boundTextureUnits > this._maxTextureUnits) {
	                    throw new _exceptionsJs.RenderException("Trying to bind more than available textures units to shader");
	                }
	            }
	        } catch (err) {
	            _didIteratorError = true;
	            _iteratorError = err;
	        } finally {
	            try {
	                if (!_iteratorNormalCompletion && _iterator["return"]) {
	                    _iterator["return"]();
	                }
	            } finally {
	                if (_didIteratorError) {
	                    throw _iteratorError;
	                }
	            }
	        }
	        for (var propertyName in this._properties) {
	            if (this._properties[propertyName].type === "uniform") {
	                this._properties[propertyName].location = this._gl.getUniformLocation(this._program, propertyName);
	            }
	        }
	        this._currentTimeLocation = this._gl.getUniformLocation(this._program, "currentTime");
	        this._currentTime = 0;
	        var positionLocation = gl.getAttribLocation(this._program, "a_position");
	        var buffer = gl.createBuffer();
	        gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
	        gl.enableVertexAttribArray(positionLocation);
	        gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);
	        gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0]), gl.STATIC_DRAW);
	        var texCoordLocation = gl.getAttribLocation(this._program, "a_texCoord");
	        gl.enableVertexAttribArray(texCoordLocation);
	        gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0);
	        this._displayName = "ProcessingNode";
	    }
function ProcessingNode ( gl , renderGraph , definition , inputNames , limitConnections ) { var _this = this ; _classCallCheck ( this , ProcessingNode ) ; _get ( Object . getPrototypeOf ( ProcessingNode . prototype ) , "constructor" , this ) . call ( this , gl , renderGraph , inputNames , limitConnections ) ; this . _vertexShader = ( 0 , _utilsJs . compileShader ) ( gl , definition . vertexShader , gl . VERTEX_SHADER ) ; this . _fragmentShader = ( 0 , _utilsJs . compileShader ) ( gl , definition . fragmentShader , gl . FRAGMENT_SHADER ) ; this . _definition = definition ; this . _properties = { } ; for ( var propertyName in definition . properties ) { var propertyValue = definition . properties [ propertyName ] . value ; if ( Object . prototype . toString . call ( propertyValue ) === "[object Array]" ) { propertyValue = definition . properties [ propertyName ] . value . slice ( ) ; } var propertyType = definition . properties [ propertyName ] . type ; this . _properties [ propertyName ] = { type : propertyType , value : propertyValue } ; } this . _inputTextureUnitMapping = [ ] ; this . _maxTextureUnits = gl . getParameter ( gl . MAX_TEXTURE_IMAGE_UNITS ) ; this . _boundTextureUnits = 0 ; this . _parameterTextureCount = 0 ; this . _inputTextureCount = 0 ; this . _texture = ( 0 , _utilsJs . createElementTexutre ) ( gl ) ; gl . texImage2D ( gl . TEXTURE_2D , 0 , gl . RGBA , gl . canvas . width , gl . canvas . height , 0 , gl . RGBA , gl . UNSIGNED_BYTE , null ) ; this . _program = ( 0 , _utilsJs . createShaderProgram ) ( gl , this . _vertexShader , this . _fragmentShader ) ; this . _framebuffer = gl . createFramebuffer ( ) ; gl . bindFramebuffer ( gl . FRAMEBUFFER , this . _framebuffer ) ; gl . framebufferTexture2D ( gl . FRAMEBUFFER , gl . COLOR_ATTACHMENT0 , gl . TEXTURE_2D , this . _texture , 0 ) ; gl . bindFramebuffer ( gl . FRAMEBUFFER , null ) ; var _loop = function ( propertyName ) { Object . defineProperty ( _this , propertyName , { get : function get ( ) { return this . _properties [ propertyName ] . value ; } , set : function set ( passedValue ) { this . _properties [ propertyName ] . value = passedValue ; } } ) ; } ; for ( var propertyName in this . _properties ) { _loop ( propertyName ) ; } for ( var propertyName in this . _properties ) { var propertyValue = this . _properties [ propertyName ] . value ; if ( propertyValue instanceof Image ) { this . _properties [ propertyName ] . texture = ( 0 , _utilsJs . createElementTexutre ) ( gl ) ; this . _properties [ propertyName ] . texutreUnit = gl . TEXTURE0 + this . _boundTextureUnits ; this . _boundTextureUnits += 1 ; this . _parameterTextureCount += 1 ; if ( this . _boundTextureUnits > this . _maxTextureUnits ) { throw new _exceptionsJs . RenderException ( "Trying to bind more than available textures units to shader" ) ; } } } var _iteratorNormalCompletion = true ; var _didIteratorError = false ; var _iteratorError = undefined ; try { for ( var _iterator = definition . inputs [ Symbol . iterator ] ( ) , _step ; ! ( _iteratorNormalCompletion = ( _step = _iterator . next ( ) ) . done ) ; _iteratorNormalCompletion = true ) { var inputName = _step . value ; this . _inputTextureUnitMapping . push ( { name : inputName , textureUnit : gl . TEXTURE0 + this . _boundTextureUnits } ) ; this . _boundTextureUnits += 1 ; this . _inputTextureCount += 1 ; if ( this . _boundTextureUnits > this . _maxTextureUnits ) { throw new _exceptionsJs . RenderException ( "Trying to bind more than available textures units to shader" ) ; } } } catch ( err ) { _didIteratorError = true ; _iteratorError = err ; } finally { try { if ( ! _iteratorNormalCompletion && _iterator [ "return" ] ) { _iterator [ "return" ] ( ) ; } } finally { if ( _didIteratorError ) { throw _iteratorError ; } } } for ( var propertyName in this . _properties ) { if ( this . _properties [ propertyName ] . type === "uniform" ) { this . _properties [ propertyName ] . location = this . _gl . getUniformLocation ( this . _program , propertyName ) ; } } this . _currentTimeLocation = this . _gl . getUniformLocation ( this . _program , "currentTime" ) ; this . _currentTime = 0 ; var positionLocation = gl . getAttribLocation ( this . _program , "a_position" ) ; var buffer = gl . createBuffer ( ) ; gl . bindBuffer ( gl . ARRAY_BUFFER , buffer ) ; gl . enableVertexAttribArray ( positionLocation ) ; gl . vertexAttribPointer ( positionLocation , 2 , gl . FLOAT , false , 0 , 0 ) ; gl . bufferData ( gl . ARRAY_BUFFER , new Float32Array ( [ 1.0 , 1.0 , 0.0 , 1.0 , 1.0 , 0.0 , 1.0 , 0.0 , 0.0 , 1.0 , 0.0 , 0.0 ] ) , gl . STATIC_DRAW ) ; var texCoordLocation = gl . getAttribLocation ( this . _program , "a_texCoord" ) ; gl . enableVertexAttribArray ( texCoordLocation ) ; gl . vertexAttribPointer ( texCoordLocation , 2 , gl . FLOAT , false , 0 , 0 ) ; this . _displayName = "ProcessingNode" ; }
Initialise an instance of a ProcessingNode.
Initialise an instance of a ProcessingNode .
//definition.properties; //copy definition properties //if an array then shallow copy it //compile the shader //create and setup the framebuffer //create properties on this object for the passed properties //create texutres for any texture properties //calculate texutre units for input textures //find the locations of the properties in the compiled shader //Other setup