Skip to content

Commit

Permalink
Comment -ambisonic
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeodrippe committed Jan 4, 2025
1 parent c9a3342 commit 248aad9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 37 deletions.
18 changes: 7 additions & 11 deletions resources/com/pfeodrippe/vybe/shaders/mixer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ bool fill_blob(vec2 st) {
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;
// }
//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) +
Expand All @@ -62,15 +62,11 @@ bool fill_blob(vec2 st) {
*/

// dots
/*
if ((st.x - c) * (st.x - c) + (st.y - c) * (st.y - c) < r/5.0) {
/*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;
}
Expand Down
40 changes: 20 additions & 20 deletions src/vybe/game/system.clj
Original file line number Diff line number Diff line change
Expand Up @@ -286,26 +286,26 @@
(assoc-in [:rotation] rotation)))

;; -- Audio.
(defn- -ambisonic
[sound-source source-transform target-transform]
(let [d (vr.c/vector-3-distance
(vm/matrix->translation target-transform)
(vm/matrix->translation source-transform))
[azim elev] (let [{:keys [x y z] :as _v} (-> source-transform
(vr.c/matrix-multiply (vr.c/matrix-invert target-transform))
vm/matrix->translation)]
(if (> z 0)
[(- (Math/atan2 x z))
(Math/atan2 y z)
_v]
[(Math/atan2 x z)
(Math/atan2 y z)
_v]))
amp (if (zero? d)
1
(/ 1 (* d d)))]
(va/sound
(ctl sound-source :azim azim :elev elev :amp (* amp 100) :distance d))))
#_(defn- -ambisonic
[sound-source source-transform target-transform]
(let [d (vr.c/vector-3-distance
(vm/matrix->translation target-transform)
(vm/matrix->translation source-transform))
[azim elev] (let [{:keys [x y z] :as _v} (-> source-transform
(vr.c/matrix-multiply (vr.c/matrix-invert target-transform))
vm/matrix->translation)]
(if (> z 0)
[(- (Math/atan2 x z))
(Math/atan2 y z)
_v]
[(Math/atan2 x z)
(Math/atan2 y z)
_v]))
amp (if (zero? d)
1
(/ 1 (* d d)))]
(va/sound
(ctl sound-source :azim azim :elev elev :amp (* amp 100) :distance d))))

#_(defsynth ks1
[note {:default 60 :min 10 :max 120 :step 1}
Expand Down
12 changes: 6 additions & 6 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@
- [x] ecs_query_get
- [x] physics
- [x] trigger event when touching
- [ ] passthrough render
- [ ] shader
- [x] passthrough render
- [x] shader
- [x] portion of the window
- [x] only when cube clicked
- [x] LPF when enabled
Expand All @@ -245,10 +245,10 @@
- [x] disable/enable object
- [x] render to another RT
- [x] shader to mix the RTs
- [ ] transition from a blob
- [ ] square
- [ ] circle
- [ ] animate blob
- [x] transition from a blob
- [x] square
- [x] circle
- [x] animate blob
- [ ] multiple worlds, render twice?
- [ ] 2-player where you pass one object to the other?
- [ ] 3d?
Expand Down

0 comments on commit 248aad9

Please sign in to comment.