Skip to content

Commit

Permalink
[Dev] lesson 45: finish
Browse files Browse the repository at this point in the history
  • Loading branch information
trixky committed Aug 15, 2024
1 parent 05fa6d2 commit c23a170
Show file tree
Hide file tree
Showing 25 changed files with 634 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
*.toto


# Output
.output
Expand Down
8 changes: 7 additions & 1 deletion src/lib/components/layout/header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
const skiped_lessons: number[] = [1, 2, 13, 26];
const finished_lessons: number[] = [
3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45
];
</script>

Expand All @@ -34,12 +34,14 @@
{@const chap2 = lesson >= 14 && lesson <= 19}
{@const chap3 = lesson >= 20 && lesson <= 26}
{@const chap4 = lesson >= 27 && lesson <= 44}
{@const chap5 = lesson >= 45 && lesson <= 48}
<li
class:disabled={skiped}
class:finished
class:chap2
class:chap3
class:chap4
class:chap5
>
{#if finished}
<a href={base + `/lessons/${lesson}`}><p>{content}</p></a>
Expand Down Expand Up @@ -92,6 +94,10 @@
@apply bg-red-200 hover:bg-red-300;
}
li.chap5.finished {
@apply bg-yellow-200 hover:bg-yellow-300;
}
li:not(.finished) {
@apply cursor-not-allowed;
}
Expand Down
18 changes: 18 additions & 0 deletions src/lib/shaders/post-processing/displacement/fragment.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
varying vec2 vUv;
uniform sampler2D tDiffuse;
uniform float uTime;

uniform float uSpeed;
uniform float uXAmplitude;
uniform float uYAmplitude;
uniform float uXFrequency;
uniform float uYFrequency;

void main() {
vec2 newVUv = vUv;
newVUv = vec2(vUv.x + sin((vUv.y + uTime * uSpeed * 0.5 * uXFrequency) * 30.0) * 0.02 * uXAmplitude, vUv.y + cos((vUv.x + uTime * uSpeed * 0.5 * uYFrequency) * 30.0) * 0.02 * uYAmplitude);

vec4 color = texture2D(tDiffuse, newVUv);

gl_FragColor = vec4(color);
}
6 changes: 6 additions & 0 deletions src/lib/shaders/post-processing/displacement/vertex.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
varying vec2 vUv;

void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
vUv = uv;
}
19 changes: 19 additions & 0 deletions src/lib/shaders/post-processing/futuristic/fragment.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
varying vec2 vUv;
uniform sampler2D tDiffuse;
uniform sampler2D uNormal;
uniform float uNormalStrength;
uniform float uBrightnessStrength;

void main() {
vec2 newVUv = vUv;
float lightness = 0.0;

vec3 normalColor = texture2D(uNormal, vUv).xyz * 2.0 - 1.0;
newVUv += normalColor.xy * uNormalStrength;
vec3 lightDirection = normalize(vec3(-1.0, 1.0, 0.0));
lightness = clamp(dot(normalize(normalColor), lightDirection), 0.0, 1.0);

vec4 color = texture2D(tDiffuse, newVUv) + lightness * uBrightnessStrength;

gl_FragColor = vec4(color);
}
6 changes: 6 additions & 0 deletions src/lib/shaders/post-processing/futuristic/vertex.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
varying vec2 vUv;

void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
vUv = uv;
}
16 changes: 16 additions & 0 deletions src/lib/shaders/post-processing/tint/fragment.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
varying vec2 vUv;
uniform sampler2D tDiffuse;
uniform vec3 uTint;
uniform float uColorAlpha;
uniform float uColorOverride;

void main() {
vec4 color = texture2D(tDiffuse, vUv);

vec3 newColor = color.rgb;
newColor += uTint * uColorAlpha;
newColor = mix(newColor, uTint, uColorOverride);
color = vec4(newColor, 1.0);

gl_FragColor = vec4(color);
}
6 changes: 6 additions & 0 deletions src/lib/shaders/post-processing/tint/vertex.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
varying vec2 vUv;

void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
vUv = uv;
}
Loading

0 comments on commit c23a170

Please sign in to comment.