Socket
Socket
Sign inDemoInstall

gl-line3d

Package Overview
Dependencies
Maintainers
24
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gl-line3d - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

0

example/multicolor.js

@@ -0,0 +0,0 @@ "use strict"

@@ -0,0 +0,0 @@ "use strict"

@@ -0,0 +0,0 @@ var glslify = require('glslify')

136

lines.js

@@ -85,2 +85,3 @@ 'use strict'

proto.drawTransparent = proto.draw = function (camera) {
if (!this.vertexCount) return
var gl = this.gl

@@ -107,2 +108,3 @@ var shader = this.shader

proto.drawPick = function (camera) {
if (!this.vertexCount) return
var gl = this.gl

@@ -140,12 +142,2 @@ var shader = this.pickShader

var positions = options.position || options.positions
if (!positions) {
return
}
// Default color
var colors = options.color || options.colors || [0, 0, 0, 1]
var lineWidth = options.lineWidth || 1
// Recalculate buffer data

@@ -160,70 +152,88 @@ var buffer = []

[ -Infinity, -Infinity, -Infinity ]]
var hadGap = false
fill_loop:
for (i = 1; i < positions.length; ++i) {
var a = positions[i - 1]
var b = positions[i]
var positions = options.position || options.positions
if (positions) {
arcLengthArray.push(arcLength)
pointArray.push(a.slice())
// Default color
var colors = options.color || options.colors || [0, 0, 0, 1]
for (j = 0; j < 3; ++j) {
if (isNaN(a[j]) || isNaN(b[j]) ||
!isFinite(a[j]) || !isFinite(b[j])) {
var lineWidth = options.lineWidth || 1
if (!connectGaps && buffer.length > 0) {
for (var k = 0; k < 24; ++k) {
buffer.push(buffer[buffer.length - 12])
var hadGap = false
fill_loop:
for (i = 1; i < positions.length; ++i) {
var a = positions[i - 1]
var b = positions[i]
arcLengthArray.push(arcLength)
pointArray.push(a.slice())
for (j = 0; j < 3; ++j) {
if (isNaN(a[j]) || isNaN(b[j]) ||
!isFinite(a[j]) || !isFinite(b[j])) {
if (!connectGaps && buffer.length > 0) {
for (var k = 0; k < 24; ++k) {
buffer.push(buffer[buffer.length - 12])
}
vertexCount += 2
hadGap = true
}
vertexCount += 2
hadGap = true
continue fill_loop
}
bounds[0][j] = Math.min(bounds[0][j], a[j], b[j])
bounds[1][j] = Math.max(bounds[1][j], a[j], b[j])
}
continue fill_loop
var acolor, bcolor
if (Array.isArray(colors[0])) {
acolor = (colors.length > i - 1) ? colors[i - 1] : // using index value
(colors.length > 0) ? colors[colors.length - 1] : // using last item
[0, 0, 0, 1]; // using black
bcolor = (colors.length > i) ? colors[i] : // using index value
(colors.length > 0) ? colors[colors.length - 1] : // using last item
[0, 0, 0, 1]; // using black
} else {
acolor = bcolor = colors
}
bounds[0][j] = Math.min(bounds[0][j], a[j], b[j])
bounds[1][j] = Math.max(bounds[1][j], a[j], b[j])
}
var acolor, bcolor
if (Array.isArray(colors[0])) {
acolor = colors[i - 1]
bcolor = colors[i]
} else {
acolor = bcolor = colors
}
if (acolor.length === 3) {
acolor = [acolor[0], acolor[1], acolor[2], 1]
}
if (bcolor.length === 3) {
bcolor = [bcolor[0], bcolor[1], bcolor[2], 1]
}
if (acolor.length === 3) {
acolor = [acolor[0], acolor[1], acolor[2], 1]
}
if (bcolor.length === 3) {
bcolor = [bcolor[0], bcolor[1], bcolor[2], 1]
}
var w0
if (Array.isArray(lineWidth)) {
w0 = lineWidth[i - 1]
} else {
w0 = lineWidth
}
var w0
if (Array.isArray(lineWidth)) {
w0 = (lineWidth.length > i - 1) ? lineWidth[i - 1] : // using index value
(lineWidth.length > 0) ? lineWidth[lineWidth.length - 1] : // using last item
[0, 0, 0, 1]; // using black
} else {
w0 = lineWidth
}
var t0 = arcLength
arcLength += distance(a, b)
var t0 = arcLength
arcLength += distance(a, b)
if (hadGap) {
for (j = 0; j < 2; ++j) {
buffer.push(
a[0], a[1], a[2], b[0], b[1], b[2], t0, w0, acolor[0], acolor[1], acolor[2], acolor[3])
if (hadGap) {
for (j = 0; j < 2; ++j) {
buffer.push(
a[0], a[1], a[2], b[0], b[1], b[2], t0, w0, acolor[0], acolor[1], acolor[2], acolor[3])
}
vertexCount += 2
hadGap = false
}
vertexCount += 2
hadGap = false
}
buffer.push(
a[0], a[1], a[2], b[0], b[1], b[2], t0, w0, acolor[0], acolor[1], acolor[2], acolor[3],
a[0], a[1], a[2], b[0], b[1], b[2], t0, -w0, acolor[0], acolor[1], acolor[2], acolor[3],
b[0], b[1], b[2], a[0], a[1], a[2], arcLength, -w0, bcolor[0], bcolor[1], bcolor[2], bcolor[3],
b[0], b[1], b[2], a[0], a[1], a[2], arcLength, w0, bcolor[0], bcolor[1], bcolor[2], bcolor[3])
buffer.push(
a[0], a[1], a[2], b[0], b[1], b[2], t0, w0, acolor[0], acolor[1], acolor[2], acolor[3],
a[0], a[1], a[2], b[0], b[1], b[2], t0, -w0, acolor[0], acolor[1], acolor[2], acolor[3],
b[0], b[1], b[2], a[0], a[1], a[2], arcLength, -w0, bcolor[0], bcolor[1], bcolor[2], bcolor[3],
b[0], b[1], b[2], a[0], a[1], a[2], arcLength, w0, bcolor[0], bcolor[1], bcolor[2], bcolor[3])
vertexCount += 4
vertexCount += 4
}
}

@@ -230,0 +240,0 @@ this.buffer.update(buffer)

{
"name": "gl-line3d",
"version": "1.1.4",
"version": "1.1.5",
"description": "3D line plot",

@@ -5,0 +5,0 @@ "main": "lines.js",

@@ -0,0 +0,0 @@ gl-line3d

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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