| 1 | /**************************************************************************/ |
| 2 | /* gltf_buffer_view.cpp */ |
| 3 | /**************************************************************************/ |
| 4 | /* This file is part of: */ |
| 5 | /* GODOT ENGINE */ |
| 6 | /* https://godotengine.org */ |
| 7 | /**************************************************************************/ |
| 8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
| 9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
| 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 | |
| 31 | #include "gltf_buffer_view.h" |
| 32 | |
| 33 | void GLTFBufferView::_bind_methods() { |
| 34 | ClassDB::bind_method(D_METHOD("get_buffer" ), &GLTFBufferView::get_buffer); |
| 35 | ClassDB::bind_method(D_METHOD("set_buffer" , "buffer" ), &GLTFBufferView::set_buffer); |
| 36 | ClassDB::bind_method(D_METHOD("get_byte_offset" ), &GLTFBufferView::get_byte_offset); |
| 37 | ClassDB::bind_method(D_METHOD("set_byte_offset" , "byte_offset" ), &GLTFBufferView::set_byte_offset); |
| 38 | ClassDB::bind_method(D_METHOD("get_byte_length" ), &GLTFBufferView::get_byte_length); |
| 39 | ClassDB::bind_method(D_METHOD("set_byte_length" , "byte_length" ), &GLTFBufferView::set_byte_length); |
| 40 | ClassDB::bind_method(D_METHOD("get_byte_stride" ), &GLTFBufferView::get_byte_stride); |
| 41 | ClassDB::bind_method(D_METHOD("set_byte_stride" , "byte_stride" ), &GLTFBufferView::set_byte_stride); |
| 42 | ClassDB::bind_method(D_METHOD("get_indices" ), &GLTFBufferView::get_indices); |
| 43 | ClassDB::bind_method(D_METHOD("set_indices" , "indices" ), &GLTFBufferView::set_indices); |
| 44 | |
| 45 | ADD_PROPERTY(PropertyInfo(Variant::INT, "buffer" ), "set_buffer" , "get_buffer" ); // GLTFBufferIndex |
| 46 | ADD_PROPERTY(PropertyInfo(Variant::INT, "byte_offset" ), "set_byte_offset" , "get_byte_offset" ); // int |
| 47 | ADD_PROPERTY(PropertyInfo(Variant::INT, "byte_length" ), "set_byte_length" , "get_byte_length" ); // int |
| 48 | ADD_PROPERTY(PropertyInfo(Variant::INT, "byte_stride" ), "set_byte_stride" , "get_byte_stride" ); // int |
| 49 | ADD_PROPERTY(PropertyInfo(Variant::BOOL, "indices" ), "set_indices" , "get_indices" ); // bool |
| 50 | } |
| 51 | |
| 52 | GLTFBufferIndex GLTFBufferView::get_buffer() { |
| 53 | return buffer; |
| 54 | } |
| 55 | |
| 56 | void GLTFBufferView::set_buffer(GLTFBufferIndex p_buffer) { |
| 57 | buffer = p_buffer; |
| 58 | } |
| 59 | |
| 60 | int GLTFBufferView::get_byte_offset() { |
| 61 | return byte_offset; |
| 62 | } |
| 63 | |
| 64 | void GLTFBufferView::set_byte_offset(int p_byte_offset) { |
| 65 | byte_offset = p_byte_offset; |
| 66 | } |
| 67 | |
| 68 | int GLTFBufferView::get_byte_length() { |
| 69 | return byte_length; |
| 70 | } |
| 71 | |
| 72 | void GLTFBufferView::set_byte_length(int p_byte_length) { |
| 73 | byte_length = p_byte_length; |
| 74 | } |
| 75 | |
| 76 | int GLTFBufferView::get_byte_stride() { |
| 77 | return byte_stride; |
| 78 | } |
| 79 | |
| 80 | void GLTFBufferView::set_byte_stride(int p_byte_stride) { |
| 81 | byte_stride = p_byte_stride; |
| 82 | } |
| 83 | |
| 84 | bool GLTFBufferView::get_indices() { |
| 85 | return indices; |
| 86 | } |
| 87 | |
| 88 | void GLTFBufferView::set_indices(bool p_indices) { |
| 89 | indices = p_indices; |
| 90 | } |
| 91 | |