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) 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 // 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 <LEDA/file.h>
00026 #include <LEDA/list.h>
00027 #include <LEDA/matrix.h>
00028 #include <LEDA/point.h>
00029 #include <LEDA/polygon.h>
00030 #include <LEDA/stream.h>
00031 #include <LEDA/string.h>
00032 #include <LEDA/vector.h>
00033 #include <LEDA/d3_point.h>
00034 
00035 #include "3Dtriangle.h"
00036 #include "render.h"
00037 
00038 #include <Performer/pf/pfChannel.h>
00039 #include <Performer/pf/pfEarthSky.h>
00040 #include <Performer/pf/pfLightSource.h>
00041 #include <Performer/pf/pfNode.h>
00042 #include <Performer/pf/pfGeode.h>
00043 #include <Performer/pf/pfText.h>
00044 #include <Performer/pf/pfScene.h>
00045 #include <Performer/pf/pfGroup.h>
00046 #include <Performer/pf/pfSwitch.h>
00047 #include <Performer/pf/pfDCS.h>
00048 #include <Performer/pf/pfSCS.h>
00049 #include <Performer/pr/pfGeoSet.h>
00050 #include <Performer/pr/pfGeoState.h>
00051 #include <Performer/pr/pfString.h>
00052 #include <Performer/pr/pfFont.h>
00053 #include <Performer/pr/pfMaterial.h>
00054 #include <Performer/pfui.h>
00055 #include <Performer/pfutil.h>
00056 #include <Performer/pfdu.h>
00057 #include <Performer/pr.h>
00058 
00059 #include <LEDA/REDEFINE_NAMES.h>
00060 
00061 typedef struct{
00062   pfPipeWindow *PW;
00063   pfChannel *Chan;
00064   pfChannel *ChanEye;
00065   pfSwitch *ShowCase;
00066   pfGroup *ControlPanel;
00067   pfDCS *ControlPad;
00068   pfDCS *BodiesDCS;
00069   pfGroup *Env;
00070   pfGeode *BoundingBox;
00071   pfSwitch *WorkEnv;
00072   pfDCS *WorldDCS;
00073   pfuMouse *Mouse;
00074   pfuEventStream *InputEvents;
00075   //static pfLightSource *Sun;
00076 
00077   // Display Control
00078   double TranX, TranY,TranZ; // Global tranlation offset
00079   double RotX, RotY, RotZ;  //Global rotation offset
00080 
00081   // Mouse Control
00082   bool HoldRightMouse, HoldLeftMouse, HoldMiddleMouse;
00083   //bool ReleaseRightMouse, ReleaseLeftMouse, ReleaseMiddleMouse;
00084   double MouseXOld, MouseYOld; // Mouse's previous position
00085 
00086   //Control of Eye
00087   pfMatrix EyeMat;
00088 
00089   //Control of Control panel
00090   bool ControlPanelOn;
00091   bool FocusOnControlPad;
00092   double PadX; 
00093 } SharedData;
00094 
00095 
00096 
00097 
00099 class RenderPerformer: public Render
00100 {
00101  protected:
00102   static SharedData *Shared;
00103 
00104   virtual void ShowCurrentAnimationFrame();
00105 
00106   // Loaders
00107   void LoadEnvironment(pfGroup *env);
00108   void LoadBodies(pfGroup *bodies);
00109 
00111   pfNode* LoadNativeModel(string file, int colorindex);
00112 
00113   void MakeBoundingBox(pfGeode *bound);
00114   void MakeControlPanel(pfGroup *con, pfDCS *pad);
00115 
00116   void GetCurrentMousePos(double &x, double &y);
00117   void HandleKeyInput();
00118   void HandleMouseEvents();
00119   void GetControlPadSize(double &padwidth_l, double &padwidth_r, 
00120                          double &padheight_b, double &padheight_top);
00121   void NormCrossProduct(double v1[3], double v2[3], double out[3]);
00122   static void DrawChannel(pfChannel *chan, void *data);
00123 
00124  public:
00125   RenderPerformer();
00126   RenderPerformer(string filepath);
00127   RenderPerformer(Scene *s, string filepath);
00128   virtual ~RenderPerformer() {};
00129 
00130   virtual void Init();
00131   virtual void HandleEvents();
00132   virtual void Terminate();
00133 };
00134 
00135 
00136 #include <LEDA/UNDEFINE_NAMES.h>
00137 
00138 #endif
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: Anna Atramentov, Peng Cheng, James Kuffner, Steve LaValle, and Libo Yang.