All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
QuadTreeNode.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Streaming.h"
7 #include "PoolHandle.h"
8 #include "MortonKey.h"
9 #include <vector>
10 
11 namespace Eegeo
12 {
13  namespace Streaming
14  {
15  class QuadTreeNode : protected Eegeo::NonCopyable
16  {
17  public:
18  static const int NUM_OF_PAYLOAD_SLOTS = 6;
19 
21  QuadTreeNode *parent;
22  std::vector<QuadTreeNode*> children;
23  std::vector<Payload*> payloads;
24  s64 rawMortonKeyValue;
25  int depth;
26  double cellHalfWidth;
27  float cellAngleOfView;
28  float distanceFromCamera;
29  float depthSortSignedDistance;
30  QuadTreeNode();
31  void onAllocatedFromPool(DataStructures::PoolHandle poolHandle);
32  int numOfPayloads();
33  void freeAllPayloads(PayloadPool *pPayloadPool);
34  bool hasChildren();
35  bool isLeaf();
36  void removeChild(QuadTreeNode *pChildNode);
37  bool hasNoPayloads();
38  bool hasPayloads();
39  bool isRoot();
40  bool isRedundant();
41  void deleteSubtreeBelow(PayloadPool *pPayloadPool, QuadTreeNodePool *pNodePool);
42  int numOfNodesInSubtree();
43 
44  void addSubtreeKeysToList(std::vector<MortonKey>& nodeKeys);
45  };
46  }
47 }