Jellyfish forms

The Jellyfish VM is now running in fluxus on android – a kind of executable rendering primitive which defines it’s form (a 3D triangle list) in the same place as it’s behaviour (a vector processing program), in the primitive’s data array.

This provides a 3D procedural modelling VM loosely inspired by the Playstation 2 which is much faster than interpreting scheme (or Java) on ARM devices like android. There are also possibilities for genetic programming or touch based programming interfaces just like Betablocker DS (think 3D animation rather than music).

Triangles are written to by de-referencing a register that defines the start of the model data, which exists in program memory. It can be programmed with raw vectors for each instruction, and right now the VM is run for 10 cycles for each frame, although this will be configurable “in the future”. Here is a simple program that was used to make the screenshots:

(define jelly (build-jellyfish))

(with-primitive jelly
 (program-jellyfish
  (list
 ; data
   (vector 0 0 0)         ; time (increases by 1 each loop)
   (vector 2 2 -3)        ; shuffle data for converting (x y z) -> (z z x)
 ; code follows to build a vertex by rotation around an angle based on time
   (vector LDA 0 0)       ; load current time from address 0
   (vector LDL 135.3 0)   ; load value 135.3 (angle in degrees)
   (vector MUL 0 0)       ; multiply time by angle
   (vector SIN 0 0)       ; makes (sin(angle) cos(angle) 0)
 ; make a spiral by scaling up with time
   (vector LDA 0 0)       ; load time again
   (vector LDL 0.05 0)    ; load 0.05
   (vector MUL 0 0)       ; multiply to get time*0.05
   (vector MUL 0 0)       ; mul rotation vector by time*0.05
 ; move backward in z so we get some depth
   (vector LDA 0 0)       ; load the time again
   (vector LDL 0.03)      ; load 0.03
   (vector MUL 0 0)       ; multiply the time by 0.01
   (vector LDA 1 0)       ; load the shuffle vec from address 1 
   (vector SHF 0 0)       ; shuffle the x to z position
   (vector ADD 0 0)       ; add (0 0 x) to set z on current position
   (vector STI 0 REG_MDL) ; write position to model memory registers
 ; increment the index by 1
   (vector LDA 0 0)       ; load address
   (vector LDL 1 0)       ; load inc
   (vector ADD 0 0)       ; add them together
   (vector STA 0 0)       ; store at address loc
   (vector JMP 2 0))))    ; goto 2

3 thoughts on “Jellyfish forms

  1. Hey I’d really like to get this https://gitorious.org/flotsam/flotsam/trees/master/android/fluxus compiled to run on my android phone while I wait for nomadic :-) Could you share with me how to do it? I’m not sure if its the right approach but I’m trying to use eclipse but im getting some error trying to import the project:

    Description Resource Path Location Type
    The declared package “am.fo.nebogeo.fluxus” does not match the expected package “fo.nebogeo.fluxus” FluxusActivity.java /am.fo.nebogeo.fluxus.FluxusActivity/src/fo/nebogeo/fluxus line 17 Java Problem

    And when I try to use ndk-build i get to:

    Compile thumb : fluxus <= app-android.c
    jni/app-android.c: In function 'Java_am_fo_nebogeo_fluxus_FluxusRenderer_nativeLoadTexture':
    jni/app-android.c:132:5: warning: incompatible implicit declaration of built-in function 'sprintf' [enabled by default]
    StaticLibrary : libstdc++.a
    SharedLibrary : libfluxus.so
    ./obj/local/armeabi/objs/fluxus/engine/engine.o: In function `engine::build_jellyfish()':
    /home/soul/Downloads/flotsam-flotsam/android/fluxus/jni/engine/engine.cpp:293: undefined reference to `jellyfish_primitive::jellyfish_primitive()'
    collect2: ld returned 1 exit status
    make: *** [obj/local/armeabi/libfluxus.so] Error 1
    "
    This is probably because I have no idea what I'm doing when compiling android apps :P Still though, I Persevere!

    Also I realized that the reason I could not load the editor in fluxus-0.0.2.apk was because I don't have a trackball, and I'm pretty sure most other android phones dont either :/ Is it still the default behavior? If so, Perhaps the Settings button would be a better choice?

Leave a Reply

Your email address will not be published. Required fields are marked *