Overte C++ Documentation
AddEntityOperator.h
1 //
2 // AddEntityOperator.h
3 // libraries/entities/src
4 //
5 // Created by Brad Hefta-Gaub on 8/11/2014.
6 // Copyright 2014 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_AddEntityOperator_h
13 #define hifi_AddEntityOperator_h
14 
15 #include <memory>
16 
17 #include <AABox.h>
18 #include <Octree.h>
19 
20 #include "EntityTypes.h"
21 
22 class EntityTree;
23 using EntityTreePointer = std::shared_ptr<EntityTree>;
24 
25 class AddEntityOperator : public RecurseOctreeOperator {
26 public:
27  AddEntityOperator(EntityTreePointer tree, EntityItemPointer newEntity);
28 
29  virtual bool preRecursion(const OctreeElementPointer& element) override;
30  virtual bool postRecursion(const OctreeElementPointer& element) override;
31  virtual OctreeElementPointer possiblyCreateChildAt(const OctreeElementPointer& element, int childIndex) override;
32 private:
33  EntityTreePointer _tree;
34  EntityItemPointer _newEntity;
35  AABox _newEntityBox;
36  bool _foundNew;
37 };
38 
39 
40 #endif // hifi_AddEntityOperator_h
derive from this class to use the Octree::recurseTreeWithOperator() method
Definition: Octree.h:43