feat: updated engine
This commit is contained in:
parent
cbe99774ff
commit
f4cf6b3999
6607 changed files with 910135 additions and 430025 deletions
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
#include "../gltf_state.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
void GLTFBufferView::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("load_buffer_view_data", "state"), &GLTFBufferView::load_buffer_view_data);
|
||||
|
||||
|
|
@ -154,10 +156,15 @@ GLTFBufferViewIndex GLTFBufferView::write_new_buffer_view_into_state(const Ref<G
|
|||
// This is used by accessors. The byte offset of an accessor MUST be a multiple of the accessor's component size.
|
||||
// https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#data-alignment
|
||||
int64_t byte_offset = state_buffer.size();
|
||||
int64_t padding_bytes = 0;
|
||||
if (byte_offset % p_alignment != 0) {
|
||||
byte_offset += p_alignment - (byte_offset % p_alignment);
|
||||
padding_bytes = p_alignment - (byte_offset % p_alignment);
|
||||
byte_offset += padding_bytes;
|
||||
}
|
||||
state_buffer.resize(byte_offset + input_data_size);
|
||||
if (padding_bytes > 0) {
|
||||
memset(state_buffer.ptrw() + (byte_offset - padding_bytes), 0, padding_bytes);
|
||||
}
|
||||
uint8_t *buffer_ptr = state_buffer.ptrw();
|
||||
memcpy(buffer_ptr + byte_offset, p_input_data.ptr(), input_data_size);
|
||||
state_buffers.set(p_buffer_index, state_buffer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue