FF7ModelListFile.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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 <OgreColourValue.h>
  17. #include "common/VGearsResource.h"
  18. namespace VGears{
  19. namespace FF7{
  20. /**
  21. * Handles model list files.
  22. */
  23. class ModelListFile : public Resource{
  24. public:
  25. /**
  26. * Constructor.
  27. *
  28. * @param creator[in] Pointer to the ResourceManager that is
  29. * creating this resource.
  30. * @param name[in] The unique name of the resource.
  31. * @param handle[in] @todo Understand and document.
  32. * @param group[in] The name of the resource group to which this
  33. * resource belong.
  34. * @param is_manual[in] True if the resource is manually loaded,
  35. * false otherwise.
  36. * @param loader[in] Pointer to a ManualResourceLoader
  37. * implementation which will be called when the Resource wishes to
  38. * load (should be supplied if is_manual is set to true). It can be
  39. * null, but the Resource will never be able to reload if anything
  40. * ever causes it to unload. Therefore provision of a proper
  41. * ManualResourceLoader instance is strongly recommended.
  42. */
  43. ModelListFile(
  44. Ogre::ResourceManager* creator, const String &name,
  45. Ogre::ResourceHandle handle, const String& group,
  46. bool is_manual = false,
  47. Ogre::ManualResourceLoader* loader = NULL
  48. );
  49. /**
  50. * Destructor.
  51. */
  52. virtual ~ModelListFile();
  53. /**
  54. * The type of resource.
  55. */
  56. static const String RESOURCE_TYPE;
  57. /**
  58. * An animation description.
  59. */
  60. struct AnimationDescription{
  61. /**
  62. * The animation name.
  63. */
  64. String name;
  65. /**
  66. * Unknown data.
  67. */
  68. uint16 unknown;
  69. };
  70. typedef std::vector<AnimationDescription> AnimationList;
  71. /**
  72. * Types of models.
  73. */
  74. enum ModelType{
  75. /**
  76. * Playable character.
  77. */
  78. PLAYER = 0,
  79. /**
  80. * Non playable character.
  81. */
  82. NPC = 1,
  83. /**
  84. * Unknown character type
  85. */
  86. UNKNOWN
  87. };
  88. /**
  89. * A model.
  90. */
  91. struct ModelDescription{
  92. /**
  93. * The model name.
  94. */
  95. String name;
  96. /**
  97. * The model type.
  98. */
  99. ModelType type;
  100. /**
  101. * HRC file name.
  102. *
  103. * HRC files describe bone hierarchy.
  104. */
  105. String hrc_name;
  106. /**
  107. * Scale for the model.
  108. */
  109. String scale;
  110. Ogre::ColourValue light_colors[10];
  111. /**
  112. * List of animations assigned to the model.
  113. */
  114. AnimationList animations;
  115. };
  116. typedef std::vector<ModelDescription> ModelList;
  117. /**
  118. * Retrieves the scale for the models.
  119. *
  120. * @return The scale.
  121. */
  122. virtual uint16 GetScale() const;
  123. /**
  124. * Sets the scale for the models.
  125. *
  126. * @param scale[in] The scale.
  127. */
  128. virtual void SetScale(uint16 scale);
  129. /**
  130. * Retrieves the model list.
  131. */
  132. virtual ModelList& GetModels();
  133. protected:
  134. /**
  135. * Loads the file.
  136. */
  137. virtual void loadImpl() override;
  138. /**
  139. * Unloads the file.
  140. */
  141. virtual void unloadImpl() override;
  142. /**
  143. * Calculates the size of the palette.
  144. *
  145. * @return The size of the palette.
  146. * @todo Units?
  147. */
  148. virtual size_t calculateSize( void ) const;
  149. private:
  150. /**
  151. * The models scale.
  152. *
  153. * @todo Each model has it's own scale. Is this some kind of
  154. * global scale? If so, is it to be applied over each model
  155. * scale, or instead of it?
  156. */
  157. uint16 scale_;
  158. /**
  159. * The list of models.
  160. */
  161. ModelList models_;
  162. };
  163. typedef Ogre::SharedPtr<ModelListFile> ModelListFilePtr;
  164. }
  165. }