All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AggregateCollisionBvhProvider.h
1 // Copyright eeGeo Ltd (2012-2023), All Rights Reserved
2 
3 #pragma once
4 
5 #include "ICollisionBvhProvider.h"
6 #include "Types.h"
7 #include "Collision.h"
8 #include "ICallback.h"
9 #include "CallbackCollection.h"
10 
11 #include <vector>
12 
13 namespace Eegeo
14 {
15  namespace Collision
16  {
18  {
19  public:
21 
23 
24  virtual size_t CountCollisionBvhsForGroups(u32 collisionGroupsMask) const override;
25 
26  virtual size_t CopyCollisionBvhsForGroups(u32 collisionGroupsMask, const CollisionBvh** pCollisionBvhBufer, size_t maxBufferElements) const override;
27 
28  virtual void RegisterObserver(INotifyChangedCallback& callback) override;
29 
30  virtual void UnregisterObserver(INotifyChangedCallback& callback) override;
31 
32  virtual void RegisterAddedObserver(INotifyAddedCallback& callback) override;
33 
34  virtual void UnregisterAddedObserver(INotifyAddedCallback& callback) override;
35 
36  virtual void RegisterRemovedObserver(INotifyRemovedCallback& callback) override;
37 
38  virtual void UnregisterRemovedObserver(INotifyRemovedCallback& callback) override;
39 
40  virtual void RegisterAddedObserver(INotifyAddedWithMortonKeyCallback& callback) override;
41 
42  virtual void UnregisterAddedObserver(INotifyAddedWithMortonKeyCallback& callback) override;
43 
44  virtual void RegisterRemovedObserver(INotifyRemovedWithMortonKeyCallback& callback) override;
45 
46  virtual void UnregisterRemovedObserver(INotifyRemovedWithMortonKeyCallback& callback) override;
47 
48  virtual void AddProvider(ICollisionBvhProvider& provider);
49  virtual void RemoveProvider(ICollisionBvhProvider& provider);
50 
51  virtual void SendNotifications();
52  private:
53 
54  void OnProviderChanged();
55  void OnProviderAddedBvh(const CollisionBvh& collisionBvh);
56  void OnProviderRemovedBvh(const CollisionBvh& collisionBvh);
57  void OnProviderAddedBvhWithMortonKey(const Eegeo::Streaming::MortonKey& key, const CollisionBvh& collisionBvh);
58  void OnProviderRemovedBvhWithMortonKey(const Eegeo::Streaming::MortonKey& key, const CollisionBvh& collisionBvh);
59 
60  std::vector<ICollisionBvhProvider*> m_providers;
61 
67 
68  Eegeo::Helpers::CallbackCollection0 m_changedCallbacks;
73  bool m_providersChanged;
74  };
75 
76 
77  }
78 
79 }