summaryrefslogtreecommitdiffstats
path: root/modules/gltf/structures/gltf_buffer_view.cpp
diff options
context:
space:
mode:
authorLyuma <xn.lyuma@gmail.com>2024-03-09 23:51:52 -0800
committerLyuma <xn.lyuma@gmail.com>2024-03-10 06:07:46 -0700
commitfd2aa564abf86eddc8b4323da8b97bd2fb487bbe (patch)
tree72b42732ae03712250d9e75bacbea60613e9e0bc /modules/gltf/structures/gltf_buffer_view.cpp
parent0ace0a129284ffc6646b199699c1607a316fcec0 (diff)
downloadredot-engine-fd2aa564abf86eddc8b4323da8b97bd2fb487bbe.tar.gz
gltf export: Remove snapping and fix validation
Round min/max correctly in accessors Include correct target in vertex and indices bufferViews Avoid use of Math::snapped Normalize vertex weights.
Diffstat (limited to 'modules/gltf/structures/gltf_buffer_view.cpp')
-rw-r--r--modules/gltf/structures/gltf_buffer_view.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/gltf/structures/gltf_buffer_view.cpp b/modules/gltf/structures/gltf_buffer_view.cpp
index 997c219bf0..0f3746ee34 100644
--- a/modules/gltf/structures/gltf_buffer_view.cpp
+++ b/modules/gltf/structures/gltf_buffer_view.cpp
@@ -46,12 +46,15 @@ void GLTFBufferView::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_byte_stride", "byte_stride"), &GLTFBufferView::set_byte_stride);
ClassDB::bind_method(D_METHOD("get_indices"), &GLTFBufferView::get_indices);
ClassDB::bind_method(D_METHOD("set_indices", "indices"), &GLTFBufferView::set_indices);
+ ClassDB::bind_method(D_METHOD("get_vertex_attributes"), &GLTFBufferView::get_vertex_attributes);
+ ClassDB::bind_method(D_METHOD("set_vertex_attributes", "is_attributes"), &GLTFBufferView::set_vertex_attributes);
ADD_PROPERTY(PropertyInfo(Variant::INT, "buffer"), "set_buffer", "get_buffer"); // GLTFBufferIndex
ADD_PROPERTY(PropertyInfo(Variant::INT, "byte_offset"), "set_byte_offset", "get_byte_offset"); // int
ADD_PROPERTY(PropertyInfo(Variant::INT, "byte_length"), "set_byte_length", "get_byte_length"); // int
ADD_PROPERTY(PropertyInfo(Variant::INT, "byte_stride"), "set_byte_stride", "get_byte_stride"); // int
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "indices"), "set_indices", "get_indices"); // bool
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vertex_attributes"), "set_vertex_attributes", "get_vertex_attributes"); // bool
}
GLTFBufferIndex GLTFBufferView::get_buffer() const {
@@ -94,6 +97,14 @@ void GLTFBufferView::set_indices(bool p_indices) {
indices = p_indices;
}
+bool GLTFBufferView::get_vertex_attributes() const {
+ return vertex_attributes;
+}
+
+void GLTFBufferView::set_vertex_attributes(bool p_attributes) {
+ vertex_attributes = p_attributes;
+}
+
Vector<uint8_t> GLTFBufferView::load_buffer_view_data(const Ref<GLTFState> p_state) const {
ERR_FAIL_COND_V(p_state.is_null(), Vector<uint8_t>());
ERR_FAIL_COND_V_MSG(byte_stride > 0, Vector<uint8_t>(), "Buffer views with byte stride are not yet supported by this method.");