Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeodrippe committed Jan 22, 2025
1 parent d0c6bf7 commit fd5f5d7
Show file tree
Hide file tree
Showing 4 changed files with 64 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
8 changes: 5 additions & 3 deletions src/vybe/flecs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@
_id (vf.c/ecs-component-init wptr desc)]
(-add-meta wptr e e-id :vybe.flecs.type/component)
(-cache-entity wptr e e-id)
(vf.c/ecs-doc-set-name wptr e-id (vp/comp-name e))
#_(-set-c wptr e-id [on-instantiate-inherit-id])
e-id)

Expand Down Expand Up @@ -851,10 +852,11 @@
(if (not= e-id 0)
e-id
(let [id (vf.c/ecs-set-name wptr 0 sym)]
(vf.c/ecs-doc-set-name wptr id (str e))
(when (zero? id)
(throw (ex-info "`eid` would return `0` (from keyword ecs-set-name)"
{:e e
:opts opts})))
(throw (ex-info "`eid` would return `0` (from keyword ecs-set-name)"
{:e e
:opts opts})))
#_(vf.c/ecs-set-symbol wptr id sym)
(vp/cache-comp e)
(-add-meta wptr e id :vybe.flecs.type/keyword)
Expand Down
44 changes: 44 additions & 0 deletions src/vybe/game/system.clj
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,50 @@

(vf/modified! w node c)))

#_(vf/defsystem-c animation-node-player-2 w
[abc1 [:vg.anim/target-node :*]
abc2 [:vg.anim/target-component :*]
#_ #_ #_ #_ #_ #_ #_ #_ #_ #_ node-ref vf/Ref
{:keys [timeline_count values timeline]} vt/AnimationChannel
player [:meta {:flags #{:up :cascade}
:inout :mut}
vt/AnimationPlayer]
parent-e [:vf/entity {:flags #{:up}} :vg.anim/active]
_ [:not {:flags #{:up}} :vg.anim/stop]]
#_[[_ node] [:vg.anim/target-node :*]
[_ c] [:vg.anim/target-component :*]
node-ref vf/Ref
{:keys [timeline_count values timeline]} vt/AnimationChannel
player [:meta {:flags #{:up :cascade}
:inout :mut}
vt/AnimationPlayer]
parent-e [:vf/entity {:flags #{:up}} :vg.anim/active]
_ [:not {:flags #{:up}} :vg.anim/stop]]
#_(let [values (vp/arr values timeline_count c)
timeline (vp/arr timeline timeline_count :float)
idx* (first (indices #(>= % (:current_time player)) timeline))
idx (max (dec (or idx* (count timeline))) 0)
t (when idx*
(/ (- (:current_time player)
(nth timeline idx))
(- (nth timeline (inc idx))
(nth timeline idx))))]

(when-not idx*
(conj parent-e :vg.anim/stop)
;; Just for triggering the `animation-loop` system.
(conj (vf/ent w node) :vg.anim.entity/stop))

;; We modify the component from the ref and then we have to notify flecs
;; that it was modified.
(merge @node-ref (if t
(lerp-p (nth values idx)
(nth values (inc idx))
t)
(nth values idx)))

(vf/modified! w node c)))

(vf/defsystem animation-loop w
[[_ action] [:vg.anim/loop :*]
_ [:maybe :vg.anim.entity/stop]
Expand Down
26 changes: 14 additions & 12 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
- [x] animate blob
- [x] gltf loading test
- [x] remove need for raylib for testing
- [ ] VybeC
- [x] VybeC
- [x] move existing system into VybeC from C
- [x] direct translation
- [x] compile
Expand All @@ -271,17 +271,7 @@
- [x] eval
- [x] macro to quickly evaluate stuff
- [-] REPL plugin like portal does for cljs?
- [ ] better way to jump to definition
- [ ] allocator setting
- [ ] comptime
- [ ] exe mode
- [ ] check that we don't have unitialized resources in the init function if
in this mode
- [ ] use generics for a `vp/mem` equivalent in VybeC
- [ ] share `matrix-transform` code
- [ ] make `@, vp/&` etc better
- [ ] create a merge or reset! "protocol" leveraging C generics
- [ ] make recompilation work with an indirection?
- [ ] try to VybeC animation-node-player
- [ ] provide models
- [ ] minimal
- [ ] more complex
Expand Down Expand Up @@ -408,6 +398,18 @@
- [ ] flecs entity
- [ ] flecs system
- [ ] tap from C into portal
- [ ] VybeC
- [ ] better way to jump to definition
- [ ] allocator setting
- [ ] comptime
- [ ] exe mode
- [ ] check that we don't have unitialized resources in the init function if
in this mode
- [ ] use generics for a `vp/mem` equivalent in VybeC
- [ ] share `matrix-transform` code
- [ ] make `@, vp/&` etc better
- [ ] create a merge or reset! "protocol" leveraging C generics
- [ ] make recompilation work with an indirection?
- [ ] make it easy to DSP in the frequency domain
- [ ] create filters in realtime from clerk
- [ ] wasm
Expand Down

0 comments on commit fd5f5d7

Please sign in to comment.