00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: P_CaveTracker.C,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.19 $ $Date: 2019/01/17 21:21:00 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * This is Paul's new Tracker code -- pgrayson@ks.uiuc.edu 00019 * 00020 * -dispdev cave 00021 * 00022 ***************************************************************************/ 00023 00024 #include <cave.macros.h> 00025 #include "CaveRoutines.h" 00026 #include "Matrix4.h" 00027 #include "P_Tracker.h" 00028 #include "P_CaveTracker.h" 00029 00030 void CaveTracker::update() { 00031 CAVEGetSensorPosition(CAVESENSOR(caveTrackerNum),CAVE_NAV_FRAME, pos); 00032 00033 /* "classical" Euler angles */ 00034 float angles[3]; 00035 CAVEGetSensorOrientation(CAVESENSOR(caveTrackerNum), CAVE_NAV_FRAME, angles); 00036 orient->identity(); 00037 orient->rot(angles[1],'y'); 00038 orient->rot(angles[0],'x'); 00039 orient->rot(angles[2],'z'); 00040 orient->rot(90,'y'); // to face forward (-z) 00041 } 00042 00043 int CaveTracker::do_start(const SensorConfig *config) { 00044 // Must check that we are actually running in a CAVE here 00045 if (!vmd_cave_is_initialized() || CAVEController == NULL) { 00046 return 0; 00047 } 00048 00049 if (!config->require_cave_name()) return 0; 00050 if (!config->have_one_sensor()) return 0; 00051 int num = (*config->getsensors())[0]; 00052 caveTrackerNum = num+1; 00053 return 1; 00054 } 00055 00056