Mesh: Replace auto smooth with node group #108014

Merged
Hans Goudey merged 149 commits from HooglyBoogly/blender:refactor-mesh-corner-normals-lazy into main 2023-10-20 16:54:20 +02:00
3 changed files with 5 additions and 10 deletions
Showing only changes of commit 7a9a4b98d3 - Show all commits

View File

@ -332,11 +332,8 @@ static Mesh *mesh_wrapper_ensure_subdivision(Mesh *me)
if (use_clnors) {
/* If custom normals are present and the option is turned on calculate the split
* normals and clear flag so the normals get interpolated to the result mesh. */
blender::MutableSpan<float3> data(static_cast<float3 *>(CustomData_add_layer(
&me->ldata, CD_NORMAL, CD_CONSTRUCT, me->totloop)),
me->totloop);
data.copy_from(me->corner_normals());
CustomData_clear_layer_flag(&me->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
void *data = CustomData_add_layer(&me->ldata, CD_NORMAL, CD_CONSTRUCT, me->totloop);
memcpy(data, me->corner_normals().data(), me->corner_normals().size_in_bytes());
}
Mesh *subdiv_mesh = BKE_subdiv_to_mesh(subdiv, &mesh_settings, me);

View File

@ -261,11 +261,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
}
const bool use_clnors = BKE_subsurf_modifier_use_custom_loop_normals(smd, mesh);
if (use_clnors) {
blender::MutableSpan<blender::float3> data(
static_cast<blender::float3 *>(
CustomData_add_layer(&mesh->ldata, CD_NORMAL, CD_CONSTRUCT, mesh->totloop)),
mesh->totloop);
data.copy_from(mesh->corner_normals());
void *data = CustomData_add_layer(&mesh->ldata, CD_NORMAL, CD_CONSTRUCT, mesh->totloop);
memcpy(data, mesh->corner_normals().data(), mesh->corner_normals().size_in_bytes());
}
/* TODO(sergey): Decide whether we ever want to use CCG for subsurf,
* maybe when it is a last modifier in the stack? */

View File

@ -53,6 +53,7 @@ static Mesh *triangulate_mesh(Mesh *mesh,
if (keep_clnors) {
void *data = CustomData_add_layer(&mesh->ldata, CD_NORMAL, CD_CONSTRUCT, mesh->totloop);
memcpy(data, mesh->corner_normals().data(), mesh->corner_normals().size_in_bytes());
cd_mask_extra.lmask |= CD_MASK_NORMAL;
}
BMeshCreateParams bmesh_create_params{};