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

renderpf.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------
00002 //               The Motion Strategy Library (MSL)
00003 //----------------------------------------------------------------------
00004 //
00005 // Copyright (c) University of Illinois and Steven M. 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 // The University of Illinois 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 // RenderPerformer was written by Libo Yang (lyang@cs.iastate.edu)
00020 // Modifications made by Steve LaValle (lavalle@cs.iatate.edu)
00021 
00022 #ifndef MSL_RENDERPF_H
00023 #define MSL_RENDERPF_H
00024 
00025 #include "triangle.h"
00026 #include "render.h"
00027 
00028 #include <Performer/pf/pfChannel.h>
00029 #include <Performer/pf/pfEarthSky.h>
00030 #include <Performer/pf/pfLightSource.h>
00031 #include <Performer/pf/pfNode.h>
00032 #include <Performer/pf/pfGeode.h>
00033 #include <Performer/pf/pfText.h>
00034 #include <Performer/pf/pfScene.h>
00035 #include <Performer/pf/pfGroup.h>
00036 #include <Performer/pf/pfSwitch.h>
00037 #include <Performer/pf/pfDCS.h>
00038 #include <Performer/pf/pfSCS.h>
00039 #include <Performer/pr/pfGeoSet.h>
00040 #include <Performer/pr/pfGeoState.h>
00041 #include <Performer/pr/pfString.h>
00042 #include <Performer/pr/pfFont.h>
00043 #include <Performer/pr/pfMaterial.h>
00044 #include <Performer/pfui.h>
00045 #include <Performer/pfutil.h>
00046 #include <Performer/pfdu.h>
00047 #include <Performer/pr.h>
00048 
00049 typedef struct{
00050   pfPipeWindow *PW;
00051   pfChannel *Chan;
00052   pfChannel *ChanEye;
00053   pfSwitch *ShowCase;
00054   pfGroup *ControlPanel;
00055   pfDCS *ControlPad;
00056   pfDCS *BodiesDCS;
00057   pfGroup *Env;
00058   pfGeode *BoundingBox;
00059   pfSwitch *WorkEnv;
00060   pfDCS *WorldDCS;
00061   pfuMouse *Mouse;
00062   pfuEventStream *InputEvents;
00063   //static pfLightSource *Sun;
00064 
00065   // Display Control
00066   double TranX, TranY,TranZ; // Global tranlation offset
00067   double RotX, RotY, RotZ;  //Global rotation offset
00068 
00069   // Mouse Control
00070   bool HoldRightMouse, HoldLeftMouse, HoldMiddleMouse;
00071   //bool ReleaseRightMouse, ReleaseLeftMouse, ReleaseMiddleMouse;
00072   double MouseXOld, MouseYOld; // Mouse's previous position
00073 
00074   //Control of Eye
00075   pfMatrix EyeMat;
00076 
00077   //Control of Control panel
00078   bool ControlPanelOn;
00079   bool FocusOnControlPad;
00080   double PadX; 
00081 } SharedData;
00082 
00083 
00084 
00085 
00087 class RenderPerformer: public Render
00088 {
00089  protected:
00090   static SharedData *Shared;
00091 
00092   virtual void ShowCurrentAnimationFrame();
00093 
00094   // Loaders
00095   void LoadEnvironment(pfGroup *env);
00096   void LoadBodies(pfGroup *bodies);
00097 
00099   pfNode* LoadNativeModel(string file, int colorindex);
00100 
00101   void MakeBoundingBox(pfGeode *bound);
00102   void MakeControlPanel(pfGroup *con, pfDCS *pad);
00103 
00104   void GetCurrentMousePos(double &x, double &y);
00105   void HandleKeyInput();
00106   void HandleMouseEvents();
00107   void GetControlPadSize(double &padwidth_l, double &padwidth_r, 
00108                          double &padheight_b, double &padheight_top);
00109   void NormCrossProduct(double v1[3], double v2[3], double out[3]);
00110   static void DrawChannel(pfChannel *chan, void *data);
00111 
00112  public:
00113   RenderPerformer();
00114   RenderPerformer(string filepath);
00115   RenderPerformer(Scene *s, string filepath);
00116   virtual ~RenderPerformer() {};
00117 
00118   virtual void Init();
00119   virtual void HandleEvents();
00120   virtual void Terminate();
00121 };
00122 
00123 #endif
Motion Strategy Library


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