StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
StackGenVis/frontend/node_modules/gl-plot2d/lib/line.js

63 lines
1.3 KiB

'use strict'
module.exports = createLines
var createBuffer = require('gl-buffer')
var createShader = require('gl-shader')
var shaders = require('./shaders')
function Lines(plot, vbo, shader) {
this.plot = plot
this.vbo = vbo
this.shader = shader
}
var proto = Lines.prototype
proto.bind = function() {
var shader = this.shader
this.vbo.bind()
this.shader.bind()
shader.attributes.coord.pointer()
shader.uniforms.screenBox = this.plot.screenBox
}
proto.drawLine = (function() {
var start = [0,0]
var end = [0,0]
return function(startX, startY, endX, endY, width, color) {
var plot = this.plot
var shader = this.shader
var gl = plot.gl
start[0] = startX
start[1] = startY
end[0] = endX
end[1] = endY
shader.uniforms.start = start
shader.uniforms.end = end
shader.uniforms.width = width * plot.pixelRatio
shader.uniforms.color = color
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4)
}
}())
proto.dispose = function() {
this.vbo.dispose()
this.shader.dispose()
}
function createLines(plot) {
var gl = plot.gl
var vbo = createBuffer(gl, [
-1,-1,
-1,1,
1,-1,
1,1])
var shader = createShader(gl, shaders.lineVert, shaders.lineFrag)
var lines = new Lines(plot, vbo, shader)
return lines
}