Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
| Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | static Mesh *create_grid_mesh(const int verts_x, const int verts_y, const float size) | ||||
| const int y_edges_start = 0; | const int y_edges_start = 0; | ||||
| int edge_index = 0; | int edge_index = 0; | ||||
| for (const int x : IndexRange(verts_x)) { | for (const int x : IndexRange(verts_x)) { | ||||
| for (const int y : IndexRange(edges_y)) { | for (const int y : IndexRange(edges_y)) { | ||||
| const int vert_index = x * verts_y + y; | const int vert_index = x * verts_y + y; | ||||
| MEdge &edge = edges[edge_index++]; | MEdge &edge = edges[edge_index++]; | ||||
| edge.v1 = vert_index; | edge.v1 = vert_index; | ||||
| edge.v2 = vert_index + 1; | edge.v2 = vert_index + 1; | ||||
| edge.flag = ME_EDGEDRAW | ME_EDGERENDER; | |||||
| } | } | ||||
| } | } | ||||
| /* Build the vertical edges in the Y direction. */ | /* Build the vertical edges in the Y direction. */ | ||||
| const int x_edges_start = edge_index; | const int x_edges_start = edge_index; | ||||
| for (const int y : IndexRange(verts_y)) { | for (const int y : IndexRange(verts_y)) { | ||||
| for (const int x : IndexRange(edges_x)) { | for (const int x : IndexRange(edges_x)) { | ||||
| const int vert_index = x * verts_y + y; | const int vert_index = x * verts_y + y; | ||||
| MEdge &edge = edges[edge_index++]; | MEdge &edge = edges[edge_index++]; | ||||
| edge.v1 = vert_index; | edge.v1 = vert_index; | ||||
| edge.v2 = vert_index + verts_y; | edge.v2 = vert_index + verts_y; | ||||
| edge.flag = ME_EDGEDRAW | ME_EDGERENDER; | |||||
| } | } | ||||
| } | } | ||||
| int loop_index = 0; | int loop_index = 0; | ||||
| int poly_index = 0; | int poly_index = 0; | ||||
| for (const int x : IndexRange(edges_x)) { | for (const int x : IndexRange(edges_x)) { | ||||
| for (const int y : IndexRange(edges_y)) { | for (const int y : IndexRange(edges_y)) { | ||||
| MPoly &poly = polys[poly_index++]; | MPoly &poly = polys[poly_index++]; | ||||
| ▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines | |||||