mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-11-21 16:37:20 +01:00
Optimize Editor _init_grid()
Use static `LocalVectors` instead of `PoolVectors` for temporaries.
This commit is contained in:
parent
d249ee0624
commit
84864fbe35
@ -6337,9 +6337,15 @@ void SpatialEditor::_init_grid() {
|
||||
|
||||
bool orthogonal = camera->get_projection() == Camera::PROJECTION_ORTHOGONAL;
|
||||
|
||||
PoolVector<Color> grid_colors[3];
|
||||
PoolVector<Vector3> grid_points[3];
|
||||
PoolVector<Vector3> grid_normals[3];
|
||||
static LocalVector<Color> grid_colors[3];
|
||||
static LocalVector<Vector3> grid_points[3];
|
||||
static LocalVector<Vector3> grid_normals[3];
|
||||
|
||||
for (uint32_t n = 0; n < 3; n++) {
|
||||
grid_colors[n].clear();
|
||||
grid_points[n].clear();
|
||||
grid_normals[n].clear();
|
||||
}
|
||||
|
||||
Color primary_grid_color = EditorSettings::get_singleton()->get("editors/3d/primary_grid_color");
|
||||
Color secondary_grid_color = EditorSettings::get_singleton()->get("editors/3d/secondary_grid_color");
|
||||
@ -6465,9 +6471,9 @@ void SpatialEditor::_init_grid() {
|
||||
grid[c] = RID_PRIME(RenderingServer::get_singleton()->mesh_create());
|
||||
Array d;
|
||||
d.resize(RS::ARRAY_MAX);
|
||||
d[RenderingServer::ARRAY_VERTEX] = grid_points[c];
|
||||
d[RenderingServer::ARRAY_COLOR] = grid_colors[c];
|
||||
d[RenderingServer::ARRAY_NORMAL] = grid_normals[c];
|
||||
d[RenderingServer::ARRAY_VERTEX] = (PoolVector<Vector3>)grid_points[c];
|
||||
d[RenderingServer::ARRAY_COLOR] = (PoolVector<Color>)grid_colors[c];
|
||||
d[RenderingServer::ARRAY_NORMAL] = (PoolVector<Vector3>)grid_normals[c];
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(grid[c], RenderingServer::PRIMITIVE_LINES, d);
|
||||
RenderingServer::get_singleton()->mesh_surface_set_material(grid[c], 0, grid_mat[c]->get_rid());
|
||||
grid_instance[c] = RenderingServer::get_singleton()->instance_create2(grid[c], get_tree()->get_root()->get_world_3d()->get_scenario());
|
||||
|
Loading…
Reference in New Issue
Block a user