Subdiv: Set edge render flags according to Optimal Display
This is a part of T58609, but work is still needed to properly support this flag in the draw manager.
This commit is contained in:
parent
bb16167fd8
commit
17a4323ef5
|
@ -45,6 +45,8 @@ typedef struct SubdivToMeshSettings {
|
|||
* `resolution - 1`.
|
||||
*/
|
||||
int resolution;
|
||||
/* When true, only edges emitted from coarse ones will be displayed. */
|
||||
bool use_optimal_display;
|
||||
} SubdivToMeshSettings;
|
||||
|
||||
/* Create real hi-res mesh from subdivision, all geometry is "real". */
|
||||
|
|
|
@ -64,4 +64,6 @@ void BKE_multires_subdiv_mesh_settings_init(
|
|||
const int level = multires_get_level(
|
||||
scene, object, mmd, use_render_params, ignore_simplify);
|
||||
mesh_settings->resolution = (1 << level) + 1;
|
||||
mesh_settings->use_optimal_display =
|
||||
(mmd->flags & eMultiresModifierFlag_ControlEdges);
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
*/
|
||||
|
||||
typedef struct SubdivMeshContext {
|
||||
const SubdivToMeshSettings *settings;
|
||||
const Mesh *coarse_mesh;
|
||||
Subdiv *subdiv;
|
||||
Mesh *subdiv_mesh;
|
||||
|
@ -766,6 +767,9 @@ static void subdiv_copy_edge_data(
|
|||
subdiv_edge->crease = 0;
|
||||
subdiv_edge->bweight = 0;
|
||||
subdiv_edge->flag = 0;
|
||||
if (!ctx->settings->use_optimal_display) {
|
||||
subdiv_edge->flag |= ME_EDGERENDER;
|
||||
}
|
||||
if (ctx->edge_origindex != NULL) {
|
||||
ctx->edge_origindex[subdiv_edge_index] = ORIGINDEX_NONE;
|
||||
}
|
||||
|
@ -777,6 +781,7 @@ static void subdiv_copy_edge_data(
|
|||
coarse_edge_index,
|
||||
subdiv_edge_index,
|
||||
1);
|
||||
subdiv_edge->flag |= ME_EDGERENDER;
|
||||
}
|
||||
|
||||
static void subdiv_mesh_edge(
|
||||
|
@ -1123,6 +1128,7 @@ Mesh *BKE_subdiv_to_mesh(
|
|||
}
|
||||
/* Initialize subdivion mesh creation context/ */
|
||||
SubdivMeshContext subdiv_context = {0};
|
||||
subdiv_context.settings = settings;
|
||||
subdiv_context.coarse_mesh = coarse_mesh;
|
||||
subdiv_context.subdiv = subdiv;
|
||||
/* Multi-threaded traversal/evaluation. */
|
||||
|
|
|
@ -130,6 +130,8 @@ static void subdiv_mesh_settings_init(SubdivToMeshSettings *settings,
|
|||
{
|
||||
const int level = subdiv_levels_for_modifier_get(smd, ctx);
|
||||
settings->resolution = (1 << level) + 1;
|
||||
settings->use_optimal_display =
|
||||
(smd->flags & eSubsurfModifierFlag_ControlEdges);
|
||||
}
|
||||
|
||||
static Mesh *subdiv_as_mesh(SubsurfModifierData *smd,
|
||||
|
|
Loading…
Reference in New Issue