TrackEventTrack.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #ifndef CRYINCLUDE_CRYMOVIE_TRACKEVENTTRACK_H
  9. #define CRYINCLUDE_CRYMOVIE_TRACKEVENTTRACK_H
  10. #pragma once
  11. #include "IMovieSystem.h"
  12. #include "AnimTrack.h"
  13. #include "AnimKey.h"
  14. #include "StlUtils.h"
  15. class CAnimStringTable
  16. : public IAnimStringTable
  17. {
  18. public:
  19. AZ_CLASS_ALLOCATOR(CAnimStringTable, AZ::SystemAllocator);
  20. AZ_RTTI(CAnimStringTable, "{B7C435CF-A763-41B5-AA1E-3BA2CD4232B2}", IAnimStringTable);
  21. CAnimStringTable();
  22. ~CAnimStringTable();
  23. const char* Add(const char* p) override;
  24. //////////////////////////////////////////////////////////////////////////
  25. // for intrusive_ptr support
  26. void add_ref() override;
  27. void release() override;
  28. //////////////////////////////////////////////////////////////////////////
  29. static void Reflect([[maybe_unused]] AZ::SerializeContext* serializeContext) {}
  30. private:
  31. struct Page
  32. {
  33. Page* pPrev;
  34. char mem[512 - sizeof(Page*)];
  35. };
  36. typedef std::unordered_map<const char*, const char*, stl::hash_string<const char*>, stl::equality_string<const char*> > TableMap;
  37. private:
  38. CAnimStringTable(const CAnimStringTable&);
  39. CAnimStringTable& operator = (const CAnimStringTable&);
  40. private:
  41. int m_refCount;
  42. Page* m_pLastPage;
  43. char* m_pEnd;
  44. TableMap m_table;
  45. };
  46. class CTrackEventTrack
  47. : public TAnimTrack<IEventKey>
  48. {
  49. public:
  50. AZ_CLASS_ALLOCATOR(CTrackEventTrack, AZ::SystemAllocator);
  51. AZ_RTTI(CTrackEventTrack, "{3F659864-D66B-4211-93FB-1401EF4614D4}", IAnimTrack);
  52. explicit CTrackEventTrack(IAnimStringTable* pStrings);
  53. CTrackEventTrack(); // default constr needed for AZ Serialization
  54. //////////////////////////////////////////////////////////////////////////
  55. // Overrides of IAnimTrack.
  56. //////////////////////////////////////////////////////////////////////////
  57. void GetKeyInfo(int key, const char*& description, float& duration) override;
  58. void SerializeKey(IEventKey& key, XmlNodeRef& keyNode, bool bLoading) override;
  59. void SetKey(int index, IKey* key) override;
  60. void InitPostLoad(IAnimSequence* sequence) override;
  61. static void Reflect(AZ::ReflectContext* context);
  62. private:
  63. AZStd::intrusive_ptr< IAnimStringTable> m_pStrings;
  64. };
  65. #endif // CRYINCLUDE_CRYMOVIE_TRACKEVENTTRACK_H