Open Source Tomb Raider Engine
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*!
  2. * \file include/TextureManager.h
  3. * \brief Texture registry
  4. *
  5. * \author Mongoose
  6. * \author xythobuz
  7. */
  8. #ifndef _TEXTURE_MANAGER_H
  9. #define _TEXTURE_MANAGER_H
  10. #include <vector>
  11. /*!
  12. * \brief Texture registry
  13. */
  14. class TextureManager {
  15. public:
  16. enum TextureFlag {
  17. fUseMultiTexture = (1 << 0),
  18. };
  19. /*!
  20. * \brief Constructs an object of Texture
  21. */
  22. TextureManager();
  23. /*!
  24. * \brief Deconstructs an object of Texture
  25. */
  26. ~TextureManager();
  27. /*!
  28. * \brief Resets all texture data
  29. */
  30. void reset();
  31. int initialize();
  32. /*!
  33. * \brief Get number of textures in use
  34. * \returns used texture count, or -1 on error (uninitialized)
  35. */
  36. int getTextureCount();
  37. /*!
  38. * \brief Sets up multitexture rendering with passed ids
  39. * \param texture0 first texture for multitexture
  40. * \param texture1 second texture for multitexture
  41. */
  42. void bindMultiTexture(int texture0, int texture1);
  43. /*!
  44. * \brief Binds the texture for use in GL
  45. * \param n valid texture index
  46. */
  47. void bindTextureId(unsigned int n);
  48. /*!
  49. * \brief Clears an option flag
  50. * \param flag flag to clear
  51. */
  52. void clearFlag(TextureFlag flag);
  53. void disableMultiTexture();
  54. /*!
  55. * \brief Loads Buffer as texture
  56. * \param image pixmap matching other params
  57. * \param width width of image
  58. * \param height height of image
  59. * \param mode mode of image
  60. * \param bpp bits per pixel of image
  61. * \param slot slot (ID) of image
  62. * \returns texture ID or < 0 on error
  63. */
  64. int loadBufferSlot(unsigned char *image,
  65. unsigned int width, unsigned int height,
  66. ColorMode mode, unsigned int bpp,
  67. unsigned int slot);
  68. int loadImage(const char *filename);
  69. /*!
  70. * \brief Sets an option flag
  71. * \param flag flag to set
  72. */
  73. void setFlag(TextureFlag flag);
  74. void useMultiTexture(float aU, float aV, float bU, float bV);
  75. private:
  76. int loadTGA(const char *filename);
  77. int loadPCX(const char *filename);
  78. int loadPNG(const char *filename);
  79. std::vector<unsigned int> mTextureIds;
  80. unsigned int mFlags;
  81. };
  82. TextureManager &getTextureManager();
  83. #endif