MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / commit

Method commit

scene/resources/surface_tool.cpp:720–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

718}
719
720Ref<ArrayMesh> SurfaceTool::commit(const Ref<ArrayMesh> &p_existing, uint64_t p_compress_flags) {
721 Ref<ArrayMesh> mesh;
722 if (p_existing.is_valid()) {
723 mesh = p_existing;
724 } else {
725 mesh.instantiate();
726 }
727
728 int varr_len = vertex_array.size();
729
730 if (varr_len == 0) {
731 return mesh;
732 }
733
734 int surface = mesh->get_surface_count();
735
736 Array a = commit_to_arrays();
737
738 uint64_t compress_flags = (p_compress_flags >> RS::ARRAY_COMPRESS_FLAGS_BASE) << RS::ARRAY_COMPRESS_FLAGS_BASE;
739 static const uint64_t shift[RS::ARRAY_CUSTOM_COUNT] = { Mesh::ARRAY_FORMAT_CUSTOM0_SHIFT, Mesh::ARRAY_FORMAT_CUSTOM1_SHIFT, Mesh::ARRAY_FORMAT_CUSTOM2_SHIFT, Mesh::ARRAY_FORMAT_CUSTOM3_SHIFT };
740 for (int i = 0; i < RS::ARRAY_CUSTOM_COUNT; i++) {
741 if (last_custom_format[i] != CUSTOM_MAX) {
742 compress_flags |= uint64_t(last_custom_format[i]) << shift[i];
743 }
744 }
745
746 mesh->add_surface_from_arrays(primitive, a, Array(), Dictionary(), compress_flags);
747
748 if (material.is_valid()) {
749 mesh->surface_set_material(surface, material);
750 }
751
752 return mesh;
753}
754
755void SurfaceTool::index() {
756 if (index_array.size()) {

Callers 3

_setupMethod · 0.45
regen_normal_mapsMethod · 0.45

Calls 8

sizeMethod · 0.65
ArrayClass · 0.50
DictionaryClass · 0.50
is_validMethod · 0.45
instantiateMethod · 0.45
get_surface_countMethod · 0.45
surface_set_materialMethod · 0.45

Tested by

no test coverage detected