Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/modules/gltf/structures/gltf_accessor.h
10278 views
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
#pragma once
32
33
#include "../gltf_defines.h"
34
35
#include "core/io/resource.h"
36
37
struct GLTFAccessor : public Resource {
38
GDCLASS(GLTFAccessor, Resource);
39
friend class GLTFDocument;
40
41
public:
42
enum GLTFAccessorType {
43
TYPE_SCALAR,
44
TYPE_VEC2,
45
TYPE_VEC3,
46
TYPE_VEC4,
47
TYPE_MAT2,
48
TYPE_MAT3,
49
TYPE_MAT4,
50
};
51
52
enum GLTFComponentType {
53
COMPONENT_TYPE_NONE = 0,
54
COMPONENT_TYPE_SIGNED_BYTE = 5120,
55
COMPONENT_TYPE_UNSIGNED_BYTE = 5121,
56
COMPONENT_TYPE_SIGNED_SHORT = 5122,
57
COMPONENT_TYPE_UNSIGNED_SHORT = 5123,
58
COMPONENT_TYPE_SIGNED_INT = 5124,
59
COMPONENT_TYPE_UNSIGNED_INT = 5125,
60
COMPONENT_TYPE_SINGLE_FLOAT = 5126,
61
COMPONENT_TYPE_DOUBLE_FLOAT = 5130,
62
COMPONENT_TYPE_HALF_FLOAT = 5131,
63
COMPONENT_TYPE_SIGNED_LONG = 5134,
64
COMPONENT_TYPE_UNSIGNED_LONG = 5135,
65
};
66
67
private:
68
GLTFBufferViewIndex buffer_view = -1;
69
int64_t byte_offset = 0;
70
GLTFComponentType component_type = COMPONENT_TYPE_NONE;
71
bool normalized = false;
72
int64_t count = 0;
73
GLTFAccessorType accessor_type = GLTFAccessorType::TYPE_SCALAR;
74
Vector<double> min;
75
Vector<double> max;
76
int64_t sparse_count = 0;
77
GLTFBufferViewIndex sparse_indices_buffer_view = 0;
78
int64_t sparse_indices_byte_offset = 0;
79
GLTFComponentType sparse_indices_component_type = COMPONENT_TYPE_NONE;
80
GLTFBufferViewIndex sparse_values_buffer_view = 0;
81
int64_t sparse_values_byte_offset = 0;
82
83
protected:
84
static void _bind_methods();
85
86
#ifndef DISABLE_DEPRECATED
87
// 32-bit and non-const versions for compatibility.
88
GLTFBufferViewIndex _get_buffer_view_bind_compat_106220();
89
int _get_byte_offset_bind_compat_106220();
90
int _get_component_type_bind_compat_106220();
91
void _set_component_type_bind_compat_106220(int p_component_type);
92
bool _get_normalized_bind_compat_106220();
93
int _get_count_bind_compat_106220();
94
GLTFAccessorType _get_accessor_type_bind_compat_106220();
95
int _get_type_bind_compat_106220();
96
Vector<double> _get_min_bind_compat_106220();
97
Vector<double> _get_max_bind_compat_106220();
98
int _get_sparse_count_bind_compat_106220();
99
int _get_sparse_indices_buffer_view_bind_compat_106220();
100
int _get_sparse_indices_byte_offset_bind_compat_106220();
101
int _get_sparse_indices_component_type_bind_compat_106220();
102
void _set_sparse_indices_component_type_bind_compat_106220(int p_sparse_indices_component_type);
103
int _get_sparse_values_buffer_view_bind_compat_106220();
104
int _get_sparse_values_byte_offset_bind_compat_106220();
105
static void _bind_compatibility_methods();
106
#endif // DISABLE_DEPRECATED
107
108
public:
109
GLTFBufferViewIndex get_buffer_view() const;
110
void set_buffer_view(GLTFBufferViewIndex p_buffer_view);
111
112
int64_t get_byte_offset() const;
113
void set_byte_offset(int64_t p_byte_offset);
114
115
GLTFComponentType get_component_type() const;
116
void set_component_type(GLTFComponentType p_component_type);
117
118
bool get_normalized() const;
119
void set_normalized(bool p_normalized);
120
121
int64_t get_count() const;
122
void set_count(int64_t p_count);
123
124
GLTFAccessorType get_accessor_type() const;
125
void set_accessor_type(GLTFAccessorType p_accessor_type);
126
127
int get_type() const;
128
void set_type(int p_accessor_type);
129
130
Vector<double> get_min() const;
131
void set_min(Vector<double> p_min);
132
133
Vector<double> get_max() const;
134
void set_max(Vector<double> p_max);
135
136
int64_t get_sparse_count() const;
137
void set_sparse_count(int64_t p_sparse_count);
138
139
GLTFBufferViewIndex get_sparse_indices_buffer_view() const;
140
void set_sparse_indices_buffer_view(GLTFBufferViewIndex p_sparse_indices_buffer_view);
141
142
int64_t get_sparse_indices_byte_offset() const;
143
void set_sparse_indices_byte_offset(int64_t p_sparse_indices_byte_offset);
144
145
GLTFComponentType get_sparse_indices_component_type() const;
146
void set_sparse_indices_component_type(GLTFComponentType p_sparse_indices_component_type);
147
148
GLTFBufferViewIndex get_sparse_values_buffer_view() const;
149
void set_sparse_values_buffer_view(GLTFBufferViewIndex p_sparse_values_buffer_view);
150
151
int64_t get_sparse_values_byte_offset() const;
152
void set_sparse_values_byte_offset(int64_t p_sparse_values_byte_offset);
153
};
154
155
VARIANT_ENUM_CAST(GLTFAccessor::GLTFAccessorType);
156
VARIANT_ENUM_CAST(GLTFAccessor::GLTFComponentType);
157
158