All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CollisionMeshResourceRepository.h
1 // Copyright eeGeo Ltd (2012-2023), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Collision.h"
6 #include "CollisionGroup.h"
7 #include "Types.h"
8 #include "ICollisionBvhProvider.h"
9 #include "MortonKey.h"
10 #include "ICallback.h"
11 #include "CallbackCollection.h"
12 
13 #include <vector>
14 #include <map>
15 
16 namespace Eegeo
17 {
18  namespace Collision
19  {
21  {
22  public:
23  CollisionMeshResourceRepository(CollisionGroup::Type collisionGroup);
24 
25  virtual void Add(Eegeo::Streaming::MortonKey key, const ICollisionMeshResource& collisionMeshResource);
26 
27  virtual void Remove(Eegeo::Streaming::MortonKey key, const ICollisionMeshResource& collisionMeshResource);
28 
29  virtual size_t CountCollisionBvhsForGroups(u32 collisionGroupsMask) const override;
30 
31  virtual size_t CopyCollisionBvhsForGroups(u32 collisionGroupsMask, const CollisionBvh** pCollisionBvhBufer, size_t maxBufferElements) const override;
32 
33  virtual void RegisterObserver(INotifyChangedCallback& callback) override;
34 
35  virtual void UnregisterObserver(INotifyChangedCallback& callback) override;
36 
37  virtual void RegisterAddedObserver(INotifyAddedCallback& callback) override;
38 
39  virtual void UnregisterAddedObserver(INotifyAddedCallback& callback) override;
40 
41  virtual void RegisterRemovedObserver(INotifyRemovedCallback& callback) override;
42 
43  virtual void UnregisterRemovedObserver(INotifyRemovedCallback& callback) override;
44 
45  virtual void RegisterAddedObserver(INotifyAddedWithMortonKeyCallback& callback) override;
46 
47  virtual void UnregisterAddedObserver(INotifyAddedWithMortonKeyCallback& callback) override;
48 
49  virtual void RegisterRemovedObserver(INotifyRemovedWithMortonKeyCallback& callback) override;
50 
51  virtual void UnregisterRemovedObserver(INotifyRemovedWithMortonKeyCallback& callback) override;
52 
53 
54  private:
55  const CollisionGroup::Type m_collisionGroup;
56 
57  typedef std::map<const ICollisionMeshResource*, Eegeo::Streaming::MortonKey> TMapType;
58 
59  TMapType m_resources;
60 
61  Eegeo::Helpers::CallbackCollection0 m_changedCallbacks;
66  };
67 
68 
69  }
70 }