FF7ModelListFile.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. -----------------------------------------------------------------------------
  3. Copyright (c) 07.10.2013 Tobias Peters <tobias.peters@kreativeffekt.at>
  4. This file is part of Q-Gears
  5. Q-Gears is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, version 2.0 (GPLv2) of the License.
  8. Q-Gears is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. -----------------------------------------------------------------------------
  13. */
  14. #include "data/FF7ModelListFile.h"
  15. #include "data/FF7ModelListFileSerializer.h"
  16. namespace QGears
  17. {
  18. namespace FF7
  19. {
  20. //----------------------------------------------------------------------
  21. const String ModelListFile::RESOURCE_TYPE( "FF7ModelListFile" );
  22. //----------------------------------------------------------------------
  23. ModelListFile::ModelListFile( Ogre::ResourceManager *creator
  24. ,const String &name, Ogre::ResourceHandle handle
  25. ,const String &group, bool isManual
  26. ,Ogre::ManualResourceLoader *loader ) :
  27. Resource( creator, name, handle, group, isManual, loader )
  28. , m_scale( 0 )
  29. {
  30. }
  31. //----------------------------------------------------------------------
  32. ModelListFile::~ModelListFile()
  33. {
  34. unload();
  35. }
  36. //----------------------------------------------------------------------
  37. void
  38. ModelListFile::loadImpl()
  39. {
  40. ModelListFileSerializer serializer;
  41. Ogre::DataStreamPtr stream( openResource() );
  42. serializer.importModelListFile( stream, this );
  43. }
  44. //----------------------------------------------------------------------
  45. void
  46. ModelListFile::unloadImpl()
  47. {
  48. m_scale = 0;
  49. m_models.clear();
  50. }
  51. //----------------------------------------------------------------------
  52. size_t
  53. ModelListFile::calculateSize() const
  54. {
  55. return 0;
  56. }
  57. //----------------------------------------------------------------------
  58. ModelListFile::ModelList&
  59. ModelListFile::getModels()
  60. {
  61. return m_models;
  62. }
  63. //----------------------------------------------------------------------
  64. uint16
  65. ModelListFile::getScale() const
  66. {
  67. return m_scale;
  68. }
  69. //----------------------------------------------------------------------
  70. void
  71. ModelListFile::setScale( uint16 scale )
  72. {
  73. m_scale = scale;
  74. }
  75. //----------------------------------------------------------------------
  76. }
  77. }