Simple game engine with complete export to scripting language
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
1.5KB

  1. #ifndef BLUECORE_MODEL_MANAGER_H
  2. #define BLUECORE_MODEL_MANAGER_H
  3. // system includes
  4. #include <map>
  5. #include <string>
  6. // project includes
  7. #include "Utilities/Referenced.h"
  8. #include "Utilities/Named.h"
  9. #include "TextureManager.h"
  10. #include "ShaderManager.h"
  11. #include "MeshManager.h"
  12. #include "RenderQueue.h"
  13. // forward declaration
  14. class TiXmlElement;
  15. namespace BlueCore
  16. {
  17. class Model : public Named, public RenderItem
  18. {
  19. public:
  20. struct TextureUnit
  21. {
  22. std::string mName;
  23. ref_ptr<Texture> mTexture;
  24. };
  25. struct RenderPassDefinition
  26. {
  27. bool Enabled;
  28. std::vector<TextureUnit> Textures;
  29. ShaderProgram Program;
  30. bool Tangents;
  31. float Shininess;
  32. float Specular[4];
  33. };
  34. ref_ptr<Mesh> ModelMesh;
  35. ref_ptr<Mesh> ShadowMesh;
  36. RenderPassDefinition AmbientPass;
  37. RenderPassDefinition LitPass;
  38. RenderPassDefinition DefaultPass;
  39. void render(RenderDevice *) const;
  40. };
  41. class ModelManager : public Referenced
  42. {
  43. private:
  44. typedef std::map< std::string, weak_ptr<Model> > ModelContainer;
  45. ModelContainer _Models;
  46. weak_ptr<TextureManager> _TextureManager;
  47. weak_ptr<ShaderManager> _ShaderManager;
  48. weak_ptr<MeshManager> _MeshManager;
  49. void parseRenderPassDefinition(Model::RenderPassDefinition &Definition,
  50. const TiXmlElement* DefinitionElement);
  51. void unload();
  52. public:
  53. ModelManager(TextureManager *texturemanager, ShaderManager* shadermanager,
  54. MeshManager* meshmanager);
  55. ~ModelManager();
  56. Model *loadModel(const std::string &name);
  57. };
  58. } // namespace BlueCore
  59. #endif