00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef M_VRJAPP_H
00023 #define M_VRJAPP_H
00024 
00025 
00026 
00027 
00028 
00029 
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 
00043 
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: 
00074    virtual void init();
00075 
00076    void setScene(VRJugglerScene* s); 
00077                                                                         
00078 
00079    std::vector<std::string> cmdQueue;    
00080    void appendCommand(const char* str);  
00081                                          
00082 
00089    virtual void apiInit()
00090    {;}
00091 
00092 public:
00093    
00094    
00095    
00096    
00097    
00098    
00099    
00100    
00101    
00102    
00103    
00104    
00105    
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: 
00155    virtual void contextInit();
00156 
00165    virtual void draw();
00166 
00167    
00168    
00169 
00170 private:
00171    void initGLState();
00172 
00173    
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;   
00185 
00186    VRJugglerScene* scene;
00187 };
00188 
00189 
00190 #endif  // M_VRJAPP_H