gltf_buffer_view.cpp 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*************************************************************************/
  2. /* gltf_buffer_view.cpp */
  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. #include "gltf_buffer_view.h"
  31. void GLTFBufferView::_bind_methods() {
  32. ClassDB::bind_method(D_METHOD("get_buffer"), &GLTFBufferView::get_buffer);
  33. ClassDB::bind_method(D_METHOD("set_buffer", "buffer"), &GLTFBufferView::set_buffer);
  34. ClassDB::bind_method(D_METHOD("get_byte_offset"), &GLTFBufferView::get_byte_offset);
  35. ClassDB::bind_method(D_METHOD("set_byte_offset", "byte_offset"), &GLTFBufferView::set_byte_offset);
  36. ClassDB::bind_method(D_METHOD("get_byte_length"), &GLTFBufferView::get_byte_length);
  37. ClassDB::bind_method(D_METHOD("set_byte_length", "byte_length"), &GLTFBufferView::set_byte_length);
  38. ClassDB::bind_method(D_METHOD("get_byte_stride"), &GLTFBufferView::get_byte_stride);
  39. ClassDB::bind_method(D_METHOD("set_byte_stride", "byte_stride"), &GLTFBufferView::set_byte_stride);
  40. ClassDB::bind_method(D_METHOD("get_indices"), &GLTFBufferView::get_indices);
  41. ClassDB::bind_method(D_METHOD("set_indices", "indices"), &GLTFBufferView::set_indices);
  42. ADD_PROPERTY(PropertyInfo(Variant::INT, "buffer"), "set_buffer", "get_buffer"); // GLTFBufferIndex
  43. ADD_PROPERTY(PropertyInfo(Variant::INT, "byte_offset"), "set_byte_offset", "get_byte_offset"); // int
  44. ADD_PROPERTY(PropertyInfo(Variant::INT, "byte_length"), "set_byte_length", "get_byte_length"); // int
  45. ADD_PROPERTY(PropertyInfo(Variant::INT, "byte_stride"), "set_byte_stride", "get_byte_stride"); // int
  46. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "indices"), "set_indices", "get_indices"); // bool
  47. }
  48. GLTFBufferIndex GLTFBufferView::get_buffer() {
  49. return buffer;
  50. }
  51. void GLTFBufferView::set_buffer(GLTFBufferIndex p_buffer) {
  52. buffer = p_buffer;
  53. }
  54. int GLTFBufferView::get_byte_offset() {
  55. return byte_offset;
  56. }
  57. void GLTFBufferView::set_byte_offset(int p_byte_offset) {
  58. byte_offset = p_byte_offset;
  59. }
  60. int GLTFBufferView::get_byte_length() {
  61. return byte_length;
  62. }
  63. void GLTFBufferView::set_byte_length(int p_byte_length) {
  64. byte_length = p_byte_length;
  65. }
  66. int GLTFBufferView::get_byte_stride() {
  67. return byte_stride;
  68. }
  69. void GLTFBufferView::set_byte_stride(int p_byte_stride) {
  70. byte_stride = p_byte_stride;
  71. }
  72. bool GLTFBufferView::get_indices() {
  73. return indices;
  74. }
  75. void GLTFBufferView::set_indices(bool p_indices) {
  76. indices = p_indices;
  77. }