Path: blob/master/modules/gltf/structures/gltf_accessor.h
10278 views
/**************************************************************************/1/* gltf_accessor.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "../gltf_defines.h"3334#include "core/io/resource.h"3536struct GLTFAccessor : public Resource {37GDCLASS(GLTFAccessor, Resource);38friend class GLTFDocument;3940public:41enum GLTFAccessorType {42TYPE_SCALAR,43TYPE_VEC2,44TYPE_VEC3,45TYPE_VEC4,46TYPE_MAT2,47TYPE_MAT3,48TYPE_MAT4,49};5051enum GLTFComponentType {52COMPONENT_TYPE_NONE = 0,53COMPONENT_TYPE_SIGNED_BYTE = 5120,54COMPONENT_TYPE_UNSIGNED_BYTE = 5121,55COMPONENT_TYPE_SIGNED_SHORT = 5122,56COMPONENT_TYPE_UNSIGNED_SHORT = 5123,57COMPONENT_TYPE_SIGNED_INT = 5124,58COMPONENT_TYPE_UNSIGNED_INT = 5125,59COMPONENT_TYPE_SINGLE_FLOAT = 5126,60COMPONENT_TYPE_DOUBLE_FLOAT = 5130,61COMPONENT_TYPE_HALF_FLOAT = 5131,62COMPONENT_TYPE_SIGNED_LONG = 5134,63COMPONENT_TYPE_UNSIGNED_LONG = 5135,64};6566private:67GLTFBufferViewIndex buffer_view = -1;68int64_t byte_offset = 0;69GLTFComponentType component_type = COMPONENT_TYPE_NONE;70bool normalized = false;71int64_t count = 0;72GLTFAccessorType accessor_type = GLTFAccessorType::TYPE_SCALAR;73Vector<double> min;74Vector<double> max;75int64_t sparse_count = 0;76GLTFBufferViewIndex sparse_indices_buffer_view = 0;77int64_t sparse_indices_byte_offset = 0;78GLTFComponentType sparse_indices_component_type = COMPONENT_TYPE_NONE;79GLTFBufferViewIndex sparse_values_buffer_view = 0;80int64_t sparse_values_byte_offset = 0;8182protected:83static void _bind_methods();8485#ifndef DISABLE_DEPRECATED86// 32-bit and non-const versions for compatibility.87GLTFBufferViewIndex _get_buffer_view_bind_compat_106220();88int _get_byte_offset_bind_compat_106220();89int _get_component_type_bind_compat_106220();90void _set_component_type_bind_compat_106220(int p_component_type);91bool _get_normalized_bind_compat_106220();92int _get_count_bind_compat_106220();93GLTFAccessorType _get_accessor_type_bind_compat_106220();94int _get_type_bind_compat_106220();95Vector<double> _get_min_bind_compat_106220();96Vector<double> _get_max_bind_compat_106220();97int _get_sparse_count_bind_compat_106220();98int _get_sparse_indices_buffer_view_bind_compat_106220();99int _get_sparse_indices_byte_offset_bind_compat_106220();100int _get_sparse_indices_component_type_bind_compat_106220();101void _set_sparse_indices_component_type_bind_compat_106220(int p_sparse_indices_component_type);102int _get_sparse_values_buffer_view_bind_compat_106220();103int _get_sparse_values_byte_offset_bind_compat_106220();104static void _bind_compatibility_methods();105#endif // DISABLE_DEPRECATED106107public:108GLTFBufferViewIndex get_buffer_view() const;109void set_buffer_view(GLTFBufferViewIndex p_buffer_view);110111int64_t get_byte_offset() const;112void set_byte_offset(int64_t p_byte_offset);113114GLTFComponentType get_component_type() const;115void set_component_type(GLTFComponentType p_component_type);116117bool get_normalized() const;118void set_normalized(bool p_normalized);119120int64_t get_count() const;121void set_count(int64_t p_count);122123GLTFAccessorType get_accessor_type() const;124void set_accessor_type(GLTFAccessorType p_accessor_type);125126int get_type() const;127void set_type(int p_accessor_type);128129Vector<double> get_min() const;130void set_min(Vector<double> p_min);131132Vector<double> get_max() const;133void set_max(Vector<double> p_max);134135int64_t get_sparse_count() const;136void set_sparse_count(int64_t p_sparse_count);137138GLTFBufferViewIndex get_sparse_indices_buffer_view() const;139void set_sparse_indices_buffer_view(GLTFBufferViewIndex p_sparse_indices_buffer_view);140141int64_t get_sparse_indices_byte_offset() const;142void set_sparse_indices_byte_offset(int64_t p_sparse_indices_byte_offset);143144GLTFComponentType get_sparse_indices_component_type() const;145void set_sparse_indices_component_type(GLTFComponentType p_sparse_indices_component_type);146147GLTFBufferViewIndex get_sparse_values_buffer_view() const;148void set_sparse_values_buffer_view(GLTFBufferViewIndex p_sparse_values_buffer_view);149150int64_t get_sparse_values_byte_offset() const;151void set_sparse_values_byte_offset(int64_t p_sparse_values_byte_offset);152};153154VARIANT_ENUM_CAST(GLTFAccessor::GLTFAccessorType);155VARIANT_ENUM_CAST(GLTFAccessor::GLTFComponentType);156157158