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 0 additions and 36 deletions
Showing only changes of commit 7dadb241f3 - Show all commits

View File

@ -45,7 +45,6 @@ struct SubsurfRuntimeData {
bool has_gpu_subdiv;
int resolution;
bool use_optimal_display;
bool calc_loop_normals;
bool use_loop_normals;
/* Cached from the draw code for stats display. */

View File

@ -447,37 +447,6 @@ static void add_orco_mesh(
}
}
static void mesh_calc_modifier_final_normals(const bool sculpt_dyntopo, Mesh *mesh_final)
{
using namespace blender::bke;
const MeshNormalDomain domain = mesh_final->normals_domain();
/* Needed as `final_datamask` is not preserved outside modifier stack evaluation. */
SubsurfRuntimeData *subsurf_runtime_data = mesh_final->runtime->subsurf_runtime_data;
if (subsurf_runtime_data) {
subsurf_runtime_data->calc_loop_normals = domain == MeshNormalDomain::Corner;
}
if (domain == MeshNormalDomain::Corner) {
/* Compute loop normals (NOTE: will compute face and vert normals as well, if needed!). In case
* of deferred CPU subdivision, this will be computed when the wrapper is generated. */
if (!subsurf_runtime_data || subsurf_runtime_data->resolution == 0) {
mesh_final->corner_normals();
}
}
else {
if (sculpt_dyntopo == false) {
/* Eager normal calculation can potentially be faster than deferring to drawing code. */
if (domain == MeshNormalDomain::Face) {
mesh_final->face_normals();
}
else if (domain == MeshNormalDomain::Point) {
mesh_final->vert_normals();
}
}
}
}
/* Does final touches to the final evaluated mesh, making sure it is perfectly usable.
*
* This is needed because certain information is not passed along intermediate meshes allocated
@ -987,7 +956,6 @@ static void mesh_calc_modifiers(Depsgraph *depsgraph,
/* Compute normals. */
if (is_own_mesh) {
mesh_calc_modifier_final_normals(sculpt_dyntopo, mesh_final);
mesh_calc_finalize(mesh_input, mesh_final);
}
else {
@ -999,7 +967,6 @@ static void mesh_calc_modifiers(Depsgraph *depsgraph,
* Isolate since computing normals is multithreaded and we are holding a lock. */
blender::threading::isolate_task([&] {
mesh_final = BKE_mesh_copy_for_eval(mesh_input);
mesh_calc_modifier_final_normals(sculpt_dyntopo, mesh_final);
mesh_calc_finalize(mesh_input, mesh_final);
runtime->mesh_eval = mesh_final;
});
@ -1062,7 +1029,6 @@ static void editbmesh_calc_modifier_final_normals(Mesh *mesh_final)
switch (mesh_final->runtime->wrapper_type) {
case ME_WRAPPER_TYPE_SUBD:
case ME_WRAPPER_TYPE_MDATA:
mesh_calc_modifier_final_normals(false, mesh_final);
break;
case ME_WRAPPER_TYPE_BMESH: {
BMEditMesh *em = mesh_final->edit_mesh;

View File

@ -205,7 +205,6 @@ static void subdiv_cache_mesh_wrapper_settings(const ModifierEvalContext *ctx,
runtime_data->has_gpu_subdiv = true;
runtime_data->resolution = mesh_settings.resolution;
runtime_data->use_optimal_display = mesh_settings.use_optimal_display;
runtime_data->calc_loop_normals = false; /* Set at the end of modifier stack evaluation. */
runtime_data->use_loop_normals = (smd->flags & eSubsurfModifierFlag_UseCustomNormals);
mesh->runtime->subsurf_runtime_data = runtime_data;