FF7ModelListFileSerializer.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #pragma once
  16. #include "common/TypeDefine.h"
  17. #include "data/QGearsSerializer.h"
  18. #include "FF7ModelListFile.h"
  19. namespace QGears{
  20. namespace FF7{
  21. /**
  22. * Handles the serialization of model list files.
  23. */
  24. class ModelListFileSerializer : public Serializer{
  25. public:
  26. /**
  27. * Constructor.
  28. */
  29. ModelListFileSerializer();
  30. /**
  31. * Destructor.
  32. */
  33. virtual ~ModelListFileSerializer();
  34. /**
  35. * Imports a model list file.
  36. *
  37. * @param stream[in] The contents of the model list file.
  38. * @param dest[out] The formed model list file.
  39. */
  40. virtual void ImportModelListFile(
  41. Ogre::DataStreamPtr &stream, ModelListFile *dest
  42. );
  43. typedef ModelListFile::AnimationDescription
  44. AnimationDescription;
  45. typedef ModelListFile::ModelDescription ModelDescription;
  46. /**
  47. * Data sizes in the file.
  48. */
  49. enum {
  50. /**
  51. * Length of the name of the HRC file assigned to a model.
  52. */
  53. HRC_NAME_LENGTH = 8,
  54. /**
  55. * Scale data length.
  56. */
  57. SCALE_LENGTH = 4
  58. };
  59. protected:
  60. /**
  61. * Reads an object as an animation description.
  62. *
  63. * @param stream[in] Input data.
  64. * @param dest[out] The formed animation description data.
  65. */
  66. virtual void readObject(
  67. Ogre::DataStreamPtr &stream, AnimationDescription &dest
  68. );
  69. /**
  70. * Reads an object as a model description.
  71. *
  72. * @param stream[in] Input data.
  73. * @param dest[out] The formed model description data.
  74. */
  75. virtual void readObject(
  76. Ogre::DataStreamPtr &stream, ModelDescription &dest
  77. );
  78. using Serializer::readObject;
  79. /**
  80. * Reads an object as a vector.
  81. *
  82. * @param stream[in] Input data.
  83. * @param dest[out] The formed vector data.
  84. * @param count[in] The size of the data to read.
  85. */
  86. template<typename ValueType> void ReadVector(
  87. Ogre::DataStreamPtr &stream, std::vector<ValueType> &dest,
  88. size_t count
  89. );
  90. };
  91. }
  92. }