vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PreloaderHeuristic.h
Go to the documentation of this file.
1 #ifndef _PRELOADERHEUR
2 #define _PRELOADERHEUR 1
3 
4 
5 using namespace vrecko;
6 using namespace ArtificialWorld;
7 
8 bool ComputePoint(double x, double y, double sizexy, double sizeuv, double anglecos, double side, osg::Vec2 lastPoint, osg::Vec2 *result);
9 
11 public:
12  osg::ref_ptr<EnvironmentObject> geometry;
13  string filename;
14 };
15 
17 public:
18  string filename;
20 };
21 
24 protected:
25  //updater korenoveho bloku sceny
27  //objekty, ktere se maji nacist, ziskane touto heuristikou
28  list<PreloaderToLoadInfo*> objectsToPreload;
29  //vyhledavani objektu bylo ukonceno
31 public:
32 
35  void SetWorldRoot(BlockUpdater *_rootBlockUpdater){
36  rootBlockUpdater = _rootBlockUpdater;
37  };
39  virtual list<PreloaderToLoadInfo*> GetObjectsToPreload(void){return objectsToPreload;};
41  virtual void Update(void){};
43  virtual bool SearchFinnished(void){ return searchFinnished; };
45  virtual void Restart(void){ searchFinnished = false; objectsToPreload.clear(); };
46 };
47 
54 private:
56  int numOfPoints;
58  double vecXYAverageSize;
60  double vecXYAverageAngleCos;
62  double vecXYSide;
63 
65  double vecXZAverageSize;
67  double vecXZAverageAngleCos;
69  double vecXZSide;
70 
71  //posledni nalezeny vektor
72  osg::Vec3 lastVector;
73  //posledni nalezeny bod
74  osg::Vec3 lastPoint;
75 
77  int requiredPoints;
79  int numOfPointsToGet;
81  int maxCountOfModels;
82 
84  double minPositionDistance;
85 
87  bool computeNextPointXY(osg::Vec2 *result);
89  bool computeNextPointXZ(osg::Vec2 *result);
91  bool computeNextPoint(osg::Vec3 *result);
92 
93 public:
95  numOfPoints = 0;
96  vecXYAverageAngleCos = 1.0f;
97  vecXYAverageSize = 0.0f;
98  vecXYSide = 0.0f;
99  vecXZAverageAngleCos = 1.0f;
100  vecXZAverageSize = 0.0f;
101  vecXZSide = 0.0f;
102  //je treba ziskat 30 pozic
103  requiredPoints = 30;
104  //odhadni 10 kroku dopredu
105  numOfPointsToGet = 10;
106  //minimalni zmena predpokladane pozice pro provadeni prednacitani
107  minPositionDistance = 10;
108  //maximalni pocet prednacitanych modelu
109  maxCountOfModels = 15;
110  rootBlockUpdater = NULL;
111  searchFinnished = false;
112  };
114  void Update(void);
116  void Restart(void)
117  {
118  searchFinnished = false;
119  objectsToPreload.clear();
120  numOfPoints = 0;
121  };
122 };
123 
124 #endif
125