Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add vertexIntensityBounds param #10

Merged
merged 2 commits into from
Jun 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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