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

GlBasicSimulator.h

Go to the documentation of this file.
00001 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00002  *
00003  * VR Juggler is (C) Copyright 1998-2003 by Iowa State University
00004  *
00005  * Original Authors:
00006  *   Allen Bierbaum, Christopher Just,
00007  *   Patrick Hartling, Kevin Meinert,
00008  *   Carolina Cruz-Neira, Albert Baker
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Library General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Library General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Library General Public
00021  * License along with this library; if not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023  * Boston, MA 02111-1307, USA.
00024  *
00025  * -----------------------------------------------------------------
00026  * File:          $RCSfile: GlBasicSimulator.h,v $
00027  * Date modified: $Date: 2003/07/10 23:59:15 $
00028  * Version:       $Revision: 1.5 $
00029  * -----------------------------------------------------------------
00030  *
00031  *************** <auto-copyright.pl END do not edit this line> ***************/
00032 
00033 #ifndef _VRJ_GL_BASIC_SIMULATOR_H_
00034 #define _VRJ_GL_BASIC_SIMULATOR_H_
00035 
00036 #include <vrj/vrjConfig.h>
00037 
00038 #include <vrj/Draw/OGL/GlSimInterface.h>
00039 #include <vrj/Draw/OGL/GlDrawObjectFunctor.h>
00040 #include <vrj/Draw/OGL/GlDrawWandFunctors.h>
00041 
00042 #ifdef VPR_OS_Darwin
00043 #   include <OpenGL/gl.h>
00044 #   include <OpenGL/glu.h>
00045 #else
00046 #   include <GL/gl.h>
00047 #   include <GL/glu.h>
00048 #endif
00049 
00050 #include <gadget/Type/PositionInterface.h>
00051 
00052 #include <gmtl/Matrix.h>
00053 #include <gmtl/Vec.h>
00054 
00055 
00056 namespace vrj
00057 {
00062 class GlBasicSimulator : public GlSimInterface
00063 {
00064 public:
00065    GlBasicSimulator();
00066 
00067    virtual ~GlBasicSimulator() {}
00068 
00074    virtual bool config(jccl::ConfigElementPtr element);
00075 
00076    static std::string getElementType()
00077    {
00078       return std::string("default_simulator");
00079    }
00080 
00085    virtual void draw(const float scaleFactor);
00086 
00087    virtual void initialize(SimViewport* simVp)
00088    {
00089       mSimViewport = simVp;
00090    }
00091 
00095    virtual void setEventWindow(gadget::EventWindowInterface ewInterface);
00096 
00097 public:
00098    gmtl::Matrix44f getCameraPos()
00099    { return mCameraPos; }
00100 
00101    gmtl::Matrix44f getHeadPos()
00102    { return mHeadPos; }
00103 
00104    gmtl::Matrix44f getWandPos()
00105    { return mWandPos; }
00106 
00107    virtual void updateProjectionData(const float positionScale,
00108                                      Projection* leftProj, Projection* rightProj);
00109 
00111    void updateInternalData(float positionScale);
00112 
00113 public:  // Sim Drawing parameters
00114    bool shouldDrawProjections()
00115    { return mDrawProjections; }
00116 
00117    gmtl::Vec3f getSurfaceColor()
00118    { return mSurfaceColor; }
00119 
00120 
00121 protected: // Drawing functions used by library
00126    void drawObjects();
00127 
00129    void drawProjections(bool drawFrustum, gmtl::Vec3f surfColor, const float scaleFactor);
00130 
00136    void drawSimulator(const float scaleFactor);
00137 
00139    void setDrawWandFunctor(GlDrawObjectFunctor* functor)
00140    { mDrawWandFunctor = functor; }
00141 
00142 protected:     // --- Geom helpers --- //
00143    void initQuadObj();
00144    void drawLine(gmtl::Vec3f& start, gmtl::Vec3f& end);
00145    void drawSphere(float radius, int slices, int stacks);
00146    void drawCone(float base, float height, int slices, int stacks);
00147    void drawBox(float size, GLenum type);
00148    void drawWireCube(float size);
00149    void drawSolidCube(float size);
00150    //void drawGlove(gadget::GloveProxy* gloveProxy);
00151 
00152 
00153 protected:
00154    GlDrawObjectFunctor* mDrawWandFunctor;    
00155    GLUquadricObj* mQuadObj;                  
00157 protected:
00158    SimViewport*   mSimViewport;
00159 
00160    // Drawing attributes
00161    bool           mDrawProjections;       
00162    gmtl::Vec3f    mSurfaceColor;   
00164    gadget::PositionInterface mCamera; 
00165    gadget::PositionInterface mWand;
00166 
00167    gmtl::Matrix44f    mCameraPos;    
00168    gmtl::Matrix44f    mHeadPos;
00169    gmtl::Matrix44f    mWandPos;
00170 };
00171 
00172 }
00173 
00174 #endif
00175 

Generated on Sun May 2 15:10:17 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002