Skip to content

Commit

Permalink
Add other types to mixer.fs
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeodrippe committed Jan 3, 2025
1 parent 99755bc commit d06bd9f
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
# - develop
- develop
paths-ignore:
- '**/README.md'
- '**/CHANGELOG.md'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Add `vf/entity-debug` and `vf/systems-debug`
- Add `vj/ContactManifold`
- Improve error for VybeC compilation
- Add `mixer.fs`

## v0.7.444

Expand Down
75 changes: 68 additions & 7 deletions resources/com/pfeodrippe/vybe/shaders/mixer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,81 @@ in vec4 fragColor;
uniform sampler2D texture0;
uniform sampler2D texture1;
uniform vec4 colDiffuse;
uniform float edge_fill;
uniform float u_fill;
uniform float u_time;

// Output fragment color
out vec4 finalColor;

bool fill_whole(vec2 st) {
float c = 1.0;
bool trigger =
st.x * st.y < sin(u_fill * 0.87 * c) * cos(u_fill * 0.23 * c) + sin(u_fill * 0.37 * c) * cos(u_fill * 0.53 * c)
//st.x > sin(u_fill * 0.24) * 1.0 && st.x < sin(u_fill * 0.87 * c) &&
//st.y > sin(u_fill * 0.41 * c) * 0.4 && st.y < sin(u_fill * 0.46 * c)
;

return trigger;
}

bool fill_blob(vec2 st) {
if (u_fill < -0.5) return false;

float c = 0.5;
bool trigger = false;

float t = sin(u_time * 0.8) * 0.1;
float r = u_fill * 0.5 + t;


// Circle.
if ((st.x - c) * (st.x - c) + (st.y - c) * (st.y - c) < r/5.0) {
trigger = true;
}

// Square.
// if (st.x - 0.5 < 0.25 * u_fill && st.y - 0.5 < 0.25 * u_fill &&
// st.x - 0.5 > -0.25 * u_fill && st.y - 0.5 > -0.25 * u_fill) {
// trigger = true;
// }

/*
if ((sin(st.x + cos(u_time*0.532) * 0.05) - c) * (sin(st.x + cos(u_time*0.3) * 0.04) - c) +
(sin(st.y + sin(u_time * 0.2) * 0.145) - c) * (sin(st.y + sin(u_time * 0.153) * 0.1) - c)
< r/1.0 * st.x * st.y * cos(st.x * u_time * 0.1) * sin(st.y * u_time * 0.2)) {
trigger = true;
}
*/

/*
if ((sin(st.x + cos(u_time*0.532) * 0.05) - c) * (sin(st.x + cos(u_time*0.3) * 0.04) - c) +
(sin(st.y + sin(u_time * 0.2) * 0.145) - c) * (sin(st.y + sin(u_time * 0.153) * 0.1) - c)
< r/8.0) {
trigger = true;
}
*/

// dots
/*
if ((st.x - c) * (st.x - c) + (st.y - c) * (st.y - c) < r/5.0) {
if (sin(st.y*99999.0) > 0.0001 && cos(st.x*100000.0) > 0.0001) {
trigger = true;
} else {
trigger = false;
}
}
*/

return trigger;
}

void main (void) {
vec2 st = fragTexCoord;
// Higher radius is like an out of focus effect.
float radius = 1.1;

float c = 1.0;bool trigger =
st.x * st.y < sin(edge_fill * 0.87 * c) * cos(edge_fill * 0.23 * c) + sin(edge_fill * 0.37 * c) * cos(edge_fill * 0.53 * c)
//st.x > sin(edge_fill * 0.24) * 1.0 && st.x < sin(edge_fill * 0.87 * c) &&
//st.y > sin(edge_fill * 0.41 * c) * 0.4 && st.y < sin(edge_fill * 0.46 * c)
float c = 1.0;
bool trigger =
//fill_whole(st)
fill_blob(st)
;

if (trigger) {
Expand Down
3 changes: 2 additions & 1 deletion resources/shaders/edge_2d.fs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ void main (void) {
finalColor = texelColor*colDiffuse*fragColor;
} else {
finalColor = vec4(color,1.0);
}*/
}
*/

finalColor = vec4(color, 1.0);
} else {
Expand Down
17 changes: 10 additions & 7 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,20 @@
- [x] portion of the window
- [x] only when cube clicked
- [x] LPF when enabled
- [ ] 2 worlds
- [ ] different objects
- [x] 2 worlds
- [x] different objects
- [x] disable/enable object
- [x] render to another RT
- [x] shader to mix the RTs
- [ ] transition from a blob
- [ ] multiple worlds, render twice?
- [ ] 2-player where you pass one object to the other?
- [ ] one in english, another in french?
- [ ] 3d?
- [ ] transition from a blob
- [ ] square
- [ ] circle
- [ ] animate blob
- [ ] multiple worlds, render twice?
- [ ] 2-player where you pass one object to the other?
- [ ] 3d?
- [ ] mechanic
- [ ] one in english, another in french?
- [ ] ambisonics
- [ ] 2 sources
- [ ] system
Expand Down

0 comments on commit d06bd9f

Please sign in to comment.