GlobeEngine
MBlock.h
Go to the documentation of this file.
1 
8 #ifndef GlobeEngine_MBlock_h
9 #define GlobeEngine_MBlock_h
10 
11 #include "MBlockQuadtree.h"
12 #include "DrawableComponent.h"
14 #include "Plane.h"
15 
16 namespace geRaster {
17 
19  {
20  public:
22 
23  public:
24  MBlock();
25  ~MBlock();
26  void clean();
27  void create(MBlockQuadtree* _root, std::shared_ptr<geSpatial::CullableSpatialKey> key, double _edgelength, int _parentID);
28  void createChildren();
29  int locateMBlock(double _x, double _y, double _kPatchEdgeLenght);
31  void removeChildsForMBlock();
32  void addKPatch(int _uid);
33  //void balanceUp();
34  void propateErrorUp();
35  void restrict();
36  void searchNeighbourAndSplit(int _uid, BlockType _changeFirst, BlockType _changeSecond, bool _mirror_y_axis);
37  void clearKPatchList();
38  void locateAndSetTexture(std::shared_ptr<geSpatial::CullableSpatialKey> _key, MBlockQuadtree::MBlockQuadtreeLevel _level, std::shared_ptr<ge::TextureHandle> _tex, float _max_error, float* _errors);
39  int searchNodeAndRemoveTexture(std::shared_ptr<geSpatial::CullableSpatialKey> _key);
40  void setOrthoHandle(GLuint _handle);
41  enum BlockType getBlockType() { return this->type; }
42  void setBlockType(BlockType _type);
43  float getMaxError();
44  GLuint getHeightTexHandle();
45  GLuint getOrthoHandle();
46  void bindTexLayerAtTextureChannel(int _texLayer, int _channelID);
47  void unbindTextureChannel(int _channelID);
48  bool isInWGS84Area() const;
49 
50  std::vector<int> const& getKPatches();
51  void printErrors();
52 
53  void print(bool _details) {
55  std::cout << " req: " << childsRequested << " remove req: " << removeChildsRequested << " || ";
56  if(_details){
57  for (int i = 0; i < 8; i++){
58  std::cout << this->texlist[i] << " ";
59  }
60 
61  if(this->kpatchlist.size() > 0){
62  std::cout << " | kpatch: " << this->kpatchlist.size() << " , ";
63  for (int i = 0; i < this->kpatchlist.size(); i++){
64  std::cout << this->kpatchlist[i] << " ";
65  }
66  }
67  }
68  std::cout << std::endl;
69  }
70 
71  // node traversal for view frustum
72  void traverseAndMarkNodesInViewFrustum(std::shared_ptr<ge::Camera> const& _cam, bool _markToDelete);
73 
74 // bindless texture functions
75 #ifndef GENGINE_GL_BELOW_410
76  GLuint64 getBindlessTextureHandle(int _layerIdx) const;
80 
81 #endif
82  bool hasARemoveRequest() const {
83  return this->removeChildsRequested;
84  };
85 
86  private:
87  MBlockQuadtree* root;
88  BlockType type;
89 
90  //KPatches to render
91  std::vector<int> kpatchlist;
92  std::shared_ptr<ge::TextureHandle> texlist[8];
93 
94  bool insideWGS84;
95 
96  //bool blocked; // an Mblock is blocked, when a parent mblock contains kpatches
97  // saturated error
98  float max_error;
99  float* errors;
100 
101  bool childsRequested;
102  bool removeChildsRequested;
103  };
104 }
105 #endif
106 
GLuint getOrthoHandle()
Definition: MBlock.cpp:603
MBlock()
Definition: MBlock.cpp:13
void clean()
Definition: MBlock.cpp:24
void setBlockType(BlockType _type)
Definition: MBlock.cpp:594
Definition: MBlock.h:21
void traverseAndMarkNodesInViewFrustum(std::shared_ptr< ge::Camera > const &_cam, bool _markToDelete)
Definition: MBlock.cpp:321
void unbindTextureChannel(int _channelID)
Definition: MBlock.cpp:625
Definition: GeometricBalancedArrayTreeNode.h:13
void locateAndSetTexture(std::shared_ptr< geSpatial::CullableSpatialKey > _key, MBlockQuadtree::MBlockQuadtreeLevel _level, std::shared_ptr< ge::TextureHandle > _tex, float _max_error, float *_errors)
Definition: MBlock.cpp:68
void setOrthoHandle(GLuint _handle)
Definition: MBlock.h:21
void create(MBlockQuadtree *_root, std::shared_ptr< geSpatial::CullableSpatialKey > key, double _edgelength, int _parentID)
Definition: MBlock.cpp:42
Definition: KPatchBase.h:13
BlockType
Definition: MBlock.h:21
int locateMBlock(double _x, double _y, double _kPatchEdgeLenght)
Definition: MBlock.cpp:179
void makeBindlessTexturesNotResident()
Definition: MBlock.cpp:582
void addKPatch(int _uid)
Definition: MBlock.cpp:495
Definition: MBlockQuadtree.h:28
float getMaxError()
Definition: MBlock.cpp:631
GLuint getHeightTexHandle()
Definition: MBlock.cpp:595
enum BlockType getBlockType()
Definition: MBlock.h:41
std::shared_ptr< KEYTYPE > key
Definition: ArrayTreeNode.h:170
GLuint64 getBindlessTextureHandle(int _layerIdx) const
Definition: MBlock.cpp:559
void searchNeighbourAndSplit(int _uid, BlockType _changeFirst, BlockType _changeSecond, bool _mirror_y_axis)
Definition: MBlock.cpp:426
void print()
Definition: GeometricBalancedArrayTreeNode.h:141
void setBindlessTextureHandles()
Definition: MBlock.cpp:566
void print(bool _details)
Definition: MBlock.h:53
Definition: MBlock.h:21
Definition: MBlock.h:21
std::vector< int > const & getKPatches()
Definition: MBlock.cpp:630
~MBlock()
Definition: MBlock.cpp:19
void createChildren()
Definition: MBlock.cpp:109
void clearKPatchList()
Definition: MBlock.cpp:500
Definition: MBlock.h:18
bool isInWGS84Area() const
Definition: MBlock.cpp:611
int searchNodeAndRemoveTexture(std::shared_ptr< geSpatial::CullableSpatialKey > _key)
Definition: MBlock.cpp:274
void makeBindlessTexturesResident()
Definition: MBlock.cpp:574
void requestChildsForMBlock()
Definition: MBlock.cpp:235
void propateErrorUp()
Definition: MBlock.cpp:535
void printErrors()
Definition: MBlock.cpp:633
void removeChildsForMBlock()
Definition: MBlock.cpp:264
bool hasARemoveRequest() const
Definition: MBlock.h:82
Definition: MBlockQuadtree.h:33
void bindTexLayerAtTextureChannel(int _texLayer, int _channelID)
Definition: MBlock.cpp:615
void restrict()
Definition: MBlock.cpp:385
Definition: MBlock.h:21
Definition: MBlock.h:21