CSCI-B582  -  Lecture 3.1


Outline - CAVE Programming w/ CAVELib & OpenGL - Day 3

Credits: includes notes, examples, and diagrams adapted from Dave Pape, Andy Johnson, Michael Capps, and NCSA Vis group




 

"Human in the loop" overview

diagrams from notes by Michael Capps, NPS (Naval PostGraduate School)
 

Simple View

 

Detailed View



Process Synchronization Examples

  • Unsynchronized: bounce.cc
  • Data Access Synchronized through Shared Memory Locks: bounce_lock.cc
  • Higher-level Synchronization through Process Barriers: bounce_barrier.cc

  • Navigation

    To allow interaction with environments larger than the physical extents of the CAVE, the CAVE can be moved through the VE.  This is implemented by a 4x4 transformation matrix which is applied to everything rendered in "world coordinates".

    CAVENav functions

    CAVENavLoadIdentity (void)
    CAVENavTranslate (float x, float y, float z)
    CAVENavRot (float angle, char axis)
    CAVENavScale (float xscale, float yscale, float zscale)
    CAVENavMultMatrix (float mat[4][4])
    CAVENavLoadMatrix (float mat[4][4])
    CAVENavGetMatrix (float mat[4][4])
        Operate on the current navigation matrix. These functions are similar to the corresponding GL functions.
        The transformations are in physical CAVE coordinates (they are post-multiplied).
     

    CAVENavWorldTranslate (float x, float y, float z)
    CAVENavWorldRot (float angle, char axis)
    CAVENavWorldScale (float xscale, float yscale, float zscale)
    CAVENavPreMultMatrix (float mat[4][4])
        Operate on the navigation matrix, but are pre-multiplied. These transformations thus are in world coordinates, rather than local
        CAVE coordinates.
     

    CAVENavTransform (void)
        Applies the latest navigation transformation. This should only be called in the display processes.
     

    CAVENavLock (void)
    CAVENavUnlock (void)
        Controls access to the navigation matrix, so that several transformations can be performed atomically.

    CAVE coords vs. World (Nav) coords

    CAVEGetPosition, CAVEGetVector, and CAVEGetOrientation can return either CAVE coordinates or World (Navigated) coordiates.
    Append  '_NAV' to the tracker identifier to get the navigated values.
    e.g.
        CAVEGetPosition(CAVE_WAND_NAV, pos);
        CAVEGetOrientation(CAVE_HEAD_NAV, ori);
        CAVEGetVector(CAVE_WAND_FRONT_NAV, vec);
     

    Standard "Pape" Navigator

    Conversion Functions

    CAVENavConvertCAVEToWorld (float inposition[3], float outposition[3])
    CAVENavConvertVectorCAVEToWorld (float invector[3], float outvector[3])
        Converts a position or direction vector from physical CAVE coordinates to navigated world coordinates.

    CAVENavConvertWorldToCAVE (float inposition[3], float outposition[3])
    CAVENavConvertVectorWorldToCAVE (float invector[3], float outvector[3])
        Converts a position or direction vector from navigated coordinates to physical coordinates.
     



    Time functions

    float *CAVETime
        The current "CAVE time". This records the number of seconds since CAVEInit. The variable is updated in the display loop, once
        per frame, and is stored in shared memory.

    float CAVEGetTime(void)
        Returns the current "CAVE time", i.e. the number of seconds since the CAVE was initialized. The difference between this and
        *CAVETime is that CAVEGetTime computes the time when it is called, whereas *CAVETime is only updated once per frame.

    float *CAVEFramesPerSecond
        The current frame rate. This is pointer to a float because it is stored in shared memory, and so is the same for all processes.

    Using Time for Animations

    Do not count on a constant frame rate for your animations
        height = height + 0.1;

    Animations which are absolute (i.e. a simple function of the current time) use the current time directly.
        t = CAVEGetTime();
        height = abs(sin(t));

    Animations (including most common navigation methods) which are cumulative or relative (i.e. make small incremental changes to the overall value), compute and use the change in time.
        static float prev_t;
        curr_t = CAVEGetTime();
        delta_t = curr_t - prev_t;
        height = height + func(delta_t);
        ...
        prev_t = curr_t;

    It is also possible (albeit, less intuitive to use the current frame rate to drive animations)


    CAVE Configuration Options

    The CAVE Library will look for configuration files in the following order

       /usr/local/CAVE/etc/cave.config
       /usr/local/CAVE/etc/<machine_name>.config
       <your home directory>/.caverc
       <current working directory>/.caverc

    Significant options are:

    see section 9 of the CAVELib User's Guide for all options

    The configuration files for mammoth: cave.config, mammoth.config

    Configuration file tricks (from Dave Pape)