00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
00064
00065
00066 double TranX, TranY,TranZ;
00067 double RotX, RotY, RotZ;
00068
00069
00070 bool HoldRightMouse, HoldLeftMouse, HoldMiddleMouse;
00071
00072 double MouseXOld, MouseYOld;
00073
00074
00075 pfMatrix EyeMat;
00076
00077
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
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