00001 // Filename: vrpn_demo.cxx 00002 // Created by: 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "framework.h" 00020 00021 #include <eventHandler.h> 00022 #include <string> 00023 00024 #include <transform2sg.h> 00025 #include <trackerTransform.h> 00026 #include <trackerNode.h> 00027 #include <vrpnClient.h> 00028 #include <dataRelation.h> 00029 #include <renderRelation.h> 00030 #include <namedNode.h> 00031 00032 #include <trackball.h> 00033 #include <mouseWatcher.h> 00034 00035 //////////////////////////////////////////////// 00036 //Globals 00037 //////////////////////////////////////////////// 00038 VrpnClient *vrpn_client; 00039 Transform2SG *tracker2cam; 00040 TrackerTransform *evil_transform; 00041 TrackerNode *evil_tracker; 00042 00043 //From framework 00044 extern PT_NamedNode data_root; 00045 extern RenderRelation* first_arc; 00046 extern PT(Trackball) trackball; 00047 extern PT(MouseWatcher) mouse_watcher; 00048 00049 void demo_keys(EventHandler&) { 00050 vrpn_client = new VrpnClient(string("evildyne")); 00051 evil_tracker = new TrackerNode(vrpn_client, string("Isense"), 2); 00052 evil_transform = new TrackerTransform("evil_transform"); 00053 00054 new DataRelation(data_root, evil_tracker); 00055 new DataRelation(evil_tracker, evil_transform); 00056 00057 tracker2cam = new Transform2SG("tracker2cam"); 00058 tracker2cam->set_arc(first_arc); 00059 00060 new DataRelation(evil_transform, tracker2cam); 00061 } 00062 00063 int main(int argc, char *argv[]) { 00064 define_keys = &demo_keys; 00065 return framework_main(argc, argv); 00066 }