Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

World.h 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*!
  2. * \file include/World.h
  3. * \brief The game world (model)
  4. *
  5. * \author Mongoose
  6. * \author xythobuz
  7. */
  8. #ifndef _WORLD_H_
  9. #define _WORLD_H_
  10. #include <memory>
  11. #include <vector>
  12. #include "Entity.h"
  13. #include "Mesh.h"
  14. #include "Room.h"
  15. #include "SkeletalModel.h"
  16. #include "Sprite.h"
  17. #include "StaticMesh.h"
  18. /*!
  19. * \brief The game world (model)
  20. */
  21. class World {
  22. public:
  23. /*!
  24. * \brief Deconstructs an object of World
  25. */
  26. ~World();
  27. /*!
  28. * \brief Clears all data in world
  29. */
  30. void destroy();
  31. void addRoom(Room* room);
  32. unsigned long sizeRoom();
  33. Room& getRoom(unsigned long index);
  34. void addSprite(SpriteSequence* sprite);
  35. unsigned long sizeSprite();
  36. SpriteSequence& getSprite(unsigned long index);
  37. void addEntity(Entity* entity);
  38. unsigned long sizeEntity();
  39. Entity& getEntity(unsigned long index);
  40. void addSkeletalModel(SkeletalModel* model);
  41. unsigned long sizeSkeletalModel();
  42. SkeletalModel& getSkeletalModel(unsigned long index);
  43. void addStaticMesh(StaticMesh* model);
  44. unsigned long sizeStaticMesh();
  45. StaticMesh& getStaticMesh(unsigned long index);
  46. void addMesh(Mesh* mesh);
  47. unsigned long sizeMesh();
  48. Mesh& getMesh(unsigned long index);
  49. /*!
  50. * \brief Find room a location is in.
  51. *
  52. * If it fails to be in a room it gives closest overlapping room.
  53. * \param index Guessed room index
  54. * \param x X coordinate
  55. * \param y Y coordinate
  56. * \param z Z coordinate
  57. * \returns correct room index or -1 for unknown
  58. */
  59. long getRoomByLocation(long index, float x, float y, float z);
  60. /*!
  61. * \brief Find room a location is in.
  62. *
  63. * If it fails to be in a room it gives closest overlapping room.
  64. * \param x X coordinate
  65. * \param y Y coordinate
  66. * \param z Z coordinate
  67. * \returns correct room index or -1 for unknown
  68. */
  69. long getRoomByLocation(float x, float y, float z);
  70. private:
  71. std::vector<std::unique_ptr<Room>> mRooms;
  72. std::vector<std::unique_ptr<SpriteSequence>> mSprites;
  73. std::vector<std::unique_ptr<Entity>> mEntities;
  74. std::vector<std::unique_ptr<SkeletalModel>> mModels;
  75. std::vector<std::unique_ptr<StaticMesh>> mStaticMeshes;
  76. std::vector<std::unique_ptr<Mesh>> mMeshes;
  77. };
  78. World& getWorld();
  79. #endif