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

gl-mesh3d

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gl-mesh3d - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

66

lib/shaders.js
var glslify = require('glslify')
exports.meshShader = glslify({
vertex: './triangle-vertex.glsl',
fragment: './triangle-fragment.glsl',
sourceOnly: true
})
exports.wireShader = glslify({
vertex: './edge-vertex.glsl',
fragment: './edge-fragment.glsl',
sourceOnly: true
})
exports.pointShader = glslify({
vertex: './point-vertex.glsl',
fragment: './point-fragment.glsl',
sourceOnly: true
})
exports.pickShader = glslify({
vertex: './pick-vertex.glsl',
fragment: './pick-fragment.glsl',
sourceOnly: true
})
exports.pointPickShader = glslify({
vertex: './pick-point-vertex.glsl',
fragment: './pick-fragment.glsl',
sourceOnly: true
})
exports.contourShader = glslify({
vertex: './contour-vertex.glsl',
fragment: './contour-fragment.glsl',
sourceOnly: true
})
var triVertSrc = glslify('./triangle-vertex.glsl')
var triFragSrc = glslify('./triangle-fragment.glsl')
var edgeVertSrc = glslify('./edge-vertex.glsl')
var edgeFragSrc = glslify('./edge-fragment.glsl')
var pointVertSrc = glslify('./point-vertex.glsl')
var pointFragSrc = glslify('./point-fragment.glsl')
var pickVertSrc = glslify('./pick-vertex.glsl')
var pickFragSrc = glslify('./pick-fragment.glsl')
var pickPointVertSrc = glslify('./pick-point-vertex.glsl')
var contourVertSrc = glslify('./contour-vertex.glsl')
var contourFragSrc = glslify('./contour-fragment.glsl')
exports.meshShader = {
vertex: triVertSrc,
fragment: triFragSrc
}
exports.wireShader = {
vertex: edgeVertSrc,
fragment: edgeFragSrc
}
exports.pointShader = {
vertex: pointVertSrc,
fragment: pointFragSrc
}
exports.pickShader = {
vertex: pickVertSrc,
fragment: pickFragSrc
}
exports.pointPickShader = {
vertex: pickPointVertSrc,
fragment: pickFragSrc
}
exports.contourShader = {
vertex: contourVertSrc,
fragment: contourFragSrc
}
'use strict'
var createShader = require('gl-shader')
var createBuffer = require('gl-buffer')
var createVAO = require('gl-vao')
var createTexture = require('gl-texture2d')
var createShader = require('gl-shader')
var normals = require('normals')

@@ -57,3 +57,3 @@ var multiply = require('gl-mat4/multiply')

, contourVAO) {
this.gl = gl

@@ -80,3 +80,3 @@ this.cells = []

this.triangleCount = 0
this.lineWidth = 1

@@ -89,3 +89,3 @@ this.edgePositions = edgePositions

this.edgeCount = 0
this.pointPositions = pointPositions

@@ -108,6 +108,6 @@ this.pointColors = pointColors

this.bounds = [
[ Infinity, Infinity, Infinity],
[ Infinity, Infinity, Infinity],
[-Infinity,-Infinity,-Infinity] ]
this.clipBounds = [
[-Infinity,-Infinity,-Infinity],
[-Infinity,-Infinity,-Infinity],
[ Infinity, Infinity, Infinity] ]

@@ -152,3 +152,3 @@

})
var result = new Uint8Array(256*4)

@@ -243,3 +243,3 @@ for(var i=0; i<256; ++i) {

}
if(params.texture) {

@@ -293,3 +293,3 @@ this.texture.dispose()

}
//Compute colors

@@ -365,6 +365,6 @@ var vertexColors = params.vertexColors

case 1:
var v = cell[0]
var p = positions[v]
//Check NaNs

