Skip to content

Instantly share code, notes, and snippets.

@justinwiley
Created July 1, 2015 16:21
Show Gist options
  • Select an option

  • Save justinwiley/9849cd60f70f98951219 to your computer and use it in GitHub Desktop.

Select an option

Save justinwiley/9849cd60f70f98951219 to your computer and use it in GitHub Desktop.

Revisions

  1. justinwiley created this gist Jul 1, 2015.
    64 changes: 64 additions & 0 deletions gistfile1.rkt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,64 @@
    #lang racket/base
    (require "remote.rkt")
    ; Everything up to this mark will be stripped and replaced
    ; for the embedded version.
    ; %%%END-OF-HEADER%%%
    ;----------------------------------------------------------------------------------

    ; Data that will be pre-cached before the first frame is rendered.
    ; The uri macro defines the name and adds a cache command to the init command list.
    (uri WAV-ACTIVATE "http://s3.amazonaws.com/o.oculuscdn.com/netasset/wav/ui_object_activate_01.wav")


    ;-----------------
    ; link-button
    ; Primary navigation tool.
    ;-----------------
    (define (link-button title height target)
    (define bounds-trans (mat4-compose (mat4-translate -0.5 -0.3 -0.5)
    (mat4-scale/xyz 1.0 0.15 0.15)
    (mat4-translate 0.0 height -2.0)
    ))
    (define gaze-now (gaze-on-bounds bounds3-unit bounds-trans))

    ; Position the text
    (cmd-text! title
    (mat4-compose
    (mat4-scale 2.0)
    (mat4-translate 0.0 height -2.0))
    (if gaze-now
    (opt-parm 1.0 1.0 0.5 1.0)
    (opt-parm 0.5 0.5 1.0 1.0)))

    ; if an input click just happened and we are gazing on it, change rooms
    (if (and (pressed-action) gaze-now)
    (begin
    (display (format "Going to ~a\n" target))
    (cmd-fade! -5.0) ; to black in 1.0/5.0 seconds
    (cmd-sound! WAV-ACTIVATE)
    (cmd-link! target))
    #f)
    )
    ;-----------------
    ; tic function
    ;-----------------
    (define (tic)
    (cmd-pano! "http://s3.amazonaws.com/o.oculuscdn.com/v/test/social/avatars/office_lobby.JPG")

    (link-button "Office Tour" 0.5 "nethmd://s3.amazonaws.com/o.oculuscdn.com/netasset/office.rkt")
    (link-button "Shader Test" 0.25 "nethmd://s3.amazonaws.com/o.oculuscdn.com/netasset/shader.rkt")
    (link-button "Rotating Head" 0.0 "nethmd://s3.amazonaws.com/o.oculuscdn.com/netasset/spin.rkt")
    (link-button "Text Test" -0.25 "nethmd://s3.amazonaws.com/o.oculuscdn.com/netasset/text-panels.rkt")
    (link-button "Reversi Game" -0.5 "nethmd://s3.amazonaws.com/o.oculuscdn.com/netasset/reversi.rkt")

    (cmd-text! (format "phone ip: ~a" (init-parm "ip"))
    (mat4-compose
    (mat4-scale 2.0)
    (mat4-translate 0.0 -0.75 -2.0)))
    )

    ; This connects to the HMD over TCP when run from DrRacket, and is ignored when embedded.
    ; Replace the IP address with the value shown on the phone when NetHmd is run.
    ; The init function is optional, use #f if not defined.
    (remote "172.22.52.94" #f tic)