New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

webgl-plot

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webgl-plot - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

14

dist/index.js

@@ -22,3 +22,3 @@ "use strict";

*/
function WebGLplot(canv) {
function WebGLplot(canv, backgroundColor) {
var devicePixelRatio = window.devicePixelRatio || 1;

@@ -36,5 +36,7 @@ // set the size of the drawingBuffer based on the size it's displayed.

this.scaleY = 1;
// Clear the canvas //??????????????????
// gl.clearColor(0.1, 0.1, 0.1, 1.0);
webgl.clearColor(0.1, 0.1, 0.1, 1.0);
this.offsetX = 0;
this.offsetY = 0;
this.backgroundColor = backgroundColor;
// Clear the canvas
webgl.clearColor(this.backgroundColor.r, this.backgroundColor.g, this.backgroundColor.b, this.backgroundColor.a);
// Enable the depth test

@@ -55,2 +57,4 @@ webgl.enable(webgl.DEPTH_TEST);

webgl.uniformMatrix2fv(uscale, false, new Float32Array([_this.scaleX, 0, 0, _this.scaleY]));
var uoffset = webgl.getUniformLocation(line.prog, "uoffset");
webgl.uniform2fv(uoffset, new Float32Array([_this.offsetX, _this.offsetY]));
var uColor = webgl.getUniformLocation(line.prog, "uColor");

@@ -72,3 +76,3 @@ webgl.uniform4fv(uColor, [line.color.r, line.color.g, line.color.b, line.color.a]);

this.webgl.bufferData(this.webgl.ARRAY_BUFFER, line.xy, this.webgl.STREAM_DRAW);
var vertCode = "\n attribute vec2 coordinates;\n uniform mat2 uscale;\n void main(void) {\n gl_Position = vec4(uscale*coordinates, 0.0, 1.0);\n }";
var vertCode = "\n attribute vec2 coordinates;\n uniform mat2 uscale;\n uniform vec2 uoffset;\n\n void main(void) {\n gl_Position = vec4(uscale*coordinates + uoffset, 0.0, 1.0);\n }";
// Create a vertex shader object

@@ -75,0 +79,0 @@ var vertShader = this.webgl.createShader(this.webgl.VERTEX_SHADER);

{
"name": "webgl-plot",
"version": "0.2.0",
"version": "0.2.1",
"description": "High-performance 2D plotting framework based on native WebGL",

@@ -5,0 +5,0 @@ "main": "./dist/index",

@@ -23,13 +23,16 @@ /**

public scaleY: number;
public offsetX: number;
public offsetY: number;
public lines: WebglBaseLine[];
public backgroundColor: ColorRGBA;
/**
*
* @param canv
* @param array
*/
constructor(canv: HTMLCanvasElement) {
/**
*
* @param canv
* @param array
*/
constructor(canv: HTMLCanvasElement, backgroundColor: ColorRGBA) {

@@ -53,9 +56,12 @@ const devicePixelRatio = window.devicePixelRatio || 1;

this.scaleY = 1;
this.offsetX = 0;
this.offsetY = 0;
this.backgroundColor = backgroundColor;
// Clear the canvas //??????????????????
// gl.clearColor(0.1, 0.1, 0.1, 1.0);
webgl.clearColor(0.1, 0.1, 0.1, 1.0);
// Clear the canvas
webgl.clearColor(this.backgroundColor.r, this.backgroundColor.g, this.backgroundColor.b, this.backgroundColor.a);
// Enable the depth test

@@ -70,3 +76,3 @@ webgl.enable(webgl.DEPTH_TEST);

}
}

@@ -84,3 +90,6 @@

const uColor = webgl.getUniformLocation(line.prog,"uColor");
const uoffset = webgl.getUniformLocation(line.prog, "uoffset");
webgl.uniform2fv(uoffset, new Float32Array([this.offsetX, this.offsetY]));
const uColor = webgl.getUniformLocation(line.prog, "uColor");
webgl.uniform4fv(uColor, [line.color.r, line.color.g, line.color.b, line.color.a]);

@@ -112,4 +121,6 @@

uniform mat2 uscale;
uniform vec2 uoffset;
void main(void) {
gl_Position = vec4(uscale*coordinates, 0.0, 1.0);
gl_Position = vec4(uscale*coordinates + uoffset, 0.0, 1.0);
}`;

@@ -158,2 +169,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