@@ -398,3 +398,3 @@ for(var j=0; j<3; ++j) {

uv = [
(vertexIntensity[v] - intensityLo) /
(vertexIntensity[v] - intensityLo) /
(intensityHi - intensityLo), 0]

@@ -405,11 +405,11 @@ } else if(cellUVs) {

uv = [
(cellIntensity[i] - intensityLo) /
(cellIntensity[i] - intensityLo) /
(intensityHi - intensityLo), 0]
} else {
uv = [
(p[2] - intensityLo) /
(p[2] - intensityLo) /
(intensityHi - intensityLo), 0]
}
pUVs.push(uv[0], uv[1])
if(pointSizes) {

@@ -425,3 +425,3 @@ pSiz.push(pointSizes[v])

break
case 2:

@@ -460,3 +460,3 @@

var uv
var uv
if(vertexUVs) {

@@ -466,3 +466,3 @@ uv = vertexUVs[v]

uv = [
(vertexIntensity[v] - intensityLo) /
(vertexIntensity[v] - intensityLo) /
(intensityHi - intensityLo), 0]

@@ -473,7 +473,7 @@ } else if(cellUVs) {

uv = [
(cellIntensity[i] - intensityLo) /
(cellIntensity[i] - intensityLo) /
(intensityHi - intensityLo), 0]
} else {
uv = [
(p[2] - intensityLo) /
(p[2] - intensityLo) /
(intensityHi - intensityLo), 0]

@@ -487,3 +487,3 @@ }

break
case 3:

@@ -508,3 +508,3 @@ //Check NaNs

var c
if(vertexColors) {
if(vertexColors) {
c = vertexColors[v]

@@ -522,3 +522,3 @@ } else if(cellColors) {

var uv
var uv
if(vertexUVs) {

@@ -528,3 +528,3 @@ uv = vertexUVs[v]

uv = [
(vertexIntensity[v] - intensityLo) /
(vertexIntensity[v] - intensityLo) /
(intensityHi - intensityLo), 0]

@@ -535,7 +535,7 @@ } else if(cellUVs) {

uv = [
(cellIntensity[i] - intensityLo) /
(cellIntensity[i] - intensityLo) /
(intensityHi - intensityLo), 0]
} else {
uv = [
(p[2] - intensityLo) /
(p[2] - intensityLo) /
(intensityHi - intensityLo), 0]

@@ -557,3 +557,3 @@ }

break
default:

@@ -567,3 +567,3 @@ break

this.triangleCount = triangleCount
this.pointPositions.update(pPos)

@@ -579,3 +579,3 @@ this.pointColors.update(pCol)

this.edgeIds.update(new Uint32Array(eIds))
this.trianglePositions.update(tPos)

@@ -585,3 +585,3 @@ this.triangleColors.update(tCol)

this.triangleNormals.update(tNor)
this.triangleIds.update(new Uint32Array(tIds))
this.triangleIds.update(new Uint32Array(tIds))
}

@@ -606,3 +606,3 @@

projection: projection,
clipBounds: clipBounds,

@@ -627,3 +627,3 @@

this.texture.bind(0)
var invCameraMatrix = new Array(16)

@@ -659,3 +659,3 @@ multiply(invCameraMatrix, uniforms.view, uniforms.model)

}
if(this.edgeCount > 0 && this.lineWidth > 0) {

@@ -671,3 +671,3 @@ var shader = this.lineShader

}
if(this.pointCount > 0) {

@@ -732,3 +732,3 @@ var shader = this.pointShader

}
if(this.edgeCount > 0) {

@@ -740,3 +740,3 @@ this.edgeVAO.bind()

}
if(this.pointCount > 0) {

@@ -772,7 +772,7 @@ var shader = this.pointPickShader

var data = closestPoint(
simplex,
[pickData.coord[0], this._resolution[1]-pickData.coord[1]],
this._model,
this._view,
this._projection,
simplex,
[pickData.coord[0], this._resolution[1]-pickData.coord[1]],
this._model,
this._view,
this._projection,
this._resolution)

@@ -892,3 +892,3 @@

var meshTexture = createTexture(gl,
var meshTexture = createTexture(gl,
ndarray(new Uint8Array([255,255,255,255]), [1,1,4]))

@@ -927,3 +927,3 @@ meshTexture.generateMipmap()

])
var edgePositions = createBuffer(gl)

@@ -952,3 +952,3 @@ var edgeColors = createBuffer(gl)

])
var pointPositions = createBuffer(gl)

@@ -989,3 +989,3 @@ var pointColors = createBuffer(gl)

}])
var mesh = new SimplicialMesh(gl

@@ -1018,5 +1018,5 @@ , meshTexture

, contourVAO)
mesh.update(params)
return mesh

@@ -1023,0 +1023,0 @@ }

{
"name": "gl-mesh3d",
"version": "1.0.4",
"version": "1.0.5",
"description": "3D mesh drawing",

@@ -14,7 +14,7 @@ "main": "mesh.js",

"gl-mat4": "^1.0.0",
"gl-shader": "^4.0.0",
"gl-shader": "^4.0.5",
"gl-texture2d": "^2.0.8",
"gl-vao": "^1.1.3",
"glsl-specular-cook-torrance": "^2.0.1",
"glslify": "^1.6.0",
"glslify": "^2.1.2",
"ndarray": "^1.0.15",

@@ -26,15 +26,3 @@ "normals": "^1.0.0",

},
"devDependencies": {
"3d-view-controls": "^1.0.1",
"bound-points": "^1.0.0",
"bunny": "^1.0.0",
"canvas-fit": "^1.2.0",
"gl-axes": "^6.0.0",
"gl-matrix": "^2.1.0",
"gl-select": "^3.0.0",
"gl-select-static": "^1.0.2",
"gl-spikes": "^2.0.1",
"mouse-change": "^1.1.1",
"simplicial-complex": "^1.0.0"
},
"devDependencies": {},
"scripts": {

@@ -41,0 +29,0 @@ "test": "echo \"Error: no test specified\" && exit 1"

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