/home/tetron/hack/vos/libs/vos/csplugin/vossector.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _VOSSECTOR_H_
00024 #define _VOSSECTOR_H_
00025
00026 #include <vos/metaobjects/a3dl/a3dl.hh>
00027 #include "ivosa3dl.hh"
00028
00029 class csMetaSector;
00030
00031 class csVosSector : public iVosSector, public iVosApi,
00032 public VOS::ChildChangeListener,
00033 public VOS::PropertyListener
00034 {
00035 private:
00036 bool didLoad;
00037 iObjectRegistry* objreg;
00038 csRef<iEngine> engine;
00039 csRef<iSector> sector;
00040 csVosA3DL* vosa3dl;
00041 csRef<iProgressMeter> meter;
00042 VUtil::vRef<csMetaSector> sectorvobj;
00043 csRef<iDynamicSystem> dynsys;
00044 csRef<iCollideSystem> colsys;
00045
00046 csSet < csPtrKey<iVosObject3D> > loadedObjects;
00047
00048 bool isLit;
00049 int waitingForChildren;
00050
00051 float gravity;
00052 bool collisionDetection;
00053
00054 virtual void notifyChildInserted (VOS::VobjectEvent &event);
00055 virtual void notifyChildRemoved (VOS::VobjectEvent &event);
00056 virtual void notifyChildReplaced (VOS::VobjectEvent &event);
00057
00058 public:
00059 SCF_DECLARE_IBASE;
00060
00061 csVosSector(iObjectRegistry *o, csVosA3DL* vosa3dl, csMetaSector* sec);
00062 virtual ~csVosSector();
00063
00064 virtual void Load(iProgressMeter* progress = 0);
00065 virtual csRef<iSector> GetSector();
00066
00067 virtual VUtil::vRef<VOS::Vobject> GetVobject();
00068
00069 virtual const csSet< csPtrKey<iVosObject3D> > &GetObject3Ds();
00070
00071 void addObject3D (iVosObject3D *obj);
00072 void removeObject3D (iVosObject3D *obj);
00073
00074 csRef<iDynamicSystem> GetDynSys() { return dynsys; }
00075
00076 csRef<iCollideSystem> GetCollideSystem() { return colsys; }
00077
00078 virtual void CacheLightmaps();
00079
00080 virtual void notifyPropertyChange(const VOS::PropertyEvent &event);
00081
00082 virtual float getGravity();
00083 virtual bool getCollisionDetection();
00084
00085
00086
00087
00088 friend class LoadSectorTask;
00089 friend class RelightTask;
00090 };
00091
00092 class csMetaSector : public virtual A3DL::Sector
00093 {
00094 private:
00095 csRef<csVosSector> csvossector;
00096
00097 public:
00098 csMetaSector(VOS::VobjectBase* superobject);
00099 virtual ~csMetaSector() { }
00100
00101 static VOS::MetaObject* new_csMetaSector(VOS::VobjectBase* superobject,
00102 const std::string& type);
00103
00104 csRef<csVosSector> GetCsVosSector() { return csvossector; }
00105 void SetCsVosSector(csRef<csVosSector> s) { csvossector = s; }
00106 };
00107
00108
00109 class csVosProgressTask : public VUtil::Task
00110 {
00111 private:
00112 csRef<iProgressMeter> meter;
00113 std::string action;
00114 unsigned int step;
00115 unsigned int total;
00116
00117 public:
00118 csVosProgressTask(iProgressMeter* m, const std::string& a, unsigned int t)
00119 : meter(m), action(a), total(t)
00120 {
00121 }
00122
00123 csVosProgressTask(iProgressMeter* m, unsigned int s)
00124 : meter(m), step(s)
00125 {
00126 }
00127
00128 virtual void doTask()
00129 {
00130 if (action != "") {
00131 meter->SetProgressDescription("crystalspace.network.vos.a3dl.progress", action.c_str());
00132 meter->SetTotal(total);
00133 meter->SetGranularity(1);
00134 }
00135 else
00136 {
00137 meter->Step(step);
00138 }
00139 }
00140 };
00141
00142
00143 #endif