-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
forgot ui.js in last commit. Added test fragshader, not yet implemented
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
vec2 invMobius(vec2 a, vec2 b, vec2 c, vec2 d, vec2 z){ | ||
vec2 num = vec2(0,0); | ||
num.x = (d.x*z.x - d.y*z.y)-b.x; | ||
num.y = (d.x*z.y - d.y*z.x)-b.y; | ||
|
||
vec2 den; | ||
den.x = (c.x*z.x - c.y*z.y) + a.x; | ||
den.y = -(c.x*z.y + c.y*z.x) + a.y; | ||
|
||
den= den/(den.x*den.x + den.y*den.y); | ||
|
||
vec2 result; | ||
result.x = num.x*den.x - num.y*den.y; | ||
result.y = num.x*den.y + num.y*den.x; | ||
return result; | ||
|
||
} | ||
|
||
|
||
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | ||
{ | ||
vec2 uv = fragCoord.xy / iResolution.xy; | ||
uv = uv- vec2(0.5,0.5); | ||
uv = uv*3.0; | ||
vec2 a = vec2(1,1); | ||
vec2 b = vec2(0,1); | ||
vec2 c = vec2(0,1); | ||
vec2 d = vec2(1,0); | ||
vec2 transCoord = invMobius(a,b,c,d,uv); | ||
fragColor = length(transCoord)>1.0?vec4(1,1,1,1):texture(iChannel0,transCoord); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function add_2d_ctrl(parent,variable,label,min_x,max_x,min_y,max_y) { | ||
var container = document.createElement('div'); //Create the slider container | ||
container.className ="slider-container"; | ||
parent.append(container); | ||
|
||
var slider = document.createElement('div'); //Create the actual slider handle | ||
slider.className = "sliderHandle"; | ||
$(slider).draggable({ | ||
containment: "parent", //Constrain its motion to the parent | ||
drag: function(event, ui){ //When it's dragged, call this function | ||
variable.setVals(remap(ui.position.left,0,80,min_x,max_x),remap(ui.position.top,0,80,min_y,max_y)); | ||
//Add drawing update function here when added | ||
} | ||
}); | ||
container.append(slider); | ||
|
||
var caption = document.createElement('p'); | ||
caption.className = "slider-caption"; | ||
$(caption).text(label); | ||
container.append(caption); | ||
} |