diff options
author | clayjohn <claynjohn@gmail.com> | 2022-05-25 13:19:45 -0700 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2022-05-25 15:46:24 -0700 |
commit | fb860265e0f0c93166f87fecb4c0fb4a7965d45d (patch) | |
tree | efeebb12293f6a5f08f9f9823e03bd1cc5a66e56 /drivers/gles3/storage/mesh_storage.cpp | |
parent | 3e20c1347db323438a76693bb9f7eea87f3a305d (diff) |
Implement 2D Meshes and MultiMeshes in GLES3 backend
Diffstat (limited to 'drivers/gles3/storage/mesh_storage.cpp')
-rw-r--r-- | drivers/gles3/storage/mesh_storage.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp index 3be1792868..822be25337 100644 --- a/drivers/gles3/storage/mesh_storage.cpp +++ b/drivers/gles3/storage/mesh_storage.cpp @@ -722,6 +722,18 @@ void MeshStorage::_mesh_surface_generate_version_for_input_mask(Mesh::Surface::V for (int i = 0; i < RS::ARRAY_INDEX; i++) { if (!attribs[i].enabled) { + glDisableVertexAttribArray(i); + if (s->format & RS::ARRAY_FLAG_USE_2D_VERTICES) { + if (i == RS::ARRAY_COLOR) { + glVertexAttrib4f(i, 1, 1, 1, 1); + } else if (i == RS::ARRAY_TEX_UV) { + glVertexAttrib2f(i, 1, 1); + } else if (i == RS::ARRAY_BONES) { + glVertexAttrib4f(i, 1, 1, 1, 1); + } else if (i == RS::ARRAY_WEIGHTS) { + glVertexAttrib4f(i, 1, 1, 1, 1); + } + } continue; } if (i <= RS::ARRAY_TANGENT) { @@ -941,7 +953,6 @@ void MeshStorage::multimesh_allocate_data(RID p_multimesh, int p_instances, RS:: multimesh->stride_cache = multimesh->custom_data_offset_cache + (p_use_custom_data ? 4 : 0); multimesh->buffer_set = false; - //print_line("allocate, elements: " + itos(p_instances) + " 2D: " + itos(p_transform_format == RS::MULTIMESH_TRANSFORM_2D) + " colors " + itos(multimesh->uses_colors) + " data " + itos(multimesh->uses_custom_data) + " stride " + itos(multimesh->stride_cache) + " total size " + itos(multimesh->stride_cache * multimesh->instances)); multimesh->data_cache = Vector<float>(); multimesh->aabb = AABB(); multimesh->aabb_dirty = false; |