Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parsegraph-compileprogram

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parsegraph-compileprogram - npm Package Compare versions

Comparing version 2.2.22-dev to 2.2.22

501

parsegraph-compileprogram/dist/src/index.js

@@ -1,501 +0,2 @@

(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("parsegraph-checkglerror"));
else if(typeof define === 'function' && define.amd)
define(["parsegraph-checkglerror"], factory);
else if(typeof exports === 'object')
exports["parsegraph_compileprogram"] = factory(require("parsegraph-checkglerror"));
else
root["parsegraph_compileprogram"] = factory(root["parsegraph_checkglerror"]);
})(this, (__WEBPACK_EXTERNAL_MODULE_parsegraph_checkglerror__) => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./src/BasicGLProvider.ts":
/*!********************************!*\
!*** ./src/BasicGLProvider.ts ***!
\********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! parsegraph-checkglerror */ "parsegraph-checkglerror");
/* harmony import */ var parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var parsegraph_rect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! parsegraph-rect */ "./node_modules/parsegraph-rect/dist/src/index.js");
/* harmony import */ var parsegraph_rect__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(parsegraph_rect__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var parsegraph_method__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! parsegraph-method */ "./node_modules/parsegraph-method/dist/src/index.js");
/* harmony import */ var parsegraph_method__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(parsegraph_method__WEBPACK_IMPORTED_MODULE_2__);
var BasicGLProvider = /** @class */function () {
function BasicGLProvider() {
this._shaders = {};
this._gl = null;
this._contextChangedListener = new (parsegraph_method__WEBPACK_IMPORTED_MODULE_2___default())();
this._container = document.createElement("div");
this._explicitWidth = null;
this._explicitHeight = null;
}
BasicGLProvider.prototype.onContextChanged = function (isLost) {
if (isLost) {
var keys = [];
for (var k in this._shaders) {
if (Object.prototype.hasOwnProperty.call(this._shaders, k)) {
keys.push(k);
}
}
for (var i in keys) {
if (Object.prototype.hasOwnProperty.call(keys, i)) {
delete this._shaders[keys[i]];
}
}
}
this._contextChangedListener.call(isLost);
};
BasicGLProvider.prototype.setOnContextChanged = function (listener, listenerObj) {
this._contextChangedListener.set(listener, listenerObj);
};
BasicGLProvider.prototype.shaders = function () {
return this._shaders;
};
BasicGLProvider.prototype.hasGL = function () {
return !!this._gl;
};
BasicGLProvider.prototype.createGL = function () {
return this.canvas().getContext("webgl");
};
BasicGLProvider.prototype.gl = function () {
if (this.hasGL()) {
return this._gl;
}
this._gl = this.createGL();
if (this._gl) {
parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0___default()(this._gl, "WebGL creation");
return this._gl;
}
throw new Error("GL context is not supported");
};
BasicGLProvider.prototype.hasCanvas = function () {
return !!this._canvas;
};
BasicGLProvider.prototype.createCanvas = function () {
var _this = this;
// The 3D canvas that will be drawn to.
var canvas = document.createElement("canvas");
canvas.addEventListener("webglcontextlost", function (event) {
// console.log('Context lost');
event.preventDefault();
_this.onContextChanged(true);
}, false);
canvas.addEventListener("webglcontextrestored", function () {
// console.log("Context restored");
_this.onContextChanged(false);
}, false);
canvas.addEventListener("contextmenu", function (e) {
e.preventDefault();
}, false);
canvas.style.display = "block";
return canvas;
};
BasicGLProvider.prototype.canvas = function () {
if (!this.hasCanvas()) {
this._canvas = this.createCanvas();
this.container().appendChild(this._canvas);
}
return this._canvas;
};
BasicGLProvider.prototype.getSize = function (sizeOut) {
if (!sizeOut) {
sizeOut = new (parsegraph_rect__WEBPACK_IMPORTED_MODULE_1___default())();
}
sizeOut.setX(0);
sizeOut.setY(0);
sizeOut.setWidth(this.width());
sizeOut.setHeight(this.height());
return sizeOut;
};
BasicGLProvider.prototype.resize = function (w, h) {
this.container().style.width = typeof w === "number" ? w + "px" : w;
if (arguments.length === 1) {
h = w;
}
this.container().style.height = typeof h === "number" ? h + "px" : h;
};
BasicGLProvider.prototype.setExplicitSize = function (w, h) {
this._explicitWidth = w;
this._explicitHeight = h;
this.resize(w, h);
};
BasicGLProvider.prototype.getWidth = function () {
return this._explicitWidth || this.container().clientWidth;
};
BasicGLProvider.prototype.width = function () {
return this.getWidth();
};
BasicGLProvider.prototype.getHeight = function () {
return this._explicitHeight || this.container().clientHeight;
};
BasicGLProvider.prototype.height = function () {
return this.getHeight();
};
/**
* @return {HTMLElement} Returns the container that holds the canvas for this graph.
*/
BasicGLProvider.prototype.container = function () {
return this._container;
};
BasicGLProvider.prototype.setBackground = function (bg) {
this.container().style.backgroundColor = bg.asRGBA();
if (this.hasGL() && !this.gl().isContextLost()) {
this.gl().clearColor(bg.r(), bg.g(), bg.b(), bg.a());
}
};
/**
* @return {boolean} Returns whether the window has a nonzero client width and height.
*/
BasicGLProvider.prototype.canProject = function () {
var displayWidth = this.getWidth();
var displayHeight = this.getHeight();
return displayWidth != 0 && displayHeight != 0;
};
/**
* Renders this provider's content, resizing the canvas to its container.
*
* The default implementation only sets the WebGL's clear color to the
* background but does not clear the canvas.
*
* @return {boolean} true if this provider needs an additional call to complete rendering its content.
* @throws if the scene cannot be projected to, as determined by canProject
*/
BasicGLProvider.prototype.render = function () {
if (this.hasGL() && this.gl().isContextLost()) {
return true;
}
if (!this.canProject()) {
throw new Error("Refusing to render to an unprojectable window." + " Use canProject() to handle, and parent this" + " window's container to fix.");
}
if (this.hasCanvas()) {
// Lookup the size the browser is displaying the canvas.
var displayWidth = this.width();
var displayHeight = this.height();
// Check if the canvas is not the same size.
if (this.canvas().width != displayWidth || this.canvas().height != displayHeight) {
// Make the canvas the same size
this.canvas().width = displayWidth;
this.canvas().height = displayHeight;
}
}
return false;
};
return BasicGLProvider;
}();
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BasicGLProvider);
/***/ }),
/***/ "./src/ProxyGLProvider.ts":
/*!********************************!*\
!*** ./src/ProxyGLProvider.ts ***!
\********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
var ProxyGLProvider = /** @class */function () {
function ProxyGLProvider(window) {
this._glProvider = window;
}
ProxyGLProvider.prototype.setOnContextChanged = function (listener, listenerObj) {
this.glProvider().setOnContextChanged(listener, listenerObj);
};
ProxyGLProvider.prototype.glProvider = function () {
return this._glProvider;
};
ProxyGLProvider.prototype.width = function () {
return this.glProvider().width();
};
ProxyGLProvider.prototype.canProject = function () {
return this.glProvider().canProject();
};
ProxyGLProvider.prototype.render = function () {
return this.glProvider().render();
};
ProxyGLProvider.prototype.height = function () {
return this.glProvider().height();
};
ProxyGLProvider.prototype.shaders = function () {
return this.glProvider().shaders();
};
ProxyGLProvider.prototype.container = function () {
return this.glProvider().container();
};
ProxyGLProvider.prototype.hasCanvas = function () {
return this.glProvider().hasCanvas();
};
ProxyGLProvider.prototype.canvas = function () {
return this.glProvider().canvas();
};
ProxyGLProvider.prototype.hasGL = function () {
return this.glProvider().hasGL();
};
ProxyGLProvider.prototype.gl = function () {
return this.glProvider().gl();
};
return ProxyGLProvider;
}();
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ProxyGLProvider);
/***/ }),
/***/ "./src/WebGL2Provider.ts":
/*!*******************************!*\
!*** ./src/WebGL2Provider.ts ***!
\*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _BasicGLProvider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BasicGLProvider */ "./src/BasicGLProvider.ts");
var __extends = undefined && undefined.__extends || function () {
var _extendStatics = function extendStatics(d, b) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function (d, b) {
d.__proto__ = b;
} || function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return _extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
_extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
}();
var WebGL2Provider = /** @class */function (_super) {
__extends(WebGL2Provider, _super);
function WebGL2Provider() {
return _super !== null && _super.apply(this, arguments) || this;
}
WebGL2Provider.prototype.createGL = function () {
return this.canvas().getContext("webgl2", {
antialias: true
});
};
return WebGL2Provider;
}(_BasicGLProvider__WEBPACK_IMPORTED_MODULE_0__["default"]);
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (WebGL2Provider);
/***/ }),
/***/ "./src/compileProgram.ts":
/*!*******************************!*\
!*** ./src/compileProgram.ts ***!
\*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ compileProgram)
/* harmony export */ });
/* harmony import */ var parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! parsegraph-checkglerror */ "parsegraph-checkglerror");
/* harmony import */ var parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var parsegraph_shader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! parsegraph-shader */ "./node_modules/parsegraph-shader/dist/src/index.js");
/* harmony import */ var parsegraph_shader__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(parsegraph_shader__WEBPACK_IMPORTED_MODULE_1__);
function compileProgram(glProvider, shaderName, vertexShader, fragShader) {
var gl = glProvider.gl();
var shaders = glProvider.shaders();
if (gl.isContextLost()) {
return;
}
if (shaders[shaderName]) {
return shaders[shaderName];
}
var program = gl.createProgram();
parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0___default()(gl, "compileProgram.createProgram(shaderName='", shaderName, ")");
var compiledVertexShader = (0,parsegraph_shader__WEBPACK_IMPORTED_MODULE_1__.compileShader)(gl, vertexShader, gl.VERTEX_SHADER, shaderName);
parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0___default()(gl, "compileProgram.compile vertex shader(shaderName='", shaderName, ")");
gl.attachShader(program, compiledVertexShader);
parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0___default()(gl, "compileProgram.attach vertex shader(shaderName='", shaderName, ")");
var compiledFragmentShader = (0,parsegraph_shader__WEBPACK_IMPORTED_MODULE_1__.compileShader)(gl, fragShader, gl.FRAGMENT_SHADER, shaderName);
parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0___default()(gl, "compileProgram.compile fragment shader(shaderName='", shaderName, ")");
gl.attachShader(program, compiledFragmentShader);
parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0___default()(gl, "compileProgram.attach fragment shader(shaderName='", shaderName, ")");
gl.linkProgram(program);
if (!(0,parsegraph_checkglerror__WEBPACK_IMPORTED_MODULE_0__.ignoreGLErrors)()) {
var st = gl.getProgramParameter(program, gl.LINK_STATUS);
if (!st) {
throw new Error("'" + shaderName + "' shader program failed to link:\n" + gl.getProgramInfoLog(program));
}
var err = gl.getError();
if (err != gl.NO_ERROR && err != gl.CONTEXT_LOST_WEBGL) {
throw new Error("'" + shaderName + "' shader program failed to link: " + err);
}
}
shaders[shaderName] = program;
// console.log("Created shader for " + shaderName + ": " + program);
return program;
}
/***/ }),
/***/ "./node_modules/parsegraph-method/dist/src/index.js":
/*!**********************************************************!*\
!*** ./node_modules/parsegraph-method/dist/src/index.js ***!
\**********************************************************/
/***/ (function(module) {
!function(t,e){ true?module.exports=e():0}(this,(function(){return(()=>{"use strict";var t={d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>n});var o=function(){function t(t,e){this.set(t,e)}return t.prototype.canCall=function(){return null!=this._func},t.prototype.clear=function(){this.set(null,null)},t.prototype.set=function(t,e){this._func=t,this._funcThisArg=e},t.prototype.call=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(this.canCall())return this._func.apply(this._funcThisArg,t)},t.prototype.apply=function(t){if(this.canCall())return this._func.apply(this._funcThisArg,t)},t}();const n=o;return e})()}));
/***/ }),
/***/ "./node_modules/parsegraph-rect/dist/src/index.js":
/*!********************************************************!*\
!*** ./node_modules/parsegraph-rect/dist/src/index.js ***!
\********************************************************/
/***/ (function(module) {
!function(t,i){ true?module.exports=i():0}(this,(function(){return(()=>{"use strict";var t={d:(i,e)=>{for(var h in e)t.o(e,h)&&!t.o(i,h)&&Object.defineProperty(i,h,{enumerable:!0,get:e[h]})},o:(t,i)=>Object.prototype.hasOwnProperty.call(t,i),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},i={};t.r(i),t.d(i,{default:()=>h});var e=function(){function t(t,i,e,h){this._x=t,this._y=i,this._width=e,this._height=h}return t.prototype.isNaN=function(){return isNaN(this._x)||isNaN(this._y)||isNaN(this._width)||isNaN(this._height)},t.prototype.toNaN=function(){this._x=NaN,this._y=NaN,this._width=NaN,this._height=NaN},t.prototype.clear=function(){this.toNaN()},t.prototype.reset=function(){this.toNaN()},t.prototype.x=function(){return this._x},t.prototype.setX=function(t){this._x=t},t.prototype.y=function(){return this._y},t.prototype.setY=function(t){this._y=t},t.prototype.clone=function(i){return i?(this.copy(i),i):new t(this.x(),this.y(),this.width(),this.height())},t.prototype.copy=function(t){return t?(t.setX(this.x()),t.setY(this.y()),t.setWidth(this.width()),t.setHeight(this.height()),t):this.clone()},t.prototype.translate=function(t,i){this.setX(this.x()+t),this.setY(this.y()+i)},t.prototype.scale=function(t,i){arguments.length<2&&(i=t),this.setX(this.x()*t),this.setY(this.y()*i),this.setWidth(this.width()*t),this.setHeight(this.height()*i)},t.prototype.height=function(){return this._height},t.prototype.setHeight=function(t){this._height=t},t.prototype.width=function(){return this._width},t.prototype.w=function(){return this.width()},t.prototype.h=function(){return this.height()},t.prototype.setWidth=function(t){this._width=t},t.prototype.toString=function(){return"[Rect x="+this.x()+", y="+this.y()+", w="+this.width()+", h="+this.height()+"]"},t.prototype.vMin=function(){return this.y()-this.height()/2},t.prototype.vMax=function(){return this.y()+this.height()/2},t.prototype.hMin=function(){return this.x()-this.width()/2},t.prototype.hMax=function(){return this.x()+this.width()/2},t.prototype.include=function(t,i,e,h){if(this.isNaN())return this._x=t,this._y=i,this._width=e,void(this._height=h);var o=this._x,s=this._y,n=this._width,r=this._height,p=Math.min(o-n/2,t-e/2),u=Math.max(o+n/2,t+e/2),y=Math.min(s-r/2,i-h/2),c=u-p,f=Math.max(s+r/2,i+h/2)-y,a=p+c/2,d=y+f/2;this._x=a,this._y=d,this._width=c,this._height=f},t}();const h=e;return i})()}));
/***/ }),
/***/ "./node_modules/parsegraph-shader/dist/src/index.js":
/*!**********************************************************!*\
!*** ./node_modules/parsegraph-shader/dist/src/index.js ***!
\**********************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
!function(r,e){ true?module.exports=e(__webpack_require__(/*! parsegraph-checkglerror */ "parsegraph-checkglerror")):0}(this,(r=>(()=>{"use strict";var e={561:e=>{e.exports=r}},t={};function o(r){var a=t[r];if(void 0!==a)return a.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,o),n.exports}o.n=r=>{var e=r&&r.__esModule?()=>r.default:()=>r;return o.d(e,{a:e}),e},o.d=(r,e)=>{for(var t in e)o.o(e,t)&&!o.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})},o.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),o.r=r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var a={};return(()=>{o.r(a),o.d(a,{compileShader:()=>e,createProgram:()=>t,createProgramFromScripts:()=>p,createShaderFromScriptTag:()=>n});var r=o(561);function e(e,t,o,a){var n=e.createShader(o);if(!(e.shaderSource(n,t),e.compileShader(n),(0,r.ignoreGLErrors)()||e.getShaderParameter(n,e.COMPILE_STATUS)))throw new Error("Could not compile "+(o===e.FRAGMENT_SHADER?"fragment":"vertex")+" shader "+a+": "+e.getShaderInfoLog(n));return n}function t(r,e,t){var o=r.createProgram();if(r.attachShader(o,e),r.attachShader(o,t),r.linkProgram(o),!r.getProgramParameter(o,r.LINK_STATUS))throw new Error("program filed to link:"+r.getProgramInfoLog(o));return o}function n(r,t,o){var a=document.getElementById(t);if(!a)throw new Error("*** Error: unknown script element: "+t);var n=a.text;if(!o)if("x-shader/x-vertex"==a.type)o=r.VERTEX_SHADER;else if("x-shader/x-fragment"==a.type)o=r.FRAGMENT_SHADER;else if(!o)throw new Error("*** Error: shader type not set");return e(r,n,o)}function p(r,e,o){return t(r,n(r,e),n(r,o))}})(),a})()));
/***/ }),
/***/ "parsegraph-checkglerror":
/*!**************************************************************************************************************************************************************!*\
!*** external {"commonjs":"parsegraph-checkglerror","commonjs2":"parsegraph-checkglerror","amd":"parsegraph-checkglerror","root":"parsegraph_checkglerror"} ***!
\**************************************************************************************************************************************************************/
/***/ ((module) => {
"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE_parsegraph_checkglerror__;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
/*!**********************!*\
!*** ./src/index.ts ***!
\**********************/
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "BasicGLProvider": () => (/* reexport safe */ _BasicGLProvider__WEBPACK_IMPORTED_MODULE_2__["default"]),
/* harmony export */ "ProxyGLProvider": () => (/* reexport safe */ _ProxyGLProvider__WEBPACK_IMPORTED_MODULE_1__["default"]),
/* harmony export */ "WebGL2Provider": () => (/* reexport safe */ _WebGL2Provider__WEBPACK_IMPORTED_MODULE_0__["default"]),
/* harmony export */ "compileProgram": () => (/* reexport safe */ _compileProgram__WEBPACK_IMPORTED_MODULE_3__["default"])
/* harmony export */ });
/* harmony import */ var _WebGL2Provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./WebGL2Provider */ "./src/WebGL2Provider.ts");
/* harmony import */ var _ProxyGLProvider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ProxyGLProvider */ "./src/ProxyGLProvider.ts");
/* harmony import */ var _BasicGLProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BasicGLProvider */ "./src/BasicGLProvider.ts");
/* harmony import */ var _compileProgram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./compileProgram */ "./src/compileProgram.ts");
})();
/******/ return __webpack_exports__;
/******/ })()
;
});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("parsegraph-checkglerror")):"function"==typeof define&&define.amd?define(["parsegraph-checkglerror"],e):"object"==typeof exports?exports.parsegraph_compileprogram=e(require("parsegraph-checkglerror")):t.parsegraph_compileprogram=e(t.parsegraph_checkglerror)}(this,(t=>(()=>{var e={243:function(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>o});var r=function(){function t(t,e){this.set(t,e)}return t.prototype.canCall=function(){return null!=this._func},t.prototype.clear=function(){this.set(null,null)},t.prototype.set=function(t,e){this._func=t,this._funcThisArg=e},t.prototype.call=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(this.canCall())return this._func.apply(this._funcThisArg,t)},t.prototype.apply=function(t){if(this.canCall())return this._func.apply(this._funcThisArg,t)},t}();const o=r;return e})()},462:function(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>o});var r=function(){function t(t,e,r,o){this._x=t,this._y=e,this._width=r,this._height=o}return t.prototype.isNaN=function(){return isNaN(this._x)||isNaN(this._y)||isNaN(this._width)||isNaN(this._height)},t.prototype.toNaN=function(){this._x=NaN,this._y=NaN,this._width=NaN,this._height=NaN},t.prototype.clear=function(){this.toNaN()},t.prototype.reset=function(){this.toNaN()},t.prototype.x=function(){return this._x},t.prototype.setX=function(t){this._x=t},t.prototype.y=function(){return this._y},t.prototype.setY=function(t){this._y=t},t.prototype.clone=function(e){return e?(this.copy(e),e):new t(this.x(),this.y(),this.width(),this.height())},t.prototype.copy=function(t){return t?(t.setX(this.x()),t.setY(this.y()),t.setWidth(this.width()),t.setHeight(this.height()),t):this.clone()},t.prototype.translate=function(t,e){this.setX(this.x()+t),this.setY(this.y()+e)},t.prototype.scale=function(t,e){arguments.length<2&&(e=t),this.setX(this.x()*t),this.setY(this.y()*e),this.setWidth(this.width()*t),this.setHeight(this.height()*e)},t.prototype.height=function(){return this._height},t.prototype.setHeight=function(t){this._height=t},t.prototype.width=function(){return this._width},t.prototype.w=function(){return this.width()},t.prototype.h=function(){return this.height()},t.prototype.setWidth=function(t){this._width=t},t.prototype.toString=function(){return"[Rect x="+this.x()+", y="+this.y()+", w="+this.width()+", h="+this.height()+"]"},t.prototype.vMin=function(){return this.y()-this.height()/2},t.prototype.vMax=function(){return this.y()+this.height()/2},t.prototype.hMin=function(){return this.x()-this.width()/2},t.prototype.hMax=function(){return this.x()+this.width()/2},t.prototype.include=function(t,e,r,o){if(this.isNaN())return this._x=t,this._y=e,this._width=r,void(this._height=o);var n=this._x,i=this._y,s=this._width,h=this._height,a=Math.min(n-s/2,t-r/2),c=Math.max(n+s/2,t+r/2),p=Math.min(i-h/2,e-o/2),u=c-a,l=Math.max(i+h/2,e+o/2)-p,d=a+u/2,f=p+l/2;this._x=d,this._y=f,this._width=u,this._height=l},t}();const o=r;return e})()},402:function(t,e,r){var o;t.exports=(o=r(561),(()=>{"use strict";var t={561:t=>{t.exports=o}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{r.r(n),r.d(n,{compileShader:()=>e,createProgram:()=>o,createProgramFromScripts:()=>s,createShaderFromScriptTag:()=>i});var t=r(561);function e(e,r,o,n){var i=e.createShader(o);if(e.shaderSource(i,r),e.compileShader(i),!(0,t.ignoreGLErrors)()&&!e.getShaderParameter(i,e.COMPILE_STATUS))throw new Error("Could not compile "+(o===e.FRAGMENT_SHADER?"fragment":"vertex")+" shader "+n+": "+e.getShaderInfoLog(i));return i}function o(t,e,r){var o=t.createProgram();if(t.attachShader(o,e),t.attachShader(o,r),t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS))throw new Error("program filed to link:"+t.getProgramInfoLog(o));return o}function i(t,r,o){var n=document.getElementById(r);if(!n)throw new Error("*** Error: unknown script element: "+r);var i=n.text;if(!o)if("x-shader/x-vertex"==n.type)o=t.VERTEX_SHADER;else if("x-shader/x-fragment"==n.type)o=t.FRAGMENT_SHADER;else if(!o)throw new Error("*** Error: shader type not set");return e(t,i,o)}function s(t,e,r){return o(t,i(t,e),i(t,r))}})(),n})())},561:e=>{"use strict";e.exports=t}},r={};function o(t){var n=r[t];if(void 0!==n)return n.exports;var i=r[t]={exports:{}};return e[t].call(i.exports,i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";o.r(n),o.d(n,{BasicGLProvider:()=>a,ProxyGLProvider:()=>l,WebGL2Provider:()=>u,compileProgram:()=>f});var t=o(561),e=o.n(t),r=o(462),i=o.n(r),s=o(243),h=o.n(s);const a=function(){function t(){this._shaders={},this._gl=null,this._contextChangedListener=new(h()),this._container=document.createElement("div"),this._explicitWidth=null,this._explicitHeight=null}return t.prototype.onContextChanged=function(t){if(t){var e=[];for(var r in this._shaders)Object.prototype.hasOwnProperty.call(this._shaders,r)&&e.push(r);for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&delete this._shaders[e[o]]}this._contextChangedListener.call(t)},t.prototype.setOnContextChanged=function(t,e){this._contextChangedListener.set(t,e)},t.prototype.shaders=function(){return this._shaders},t.prototype.hasGL=function(){return!!this._gl},t.prototype.createGL=function(){return this.canvas().getContext("webgl")},t.prototype.gl=function(){if(this.hasGL())return this._gl;if(this._gl=this.createGL(),this._gl)return e()(this._gl,"WebGL creation"),this._gl;throw new Error("GL context is not supported")},t.prototype.hasCanvas=function(){return!!this._canvas},t.prototype.createCanvas=function(){var t=this,e=document.createElement("canvas");return e.addEventListener("webglcontextlost",(function(e){e.preventDefault(),t.onContextChanged(!0)}),!1),e.addEventListener("webglcontextrestored",(function(){t.onContextChanged(!1)}),!1),e.addEventListener("contextmenu",(function(t){t.preventDefault()}),!1),e.style.display="block",e},t.prototype.canvas=function(){return this.hasCanvas()||(this._canvas=this.createCanvas(),this.container().appendChild(this._canvas)),this._canvas},t.prototype.getSize=function(t){return t||(t=new(i())),t.setX(0),t.setY(0),t.setWidth(this.width()),t.setHeight(this.height()),t},t.prototype.resize=function(t,e){this.container().style.width="number"==typeof t?t+"px":t,1===arguments.length&&(e=t),this.container().style.height="number"==typeof e?e+"px":e},t.prototype.setExplicitSize=function(t,e){this._explicitWidth=t,this._explicitHeight=e,this.resize(t,e)},t.prototype.getWidth=function(){return this._explicitWidth||this.container().clientWidth},t.prototype.width=function(){return this.getWidth()},t.prototype.getHeight=function(){return this._explicitHeight||this.container().clientHeight},t.prototype.height=function(){return this.getHeight()},t.prototype.container=function(){return this._container},t.prototype.setBackground=function(t){this.container().style.backgroundColor=t.asRGBA(),this.hasGL()&&!this.gl().isContextLost()&&this.gl().clearColor(t.r(),t.g(),t.b(),t.a())},t.prototype.canProject=function(){var t=this.getWidth(),e=this.getHeight();return 0!=t&&0!=e},t.prototype.render=function(){if(this.hasGL()&&this.gl().isContextLost())return!0;if(!this.canProject())throw new Error("Refusing to render to an unprojectable window. Use canProject() to handle, and parent this window's container to fix.");if(this.hasCanvas()){var t=this.width(),e=this.height();this.canvas().width==t&&this.canvas().height==e||(this.canvas().width=t,this.canvas().height=e)}return!1},t}();var c,p=(c=function(t,e){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},c(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});const u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e.prototype.createGL=function(){return this.canvas().getContext("webgl2",{antialias:!0})},e}(a),l=function(){function t(t){this._glProvider=t}return t.prototype.setOnContextChanged=function(t,e){this.glProvider().setOnContextChanged(t,e)},t.prototype.glProvider=function(){return this._glProvider},t.prototype.width=function(){return this.glProvider().width()},t.prototype.canProject=function(){return this.glProvider().canProject()},t.prototype.render=function(){return this.glProvider().render()},t.prototype.height=function(){return this.glProvider().height()},t.prototype.shaders=function(){return this.glProvider().shaders()},t.prototype.container=function(){return this.glProvider().container()},t.prototype.hasCanvas=function(){return this.glProvider().hasCanvas()},t.prototype.canvas=function(){return this.glProvider().canvas()},t.prototype.hasGL=function(){return this.glProvider().hasGL()},t.prototype.gl=function(){return this.glProvider().gl()},t}();var d=o(402);function f(r,o,n,i){var s=r.gl(),h=r.shaders();if(!s.isContextLost()){if(h[o])return h[o];var a=s.createProgram();e()(s,"compileProgram.createProgram(shaderName='",o,")");var c=(0,d.compileShader)(s,n,s.VERTEX_SHADER,o);e()(s,"compileProgram.compile vertex shader(shaderName='",o,")"),s.attachShader(a,c),e()(s,"compileProgram.attach vertex shader(shaderName='",o,")");var p=(0,d.compileShader)(s,i,s.FRAGMENT_SHADER,o);if(e()(s,"compileProgram.compile fragment shader(shaderName='",o,")"),s.attachShader(a,p),e()(s,"compileProgram.attach fragment shader(shaderName='",o,")"),s.linkProgram(a),!(0,t.ignoreGLErrors)()){if(!s.getProgramParameter(a,s.LINK_STATUS))throw new Error("'"+o+"' shader program failed to link:\n"+s.getProgramInfoLog(a));var u=s.getError();if(u!=s.NO_ERROR&&u!=s.CONTEXT_LOST_WEBGL)throw new Error("'"+o+"' shader program failed to link: "+u)}return h[o]=a,a}}})(),n})()));
//# sourceMappingURL=index.js.map

4

parsegraph-compileprogram/package.json
{
"name": "parsegraph-compileprogram",
"version": "2.2.22-dev",
"version": "2.2.22",
"description": "compileprogram",

@@ -47,3 +47,3 @@ "main": "dist/src/index.js",

"jsdom-global": "^3.0.2",
"parsegraph-checkglerror": "^1.5.7",
"parsegraph-checkglerror": "^1.5.8",
"prettier": "^2.8.3",

@@ -50,0 +50,0 @@ "raw-loader": "^4.0.2",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc