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 *cr VRJuggler patches contributed by Martijn Kragtwijk: m.kragtwijk@rug.nl 00008 *cr 00009 ***************************************************************************/ 00010 00011 /*************************************************************************** 00012 * RCS INFORMATION: 00013 * 00014 * $RCSfile: VRJugglerScene.h,v $ 00015 * $Author: johns $ $Locker: $ $State: Exp $ 00016 * $Revision: 1.5 $ $Date: 2020/02/26 15:51:10 $ 00017 * 00018 *************************************************************************** 00019 * DESCRIPTION: 00020 * The VRJuggler specific Scene. It has to get information from the 00021 * shared memory arena, since the display lists are shared amoung 00022 * the different machines 00023 ***************************************************************************/ 00024 #ifndef VRJUGGLER_SCENE_H 00025 #define VRJUGGLER_SCENE_H 00026 00027 #include "Scene.h" 00028 #include "Matrix4.h" 00029 //#include <vrjuggler.h> 00030 #include "VRJugglerRoutines.h" 00031 //#include "VRJugglerDisplayDevice.h" // for manipulating lights etc 00032 //#include "WKFThreads.h" // for the barrier synchronization code 00033 namespace vrj 00034 { 00035 class Kernel; 00036 } 00037 class VMDApp; 00038 class M_VRJapp; 00039 class DisplayDevice; 00040 // This needs to grab shared memory for use in the VRJuggler 00041 // environment. It does it with one means. 00042 // 1) use a VRJugglerScene::operator new so that the internal 00043 // scene information is shared (get_disp_storage and 00044 // free_disp_storage) 00045 // The shared memory is allocated through a global function, 00046 // new_from_VRJuggler_memory. 00047 // This must also call the left eye and right eye draws correctly 00048 00051 00052 using namespace vrj; 00053 00054 class VRJugglerScene : public Scene { 00055 public: 00056 VMDApp *app; 00057 00059 //wkf_barrier_t * draw_barrier; 00060 00062 //VRJugglerLOCK draw_rwlock; 00063 00064 public: 00066 VRJugglerScene(VMDApp *); 00067 00068 void init(); 00069 00070 virtual ~VRJugglerScene(void); 00071 00072 00073 virtual void draw(DisplayDevice *);// Called by the VRJuggler display function 00074 virtual void draw_finished(void);// Called by the VRJuggler display function 00075 00077 virtual int prepare(); 00078 00079 // wait until the Kernel is done 00080 void waitForKernelStop(); 00081 00083 //void *operator new(size_t); 00084 //void operator delete(void *, size_t); 00085 00086 // send a string to the shared data 00087 void appendCommand(const char* str); 00088 00090 00091 Kernel* kernel; 00092 M_VRJapp* application; 00093 00094 // Wanda data 00095 void getWandXYZ(float& x, float& y, float& z); 00096 void getWandRotMat(Matrix4 &rot); 00097 bool getWandButton(unsigned nr); 00098 00099 }; 00100 00101 #endif /* VRJUGGLER_SCENE_H */ 00102