MeshOctree.hpp
Go to the documentation of this file.
1 #ifndef CHUNKED_MESH_OCTREE
2 #define CHUNKED_MESH_OCTREE
3 
4 #include <vector>
5 
6 #include "lvr2/display/BOct.hpp"
10 
12 
13 namespace lvr2
14 {
15 //
16 // struct BOct
17 // {
18 // long long m_child : 48;
19 // unsigned char m_valid : 8;
20 // unsigned char m_leaf : 8;
21 // BOct(): m_child(0), m_valid(0), m_leaf(0){}
22 // };
23 
24  struct ChunkLeaf
25  {
26  std::vector<BaseVector<float> > m_centroids;
27  std::vector<size_t> m_hashes;
28 // unsigned long long m_mesh : 56;
29 // unsigned char m_loaded : 8;
30 // ChunkLeaf(): m_mesh(0), m_loaded(0){}
31  };
32 
33  template <typename BaseVecT>
34  class MeshOctree
35  {
36  public:
37  MeshOctree(float voxelSize, std::vector<size_t>& hashes, std::vector<BaseVecT>& centroids, BoundingBox<BaseVecT>& bb);
38 
39  //void intersect(double planes[6][4], std::vector<unsigned int>& indices);
40  void intersect(double planes[24], std::vector<BaseVecT>& indices, std::vector<size_t>& hashes);
41  void setLOD(unsigned char lod) { m_lod = lod; }
42 
43  void genDisplayLists() { genDisplayLists(m_root); }
44 
45  virtual ~MeshOctree() { m_root = NULL; }
46 
47  private:
48  float m_voxelSize;
51  // needs [] operator and has to be strict linear in memory
52 // FloatChannel m_points;
53 
54 // std::vector<size_t> m_hashes;
55 // std::vector<BaseVecT> m_centroid;
56 
57 
59 
60  unsigned char m_lod;
61  size_t numLeafs;
62 
63  template <typename T>
64  void link(BOct* parent, T* child);
65 
66  template <typename T>
67  T* getChildPtr(BOct* parent);
68 
69  unsigned char getIndex(const BaseVecT& point, const BoundingBox<BaseVecT>& bbox);
70 
71  void getBBoxes(const BoundingBox<BaseVecT>& bbox, BoundingBox<BaseVecT>* boxes);
72 
73 // template <typename PtrT>
74 // void sortPC(size_t start, size_t size, const BoundingBox<BaseVecT>& bbox, size_t bucket_sizes[8]);
75 
76  long buildTree(BOct* oct, std::vector<size_t>& hashes, std::vector<BaseVecT>& centroids, const BoundingBox<BaseVecT>& bbox);
77 
78 
79  void intersect(ChunkLeaf* leaf, const BoundingBox<BaseVecT>& bbox, double planes[24], std::vector<BaseVecT >& indices, std::vector<size_t>& hashes);
80 
81  void intersect(BOct* oct, const BoundingBox<BaseVecT>& bbox, double planes[24], std::vector<BaseVecT >& indices, std::vector<size_t>& hashes);
82 
83 
84  void getHashes(BOct* oct, std::vector<BaseVecT>& indices, std::vector<size_t>& hashes);
85 
86 // void colorAndWrite(BOct* oct);
87 //
88 // void colorAndWrite(BOct* oct, unsigned char index);
89 //
90 // void writeChunkLeaf(Leaf* leaf, unsigned char index);
91 
92  // void intersect(BOct* oct, const BoundingBox<BaseVecT>& octBBox, const BoundingBox<BaseVecT>& cullBBox, std::vector<BaseVecT >& pts);
93 
94  // void intersect(const BoundingBox<BaseVecT>& cullBBox, std::vector<BaseVecT >& pts);
95 
96  };
97 }
98 
99 #include "lvr2/display/MeshOctree.tcc"
100 
101 #endif
std::vector< BaseVector< float > > m_centroids
Definition: MeshOctree.hpp:26
std::vector< size_t > m_hashes
Definition: MeshOctree.hpp:27
unsigned char m_lod
Definition: MeshOctree.hpp:60
ChunkMemoryHandler m_mem
Definition: MeshOctree.hpp:58
BoundingBox< BaseVecT > m_bbox
Definition: MeshOctree.hpp:50
A dynamic bounding box class.
Definition: BoundingBox.hpp:49
void genDisplayLists()
Definition: MeshOctree.hpp:43
void setLOD(unsigned char lod)
Definition: MeshOctree.hpp:41
virtual ~MeshOctree()
Definition: MeshOctree.hpp:45
#define NULL
Definition: mydefs.hpp:141


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:08