Skip to content

Commit

Permalink
added option to turn off bumpy flatmap
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhuth committed Jul 14, 2017
1 parent ff54b2e commit 3e7274f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cortex/webgl/resources/js/mriview_surface.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var mriview = (function(module) {

thickmix: { type:'f', value:0.5},
surfmix: { type:'f', value:0},
bumpyflat: { type:'i', value:true},

//hatch: { type:'t', value:0, texture: module.makeHatch() },
//hatchrep: { type:'v2', value:new THREE.Vector2(108, 40) },
Expand All @@ -77,6 +78,7 @@ var mriview = (function(module) {
pivot: {action:[this, "setPivot", -180, 180]},
shift: {action:[this, "setShift", 0, 200]},
depth: {action:[this.uniforms.thickmix, "value", 0, 1]},
bumpy_flatmap: {action:[this.uniforms.bumpyflat, "value"]},
changeDepth: {action: this.changeDepth.bind(this), wheel: true, modKeys: ['altKey'], hidden: true},
opacity: {action:[this.uniforms.dataAlpha, "value", 0, 1]},
left: {action:[this, "setLeftVis"]},
Expand Down
6 changes: 4 additions & 2 deletions cortex/webgl/resources/js/shaderlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ var Shaderlib = (function() {
THREE.ShaderChunk[ "lights_phong_pars_vertex" ],
"uniform mat4 volxfm[2];",
"uniform float thickmix;",
"uniform int bumpyflat;",
"float f_bumpyflat = float(bumpyflat);",

"attribute vec4 wm;",
"attribute vec3 wmnorm;",
Expand Down Expand Up @@ -397,10 +399,10 @@ var Shaderlib = (function() {

"#ifdef CORTSHEET",
// "pos += clamp(surfmix*"+(morphs-1)+"., 0., 1.) * normalize(norm) * .62 * distance(position, wm.xyz) * mix(1., 0., thickmix);",
"pos += clamp(surfmix*"+(morphs-1)+"., 0., 1.) * normalize(norm) * mix(1., 0., thickmix) * flatheight;",
"pos += clamp(surfmix*"+(morphs-1)+"., 0., 1.) * normalize(norm) * mix(1., 0., thickmix) * flatheight * f_bumpyflat;",
"#endif",

"vNormal = normalMatrix * mix(norm, flatBumpNorms, (1.0 - thickmix) * clamp(surfmix*"+(morphs-1)+". - 1.0, 0., 1.));",
"vNormal = normalMatrix * mix(norm, flatBumpNorms, (1.0 - thickmix) * clamp(surfmix*"+(morphs-1)+". - 1.0, 0., 1.) * f_bumpyflat);",
// "vNormal = normalMatrix * norm;",
"gl_Position = projectionMatrix * modelViewMatrix * vec4( pos, 1.0 );",

Expand Down

0 comments on commit 3e7274f

Please sign in to comment.