texture2d.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. // OpenGL Image Copyright (c) 2008 - 2011 G-Truc Creation (www.g-truc.net)
  3. ///////////////////////////////////////////////////////////////////////////////////////////////////
  4. // Created : 2010-01-09
  5. // Updated : 2010-01-09
  6. // Licence : This source is under MIT License
  7. // File : gli/core/texture2d.hpp
  8. ///////////////////////////////////////////////////////////////////////////////////////////////////
  9. #ifndef GLI_CORE_TEXTURE2D_INCLUDED
  10. #define GLI_CORE_TEXTURE2D_INCLUDED
  11. #include "image2d.hpp"
  12. namespace gli
  13. {
  14. enum comp
  15. {
  16. X = 0,
  17. R = 0,
  18. S = 0,
  19. Y = 1,
  20. G = 1,
  21. T = 1,
  22. Z = 2,
  23. B = 2,
  24. P = 2,
  25. W = 3,
  26. A = 3,
  27. Q = 3
  28. };
  29. //template <template <typename> class mem>
  30. class texture2D
  31. {
  32. public:
  33. typedef image2D::dimensions_type dimensions_type;
  34. typedef image2D::texcoord_type texcoord_type;
  35. typedef image2D::size_type size_type;
  36. typedef image2D::value_type value_type;
  37. typedef image2D::format_type format_type;
  38. typedef image2D::data_type data_type;
  39. typedef std::size_t level_type;
  40. public:
  41. texture2D();
  42. explicit texture2D(level_type const & Levels);
  43. //texture2D(image const & Mipmap, bool GenerateMipmaps = false);
  44. ~texture2D();
  45. image2D & operator[] (
  46. level_type const & Level);
  47. image2D const & operator[] (
  48. level_type const & Level) const;
  49. bool empty() const;
  50. format_type format() const;
  51. level_type levels() const;
  52. void resize(level_type const & Levels);
  53. template <typename genType>
  54. void swizzle(gli::comp X, gli::comp Y, gli::comp Z, gli::comp W);
  55. private:
  56. std::vector<image2D> Images;
  57. };
  58. //namespace wip
  59. //{
  60. // // plain
  61. // template <typename genType>
  62. // class plain
  63. // {
  64. // public:
  65. //
  66. // private:
  67. // boost::shared_array<genType> Data;
  68. // };
  69. //
  70. // // texture2D
  71. // template
  72. // <
  73. // typename genType,
  74. // template <typename> class surface = plain
  75. // >
  76. // class texture2D
  77. // {
  78. // public:
  79. // typedef genType value_type;
  80. //
  81. // private:
  82. // class image_impl
  83. // {
  84. // public:
  85. // template <typename coordType>
  86. // value_type const & operator() (coordType const & Coord) const;
  87. //
  88. // private:
  89. // surface<value_type> Surface;
  90. // };
  91. //
  92. // public:
  93. // typedef image_impl image;
  94. // typedef std::vector<image> mipmaps;
  95. // typedef typename mipmaps::size_type level_type;
  96. //
  97. // level_type levels() const;
  98. // image & operator[] (level_type Level);
  99. // image const & operator[] (level_type Level) const;
  100. //
  101. // private:
  102. // mipmaps Mipmaps;
  103. // };
  104. //
  105. //}//namespace wip
  106. }//namespace gli
  107. #include "texture2d.inl"
  108. #endif//GLI_CORE_TEXTURE2D_INCLUDED