Geometry Nodes: Simulation Zone drawing updates #107043

Closed
Dalai Felinto wants to merge 5 commits from geometry-nodes-simulation-background into geometry-nodes-simulation

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 18 additions and 2 deletions
Showing only changes of commit 6b9deddbe9 - Show all commits

View File

@ -3122,6 +3122,7 @@ static void find_bounds_by_zone_recursive(const SpaceNode &snode,
}
static void node_draw_zones(TreeDrawContext & /*tree_draw_ctx*/,
const ARegion &region,
const SpaceNode &snode,
const bNodeTree &ntree)
{
@ -3162,8 +3163,9 @@ static void node_draw_zones(TreeDrawContext & /*tree_draw_ctx*/,
const uint pos = GPU_vertformat_attr_add(
immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
/* Draw the background. */
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
float zone_color[4];

What about using immUniformColor4fv here so TH_NODE_ZONE_SIMULATION doesn't have to be passed twice? I'd think that would give the same result.

What about using `immUniformColor4fv` here so `TH_NODE_ZONE_SIMULATION` doesn't have to be passed twice? I'd think that would give the same result.
UI_GetThemeColor4fv(TH_NODE_ZONE_SIMULATION, zone_color);
immUniformThemeColorBlend(TH_BACK, TH_NODE_ZONE_SIMULATION, zone_color[3]);
@ -3174,6 +3176,20 @@ static void node_draw_zones(TreeDrawContext & /*tree_draw_ctx*/,
}
immVertex3fv(pos, fillet_boundary_positions[0]);
immEnd();
/* Draw the countour lines. */
immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
float scale;
const View2D &v2d = region.v2d;
UI_view2d_scale_get(&v2d, &scale, nullptr);
float line_width = 1.0f * scale;
float viewport[4] = {};
GPU_viewport_size_get_f(viewport);
immUniform2fv("viewportSize", &viewport[2]);
immUniform1f("lineWidth", line_width * U.pixelsize);
immUniformThemeColorAlpha(TH_NODE_ZONE_SIMULATION, 1.0f);
immBegin(GPU_PRIM_LINE_STRIP, fillet_boundary_positions.size() + 1);
for (const float3 &p : fillet_boundary_positions) {
@ -3353,7 +3369,7 @@ static void draw_nodetree(const bContext &C,
}
node_update_nodetree(C, tree_draw_ctx, ntree, nodes, blocks);
node_draw_zones(tree_draw_ctx, *snode, ntree);
node_draw_zones(tree_draw_ctx, region, *snode, ntree);
node_draw_nodetree(C, tree_draw_ctx, region, *snode, ntree, nodes, blocks, parent_key);
}