PolyRenderDataArray.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. Copyright (C) 2014 by Ivan Safrin
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. THE SOFTWARE.
  18. */
  19. #pragma once
  20. #include "PolyGlobals.h"
  21. #include <vector>
  22. namespace Polycode {
  23. class RenderDataArray : public PolyBase {
  24. public:
  25. RenderDataArray(unsigned int type);
  26. unsigned int type;
  27. virtual void *getArrayData();
  28. virtual unsigned int getDataSize();
  29. /**
  30. * Vertex position array.
  31. */
  32. static const int VERTEX_DATA_ARRAY = 0;
  33. /**
  34. * Vertex color array.
  35. */
  36. static const int COLOR_DATA_ARRAY = 1;
  37. /**
  38. * Vertex normal array.
  39. */
  40. static const int NORMAL_DATA_ARRAY = 2;
  41. /**
  42. * Vertex texture coordinate array.
  43. */
  44. static const int TEXCOORD_DATA_ARRAY = 3;
  45. /**
  46. * Tangent array.
  47. */
  48. static const int TANGENT_DATA_ARRAY = 4;
  49. /**
  50. * Bone weight array.
  51. */
  52. static const int BONE_WEIGHT_DATA_ARRAY = 5;
  53. /**
  54. * Bone weight array.
  55. */
  56. static const int BONE_INDEX_DATA_ARRAY = 6;
  57. /**
  58. * Index data array.
  59. */
  60. static const int INDEX_DATA_ARRAY = 7;
  61. /**
  62. * Secondary texture coordinate array.
  63. */
  64. static const int TEXCOORD2_DATA_ARRAY = 8;
  65. };
  66. class VertexDataArray : public RenderDataArray {
  67. public:
  68. VertexDataArray(unsigned int type) : RenderDataArray(type) {
  69. }
  70. std::vector<PolyRendererVertexType> data;
  71. virtual void *getArrayData();
  72. virtual unsigned int getDataSize();
  73. };
  74. class IndexDataArray : public RenderDataArray {
  75. public:
  76. IndexDataArray(unsigned int type) : RenderDataArray(type) {
  77. }
  78. std::vector<PolyRendererIndexType> data;
  79. virtual void *getArrayData();
  80. virtual unsigned int getDataSize();
  81. };
  82. }