Comparing version 1.0.4 to 1.0.5
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 | ||
} |
94
mesh.js
'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" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
1366
49069
+ Added@choojs/findup@0.2.1(transitive)
+ Addedacorn@7.4.1(transitive)
+ Addedbl@0.9.5(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedduplexer2@0.0.2(transitive)
+ Addedescodegen@1.3.3(transitive)
+ Addedesprima@1.1.1(transitive)
+ Addedestraverse@1.5.1(transitive)
+ Addedesutils@1.0.0(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedfalafel@2.2.5(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedglsl-inject-defines@1.0.3(transitive)
+ Addedglsl-token-assignments@2.0.2(transitive)
+ Addedglsl-token-defines@1.0.0(transitive)
+ Addedglsl-token-depth@1.1.2(transitive)
+ Addedglsl-token-descope@1.0.2(transitive)
+ Addedglsl-token-inject-block@1.1.0(transitive)
+ Addedglsl-token-properties@1.0.1(transitive)
+ Addedglsl-token-scope@1.1.2(transitive)
+ Addedglsl-token-string@1.0.1(transitive)
+ Addedglslify@2.3.1(transitive)
+ Addedglslify-bundle@2.0.4(transitive)
+ Addedglslify-deps@1.3.2(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas@1.0.4(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedmap-limit@0.0.1(transitive)
+ Addedminimist@0.0.81.2.8(transitive)
+ Addedobject-inspect@0.4.0(transitive)
+ Addedobject-keys@0.4.0(transitive)
+ Addedonce@1.3.3(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedquote-stream@0.0.0(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedshallow-copy@0.0.1(transitive)
+ Addedsource-map@0.1.43(transitive)
+ Addedstatic-module@1.5.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedthrough2@0.4.2(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedxtend@2.1.2(transitive)
- Removedabbrev@1.1.1(transitive)
- Removedast-types@0.3.38(transitive)
- Removedcls@0.1.5(transitive)
- Removedcommondir@0.0.1(transitive)
- Removedcssauron@0.0.2(transitive)
- Removedcssauron-glsl@0.0.0(transitive)
- Removedduplexer@0.0.4(transitive)
- Removedemit-function@0.0.2(transitive)
- Removedesprima@1.2.5(transitive)
- Removedgl-shader-core@2.2.0(transitive)
- Removedglsl-deparser@0.0.2(transitive)
- Removedglsl-extract@0.0.2(transitive)
- Removedglsl-min-stream@0.0.2(transitive)
- Removedglsl-parser@0.0.51.0.1(transitive)
- Removedglsl-tokenizer@0.0.80.0.91.1.1(transitive)
- Removedglslify@1.6.1(transitive)
- Removedglslify-stream@0.4.1(transitive)
- Removedis-require@0.0.1(transitive)
- Removednew-from@0.0.3(transitive)
- Removednopt@2.2.1(transitive)
- Removedprivate@0.1.8(transitive)
- Removedrecast@0.5.27(transitive)
- Removedreplace-method@0.0.0(transitive)
- Removedresolve@0.5.1(transitive)
- Removedshortest@0.0.0(transitive)
- Removedsleuth@0.1.1(transitive)
- Removedsource-map@0.1.32(transitive)
- Removedstatic-eval@0.1.1(transitive)
- Removedstream-combiner@0.0.2(transitive)
- Removedthrough@1.1.22.3.42.3.8(transitive)
- Removedutf8-stream@0.0.0(transitive)
- Removedwrap-stream@0.0.0(transitive)
Updatedgl-shader@^4.0.5
Updatedglslify@^2.1.2