Avoid making unnecessary copies of `LocalVector`
This commit is contained in:
parent
8c729f0f34
commit
1324c7d06a
|
@ -658,7 +658,7 @@ private:
|
|||
|
||||
Vector3 get_gd_normal(Face *p_face);
|
||||
|
||||
bool shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> p_stack);
|
||||
bool shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> &p_stack);
|
||||
|
||||
public:
|
||||
~ConvexHullInternal() {
|
||||
|
@ -1775,7 +1775,7 @@ real_t ConvexHullInternal::shrink(real_t p_amount, real_t p_clamp_amount) {
|
|||
return p_amount;
|
||||
}
|
||||
|
||||
bool ConvexHullInternal::shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> p_stack) {
|
||||
bool ConvexHullInternal::shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> &p_stack) {
|
||||
Vector3 orig_shift = get_gd_normal(p_face) * -p_amount;
|
||||
if (scaling[0] != 0) {
|
||||
orig_shift[0] /= scaling[0];
|
||||
|
|
|
@ -361,8 +361,7 @@ bool VisualShaderGraphPlugin::is_node_has_parameter_instances_relatively(VisualS
|
|||
}
|
||||
}
|
||||
|
||||
LocalVector<int> prev_connected_nodes;
|
||||
visual_shader->get_prev_connected_nodes(p_type, p_node, prev_connected_nodes);
|
||||
const LocalVector<int> &prev_connected_nodes = visual_shader->get_prev_connected_nodes(p_type, p_node);
|
||||
|
||||
for (const int &E : prev_connected_nodes) {
|
||||
result = is_node_has_parameter_instances_relatively(p_type, E);
|
||||
|
@ -5012,8 +5011,7 @@ void VisualShaderEditor::_update_next_previews(int p_node_id) {
|
|||
}
|
||||
|
||||
void VisualShaderEditor::_get_next_nodes_recursively(VisualShader::Type p_type, int p_node_id, LocalVector<int> &r_nodes) const {
|
||||
LocalVector<int> next_connections;
|
||||
visual_shader->get_next_connected_nodes(p_type, p_node_id, next_connections);
|
||||
const LocalVector<int> &next_connections = visual_shader->get_next_connected_nodes(p_type, p_node_id);
|
||||
|
||||
for (int node_id : next_connections) {
|
||||
r_nodes.push_back(node_id);
|
||||
|
|
|
@ -234,7 +234,7 @@ TypedArray<RID> GodotNavigationServer::map_get_links(RID p_map) const {
|
|||
const NavMap *map = map_owner.get_or_null(p_map);
|
||||
ERR_FAIL_COND_V(map == nullptr, link_rids);
|
||||
|
||||
const LocalVector<NavLink *> links = map->get_links();
|
||||
const LocalVector<NavLink *> &links = map->get_links();
|
||||
link_rids.resize(links.size());
|
||||
|
||||
for (uint32_t i = 0; i < links.size(); i++) {
|
||||
|
@ -248,7 +248,7 @@ TypedArray<RID> GodotNavigationServer::map_get_regions(RID p_map) const {
|
|||
const NavMap *map = map_owner.get_or_null(p_map);
|
||||
ERR_FAIL_COND_V(map == nullptr, regions_rids);
|
||||
|
||||
const LocalVector<NavRegion *> regions = map->get_regions();
|
||||
const LocalVector<NavRegion *> ®ions = map->get_regions();
|
||||
regions_rids.resize(regions.size());
|
||||
|
||||
for (uint32_t i = 0; i < regions.size(); i++) {
|
||||
|
@ -262,7 +262,7 @@ TypedArray<RID> GodotNavigationServer::map_get_agents(RID p_map) const {
|
|||
const NavMap *map = map_owner.get_or_null(p_map);
|
||||
ERR_FAIL_COND_V(map == nullptr, agents_rids);
|
||||
|
||||
const LocalVector<NavAgent *> agents = map->get_agents();
|
||||
const LocalVector<NavAgent *> &agents = map->get_agents();
|
||||
agents_rids.resize(agents.size());
|
||||
|
||||
for (uint32_t i = 0; i < agents.size(); i++) {
|
||||
|
|
|
@ -620,9 +620,7 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, float p_normal_spli
|
|||
}
|
||||
|
||||
if (!found) {
|
||||
LocalVector<int> new_group;
|
||||
new_group.push_back(corner_idx);
|
||||
normal_group_indices.push_back(new_group);
|
||||
normal_group_indices.push_back({ corner_idx });
|
||||
normal_group_averages.push_back(ray_normal);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,11 +203,11 @@ public: // internal methods
|
|||
_FORCE_INLINE_ Ref<VisualShaderNode> get_node_unchecked(Type p_type, int p_id) const {
|
||||
return graph[p_type].nodes[p_id].node;
|
||||
}
|
||||
_FORCE_INLINE_ void get_next_connected_nodes(Type p_type, int p_id, LocalVector<int> &r_list) const {
|
||||
r_list = graph[p_type].nodes[p_id].next_connected_nodes;
|
||||
_FORCE_INLINE_ const LocalVector<int> &get_next_connected_nodes(Type p_type, int p_id) const {
|
||||
return graph[p_type].nodes[p_id].next_connected_nodes;
|
||||
}
|
||||
_FORCE_INLINE_ void get_prev_connected_nodes(Type p_type, int p_id, LocalVector<int> &r_list) const {
|
||||
r_list = graph[p_type].nodes[p_id].prev_connected_nodes;
|
||||
_FORCE_INLINE_ const LocalVector<int> &get_prev_connected_nodes(Type p_type, int p_id) const {
|
||||
return graph[p_type].nodes[p_id].prev_connected_nodes;
|
||||
}
|
||||
|
||||
Vector<int> get_node_list(Type p_type) const;
|
||||
|
|
Loading…
Reference in New Issue