Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

VRJugglerApp.h

Go to the documentation of this file.
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: VRJugglerApp.h,v $
00015  *      $Author: johns $        $Locker:  $             $State: Exp $
00016  *      $Revision: 1.4 $       $Date: 2019/01/17 21:21:02 $
00017  *
00018  ***************************************************************************
00019  * DESCRIPTION:
00020  * a VRJuggler specific Scene subclass for VMD
00021  ***************************************************************************/
00022 #ifndef M_VRJAPP_H
00023 #define M_VRJAPP_H
00024 
00025 //#include <vrj/vrjConfig.h>
00026 
00027 //#include <iostream>
00028 //#include <iomanip>
00029 //#include <GL/gl.h>
00030 
00031 #include <vrj/Draw/OGL/GlApp.h>
00032 #include "Matrix4.h"
00033 
00034 #include <gadget/Type/PositionInterface.h>
00035 #include <gadget/Type/DigitalInterface.h>
00036 
00037 #include <plugins/ApplicationDataManager/UserData.h>
00038 #include "VRJugglerSharedData.h"
00039 
00040 namespace gadget
00041 {
00042 //      class PositionInterface;
00043 //      class DigitalInterface;
00044 }
00045 
00046 class VRJugglerScene;
00047 
00048 using namespace vrj;
00049 
00057 class M_VRJapp : public GlApp
00058 {
00059 public:
00060   M_VRJapp():
00061     cmdQueue()
00062    {;}
00063 
00064    virtual ~M_VRJapp (void) {;}
00065 
00066 public: // ---- INITIALIZATION FUNCTIONS ---- //
00074    virtual void init();
00075 
00076    void setScene(VRJugglerScene* s); // pass a pointer to the VMD scene,
00077                                                                         // so we can call its rendering method later
00078 
00079    std::vector<std::string> cmdQueue;    // our local queue of command strings
00080    void appendCommand(const char* str);  // add the specified string to cmdQueue,
00081                                          // in preframe this queue is copied to the shared data
00082 
00089    virtual void apiInit()
00090    {;}
00091 
00092 public:
00093    // ----- Drawing Loop Functions ------
00094    //
00095    //  The drawing loop will look similar to this:
00096    //
00097    //  while (drawing)
00098    //  {
00099    //        preFrame();
00100    //       draw();
00101    //        intraFrame();      // Drawing is happening while here
00102    //       sync();
00103    //        postFrame();      // Drawing is now done
00104    //
00105    //       UpdateDevices();
00106    //  }
00107    //------------------------------------
00108 
00117    virtual void bufferPreDraw();
00118 
00124    virtual void preFrame();
00125         
00129    virtual void latePreFrame();
00130 
00137    virtual void intraFrame();
00138 
00145    virtual void postFrame();
00146 
00147 public: // ----- OpenGL FUNCTIONS ---- //
00155    virtual void contextInit();
00156 
00165    virtual void draw();
00166 
00167    // old code that draws a box
00168    //virtual void draw_old();
00169 
00170 private:
00171    void initGLState();
00172 
00173    //void drawCube();
00174 
00175 public:
00176    void getWandXYZ(float& x, float& y, float& z);
00177    void getWandRotMat(Matrix4& rot);
00178    bool getWandButton(unsigned nr);
00179    gadget::PositionInterface  mWand;    
00180    gadget::PositionInterface  mHead;    
00181    gadget::DigitalInterface   mButton0; 
00182    gadget::DigitalInterface   mButton1; 
00184    cluster::UserData<VRJugglerSharedData> sharedData;   // commands are sent to slaves using shared data 
00185 
00186    VRJugglerScene* scene;
00187 };
00188 
00189 
00190 #endif  // M_VRJAPP_H

Generated on Fri Mar 29 02:46:28 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002