| 1 | /**************************************************************************/ |
| 2 | /* gltf_accessor.h */ |
| 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 | #ifndef GLTF_ACCESSOR_H |
| 32 | #define GLTF_ACCESSOR_H |
| 33 | |
| 34 | #include "../gltf_defines.h" |
| 35 | |
| 36 | #include "core/io/resource.h" |
| 37 | |
| 38 | struct GLTFAccessor : public Resource { |
| 39 | GDCLASS(GLTFAccessor, Resource); |
| 40 | friend class GLTFDocument; |
| 41 | |
| 42 | private: |
| 43 | GLTFBufferViewIndex buffer_view = -1; |
| 44 | int byte_offset = 0; |
| 45 | int component_type = 0; |
| 46 | bool normalized = false; |
| 47 | int count = 0; |
| 48 | GLTFType type = GLTFType::TYPE_SCALAR; |
| 49 | Vector<double> min; |
| 50 | Vector<double> max; |
| 51 | int sparse_count = 0; |
| 52 | int sparse_indices_buffer_view = 0; |
| 53 | int sparse_indices_byte_offset = 0; |
| 54 | int sparse_indices_component_type = 0; |
| 55 | int sparse_values_buffer_view = 0; |
| 56 | int sparse_values_byte_offset = 0; |
| 57 | |
| 58 | protected: |
| 59 | static void _bind_methods(); |
| 60 | |
| 61 | public: |
| 62 | GLTFBufferViewIndex get_buffer_view(); |
| 63 | void set_buffer_view(GLTFBufferViewIndex p_buffer_view); |
| 64 | |
| 65 | int get_byte_offset(); |
| 66 | void set_byte_offset(int p_byte_offset); |
| 67 | |
| 68 | int get_component_type(); |
| 69 | void set_component_type(int p_component_type); |
| 70 | |
| 71 | bool get_normalized(); |
| 72 | void set_normalized(bool p_normalized); |
| 73 | |
| 74 | int get_count(); |
| 75 | void set_count(int p_count); |
| 76 | |
| 77 | int get_type(); |
| 78 | void set_type(int p_type); |
| 79 | |
| 80 | Vector<double> get_min(); |
| 81 | void set_min(Vector<double> p_min); |
| 82 | |
| 83 | Vector<double> get_max(); |
| 84 | void set_max(Vector<double> p_max); |
| 85 | |
| 86 | int get_sparse_count(); |
| 87 | void set_sparse_count(int p_sparse_count); |
| 88 | |
| 89 | int get_sparse_indices_buffer_view(); |
| 90 | void set_sparse_indices_buffer_view(int p_sparse_indices_buffer_view); |
| 91 | |
| 92 | int get_sparse_indices_byte_offset(); |
| 93 | void set_sparse_indices_byte_offset(int p_sparse_indices_byte_offset); |
| 94 | |
| 95 | int get_sparse_indices_component_type(); |
| 96 | void set_sparse_indices_component_type(int p_sparse_indices_component_type); |
| 97 | |
| 98 | int get_sparse_values_buffer_view(); |
| 99 | void set_sparse_values_buffer_view(int p_sparse_values_buffer_view); |
| 100 | |
| 101 | int get_sparse_values_byte_offset(); |
| 102 | void set_sparse_values_byte_offset(int p_sparse_values_byte_offset); |
| 103 | }; |
| 104 | |
| 105 | #endif // GLTF_ACCESSOR_H |
| 106 | |