texture2d_array.inl 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. // OpenGL Image Copyright (c) 2008 - 2011 G-Truc Creation (www.g-truc.net)
  3. ///////////////////////////////////////////////////////////////////////////////////////////////////
  4. // Created : 2011-04-06
  5. // Updated : 2011-04-06
  6. // Licence : This source is under MIT License
  7. // File : gli/core/texture_cube.inl
  8. ///////////////////////////////////////////////////////////////////////////////////////////////////
  9. namespace gli
  10. {
  11. inline texture2DArray::texture2DArray()
  12. {}
  13. inline texture2DArray::texture2DArray
  14. (
  15. texture2DArray::layer_type const & Layers,
  16. texture2DArray::level_type const & Levels
  17. )
  18. {
  19. this->Arrays.resize(Layers);
  20. for(texture2DArray::size_type i = 0; i < this->Arrays.size(); ++i)
  21. this->Arrays[i].resize(Levels);
  22. }
  23. inline texture2DArray::~texture2DArray()
  24. {}
  25. inline texture2D & texture2DArray::operator[]
  26. (
  27. layer_type const & Layer
  28. )
  29. {
  30. return this->Arrays[Layer];
  31. }
  32. inline texture2D const & texture2DArray::operator[]
  33. (
  34. layer_type const & Layer
  35. ) const
  36. {
  37. return this->Arrays[Layer];
  38. }
  39. inline bool texture2DArray::empty() const
  40. {
  41. return this->Arrays.empty();
  42. }
  43. inline texture2DArray::format_type texture2DArray::format() const
  44. {
  45. return this->Arrays.empty() ? FORMAT_NULL : this->Arrays[0].format();
  46. }
  47. inline texture2DArray::layer_type texture2DArray::layers() const
  48. {
  49. return this->Arrays.size();
  50. }
  51. inline texture2DArray::level_type texture2DArray::levels() const
  52. {
  53. if(this->empty())
  54. return 0;
  55. return this->Arrays[0].levels();
  56. }
  57. inline void texture2DArray::resize
  58. (
  59. texture2DArray::layer_type const & Layers,
  60. texture2DArray::level_type const & Levels
  61. )
  62. {
  63. this->Arrays.resize(Layers);
  64. for(texture2DArray::layer_type i = 0; i < this->Arrays.size(); ++i)
  65. this->Arrays[i].resize(Levels);
  66. }
  67. }//namespace gli