Skip to content

Commit

Permalink
Merge pull request #10 from gl-vis/vertexIntensityBounds
Browse files Browse the repository at this point in the history
add `vertexIntensityBounds` param
  • Loading branch information
etpinard committed Jun 1, 2017
2 parents 1dfcb27 + 894b143 commit 6861cfc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Creates a simplicial complex that can be drawn directly in a WebGL context.
+ `vertexUVs`
+ `cellUVs`
+ `vertexIntensity`
+ `colormap`
+ `vertexIntensityBounds` intensity range for the colormap
+ `cellIntensity`
+ `cellColors` A list of per cell color attributes
+ `meshColor` A constant color for the entire mesh
Expand Down Expand Up @@ -100,4 +102,4 @@ Epsilon for face normals calculation
Opacity

# Credits
(c) 2013-2015 Mikola Lysenko. MIT License
(c) 2013-2015 Mikola Lysenko. MIT License
13 changes: 9 additions & 4 deletions mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,15 @@ proto.update = function(params) {
var intensityHi = -Infinity
if(!vertexUVs && !cellUVs) {
if(vertexIntensity) {
for(var i=0; i<vertexIntensity.length; ++i) {
var f = vertexIntensity[i]
intensityLo = Math.min(intensityLo, f)
intensityHi = Math.max(intensityHi, f)
if(params.vertexIntensityBounds) {
intensityLo = +params.vertexIntensityBounds[0]
intensityHi = +params.vertexIntensityBounds[1]
} else {
for(var i=0; i<vertexIntensity.length; ++i) {
var f = vertexIntensity[i]
intensityLo = Math.min(intensityLo, f)
intensityHi = Math.max(intensityHi, f)
}
}
} else if(cellIntensity) {
for(var i=0; i<cellIntensity.length; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"colormap": "^2.1.0",
"gl-buffer": "^2.0.8",
"gl-mat4": "^1.0.0",
"gl-shader": "^4.0.5",
"gl-shader": "4.2.0",
"gl-texture2d": "^2.0.8",
"gl-vao": "^1.1.3",
"glsl-specular-cook-torrance": "^2.0.1",
Expand Down

0 comments on commit 6861cfc

Please sign in to comment.