gltf_accessor.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*************************************************************************/
  2. /* gltf_accessor.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef GLTF_ACCESSOR_H
  31. #define GLTF_ACCESSOR_H
  32. #include "core/resource.h"
  33. #include "gltf_document.h"
  34. struct GLTFAccessor : public Resource {
  35. GDCLASS(GLTFAccessor, Resource);
  36. friend class GLTFDocument;
  37. private:
  38. GLTFBufferViewIndex buffer_view = 0;
  39. int byte_offset = 0;
  40. int component_type = 0;
  41. bool normalized = false;
  42. int count = 0;
  43. GLTFDocument::GLTFType
  44. type = GLTFDocument::TYPE_SCALAR;
  45. PoolVector<float> min;
  46. PoolVector<float> max;
  47. int sparse_count = 0;
  48. int sparse_indices_buffer_view = 0;
  49. int sparse_indices_byte_offset = 0;
  50. int sparse_indices_component_type = 0;
  51. int sparse_values_buffer_view = 0;
  52. int sparse_values_byte_offset = 0;
  53. protected:
  54. static void _bind_methods();
  55. public:
  56. GLTFBufferViewIndex get_buffer_view();
  57. void set_buffer_view(GLTFBufferViewIndex p_buffer_view);
  58. int get_byte_offset();
  59. void set_byte_offset(int p_byte_offset);
  60. int get_component_type();
  61. void set_component_type(int p_component_type);
  62. bool get_normalized();
  63. void set_normalized(bool p_normalized);
  64. int get_count();
  65. void set_count(int p_count);
  66. int get_type();
  67. void set_type(int p_type);
  68. PoolVector<float> get_min();
  69. void set_min(PoolVector<float> p_min);
  70. PoolVector<float> get_max();
  71. void set_max(PoolVector<float> p_max);
  72. int get_sparse_count();
  73. void set_sparse_count(int p_sparse_count);
  74. int get_sparse_indices_buffer_view();
  75. void set_sparse_indices_buffer_view(int p_sparse_indices_buffer_view);
  76. int get_sparse_indices_byte_offset();
  77. void set_sparse_indices_byte_offset(int p_sparse_indices_byte_offset);
  78. int get_sparse_indices_component_type();
  79. void set_sparse_indices_component_type(int p_sparse_indices_component_type);
  80. int get_sparse_values_buffer_view();
  81. void set_sparse_values_buffer_view(int p_sparse_values_buffer_view);
  82. int get_sparse_values_byte_offset();
  83. void set_sparse_values_byte_offset(int p_sparse_values_byte_offset);
  84. };
  85. #endif // GLTF_ACCESSOR_H