Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc
| Show First 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | Mesh *create_cuboid_mesh(const float3 size, | ||||
| const int verts_z) | const int verts_z) | ||||
| { | { | ||||
| const CuboidConfig config(size, verts_x, verts_y, verts_z); | const CuboidConfig config(size, verts_x, verts_y, verts_z); | ||||
| Mesh *mesh = BKE_mesh_new_nomain( | Mesh *mesh = BKE_mesh_new_nomain( | ||||
| config.vertex_count, 0, 0, config.loop_count, config.poly_count); | config.vertex_count, 0, 0, config.loop_count, config.poly_count); | ||||
| BKE_id_material_eval_ensure_default_slot(&mesh->id); | BKE_id_material_eval_ensure_default_slot(&mesh->id); | ||||
| { | |||||
| SCOPED_TIMER(__func__); | |||||
| calculate_vertices(config, {mesh->mvert, mesh->totvert}); | calculate_vertices(config, {mesh->mvert, mesh->totvert}); | ||||
| calculate_polys(config, {mesh->mpoly, mesh->totpoly}, {mesh->mloop, mesh->totloop}); | calculate_polys(config, {mesh->mpoly, mesh->totpoly}, {mesh->mloop, mesh->totloop}); | ||||
| } | |||||
| static bool is_new = false; | |||||
| if (is_new) { | |||||
| SCOPED_TIMER("old"); | |||||
| BKE_mesh_calc_edges(mesh, false, false); | BKE_mesh_calc_edges(mesh, false, false); | ||||
| } | |||||
| else { | |||||
| SCOPED_TIMER("new"); | |||||
| BKE_mesh_calc_edges_from_polys(mesh); | |||||
| } | |||||
| // is_new = !is_new; | |||||
| BKE_mesh_normals_tag_dirty(mesh); | BKE_mesh_normals_tag_dirty(mesh); | ||||
| calculate_uvs(config, mesh); | calculate_uvs(config, mesh); | ||||
| return mesh; | return mesh; | ||||
| } | } | ||||
| static Mesh *create_cube_mesh(const float3 size, | static Mesh *create_cube_mesh(const float3 size, | ||||
| ▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines | |||||