Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

renderpfnew.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------
00002 //               The Motion Strategy Library (MSL)
00003 //----------------------------------------------------------------------
00004 //
00005 // Copyright (c) 1998-2000 Iowa State University and Steve LaValle.  
00006 // All Rights Reserved.
00007 // 
00008 // Permission to use, copy, and distribute this software and its 
00009 // documentation is hereby granted free of charge, provided that 
00010 // (1) it is not a component of a commercial product, and 
00011 // (2) this notice appears in all copies of the software and
00012 //     related documentation. 
00013 // 
00014 // Iowa State University and the author make no representations
00015 // about the suitability or fitness of this software for any purpose.  
00016 // It is provided "as is" without express or implied warranty.
00017 //----------------------------------------------------------------------
00018 
00019 #include <LEDA/file.h>
00020 #include <LEDA/list.h>
00021 #include <LEDA/matrix.h>
00022 #include <LEDA/point.h>
00023 #include <LEDA/polygon.h>
00024 #include <LEDA/stream.h>
00025 #include <LEDA/string.h>
00026 #include <LEDA/vector.h>
00027 #include <LEDA/d3_point.h>
00028 
00029 #include <Performer/pf/pfChannel.h>
00030 #include <Performer/pf/pfEarthSky.h>
00031 #include <Performer/pf/pfLightSource.h>
00032 #include <Performer/pf/pfNode.h>
00033 #include <Performer/pf/pfGeode.h>
00034 #include <Performer/pf/pfText.h>
00035 #include <Performer/pf/pfScene.h>
00036 #include <Performer/pf/pfGroup.h>
00037 #include <Performer/pf/pfSwitch.h>
00038 #include <Performer/pf/pfDCS.h>
00039 #include <Performer/pf/pfSCS.h>
00040 #include <Performer/pr/pfGeoSet.h>
00041 #include <Performer/pr/pfGeoState.h>
00042 #include <Performer/pr/pfString.h>
00043 #include <Performer/pr/pfFont.h>
00044 #include <Performer/pr/pfMaterial.h>
00045 #include <Performer/pfui.h>
00046 #include <Performer/pfutil.h>
00047 #include <Performer/pfdu.h>
00048 #include <Performer/pr.h>
00049 
00050 
00051 #include <LEDA/REDEFINE_NAMES.h>
00052 
00053 typedef struct{
00054   pfPipeWindow *PW;
00055   pfChannel *Chan;
00056   pfChannel *ChanEye;
00057   pfSwitch *ShowCase;
00058   pfSCS *ControlPanel;
00059   pfDCS *ControlPad;
00060   pfDCS *BodiesDCS;
00061   pfGroup *Env;
00062   pfGeode *BoundBox;
00063   pfSwitch *WorkEnv;
00064   pfDCS *WorldDCS;
00065   pfuMouse *Mouse;
00066   pfuEventStream *InputEvents;
00067   //static pfLightSource *Sun;
00068 
00069   // Display Control
00070   double TranX, TranY,TranZ; // Global tranlation offset
00071   double RotX, RotY, RotZ;  //Global rotation offset
00072   int AnimatingStep; // Used to indentify current animating position
00073   int AnimatingSpeed; // Used to control animating speed
00074 
00075   // Mouse Control
00076   bool HoldRightMouse, HoldLeftMouse, HoldMiddleMouse;
00077   //bool ReleaseRightMouse, ReleaseLeftMouse, ReleaseMiddleMouse;
00078   double MouseXOld, MouseYOld; // Mouse's previous position
00079 
00080   //Control of Eye
00081   pfMatrix EyeMat;
00082 
00083   //Control of showing bounding box
00084   bool ShowBoundBox;
00085 
00086   //Control of Controll pannel
00087   bool ControlPanelOn;
00088   bool FocusOnControlPad;
00089   double PadX; 
00090 } SharedData;
00091 
00092 
00094 
00095 class RenderPerformer: public Render
00096 {
00097  protected:
00098   static SharedData *Shared;
00099 
00100   void InitPerformer();
00101   void LoadConverterDSO();
00102   void LoadEnvironment(pfGroup *env);
00103   void LoadBoundBox(pfGeode *bound);
00104   void LoadBodies(pfGroup *bodies);
00105   void LoadControlPanel(pfGroup *con, pfDCS *pad);
00106   string GetExtensionSuffix(string s);
00107   pfNode* LoadNativeModel(double r, double g, double b, string file);
00108   void Normalize(double v[3]);
00109   void GetCurrentMousePos(double &x, double &y);
00110   void HandleKeyInput();
00111   void HandleMouseEvents();
00112   void GetControlPadSize(double &padwidth_l, double &padwidth_r, 
00113                          double &padheight_b, double &padheight_top);
00114   void NormCrossProduct(double v1[3], double v2[3], double out[3]);
00115   void AnimateBodies(); // update DCS coordnate system
00116   static void DrawChannel(pfChannel *chan, void *data);
00117 
00118  public:
00119   RenderPerformer();
00120   RenderPerformer(string filepath);
00121   RenderPerformer(Scene *s, string filepath);
00122   virtual ~RenderPerformer();
00123 
00124   virtual void Init();
00125   virtual void HandleEvents();
00126   virtual void Terminate();
00127 };
00128 
00129 
00130 #include <LEDA/UNDEFINE_NAMES.h>
Motion Strategy Library


Web page maintained by Steve LaValle
Partial support provided by NSF CAREER Award IRI-970228 (LaValle), Honda Research, and Iowa State University.
Contributors: Peng Cheng, James Kuffner, Steve LaValle, and Libo Yang.