-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,192 additions
and
4,172 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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,13 @@ | ||
AFRAME.registerShader('ring', { | ||
schema: { | ||
blur: {default: 0.01, is: 'uniform'}, | ||
color: {type: 'color', is: 'uniform'}, | ||
progress: {default: 0, is: 'uniform'}, | ||
radiusInner: {default: 0.6, is: 'uniform'}, | ||
radiusOuter: {default: 1, is: 'uniform'} | ||
}, | ||
|
||
vertexShader: require('./shaders/ring.vert.glsl'), | ||
|
||
fragmentShader: require('./shaders/ring.frag.glsl') | ||
}); |
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
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,30 @@ | ||
#if __VERSION__ == 100 | ||
#extension GL_OES_standard_derivatives : enable | ||
#endif | ||
#define PI 3.14159265358979 | ||
uniform float blur; | ||
uniform float progress; | ||
uniform float radiusInner; | ||
uniform float radiusOuter; | ||
uniform vec3 color; | ||
|
||
varying vec2 vUv; | ||
|
||
void main () { | ||
// make uvs go from -1 to 1 | ||
vec2 uv = vec2(vUv.x * 2.0 - 1.0, vUv.y * 2.0 - 1.0); | ||
// calculate distance of fragment to center | ||
float r = uv.x * uv.x + uv.y * uv.y; | ||
// calculate antialias | ||
float aa = fwidth(r); | ||
// make full circle (radiusOuter - radiusInner) | ||
float col = (1.0 - smoothstep(radiusOuter - aa, radiusOuter + blur + aa, r)) * smoothstep(radiusInner - aa, radiusInner + blur + aa, r); | ||
// radial gradient | ||
float a = smoothstep(-PI-aa, PI+aa, atan(uv.y, uv.x)); | ||
// progress angle | ||
float p = 1.0 - progress - blur; | ||
// apply progress to full circle (1 for done part, 0 for part to go) | ||
col *= smoothstep(p, p + blur, a); | ||
// multiply by user color | ||
gl_FragColor = vec4(color * col, col); | ||
} |
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,6 @@ | ||
varying vec2 vUv; | ||
|
||
void main () { | ||
vUv = uv; | ||
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); | ||
} |
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
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
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
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
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
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
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
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