Commit Graph

11 Commits

Author SHA1 Message Date
Hans Goudey 3ce8c74a57 Cleanup: Fix outdated comments about Mesh data 2024-03-23 11:47:07 -04:00
Jacques Lucke 0494605e7e Geometry Nodes: support group ids in Geometry Proximity node
This is the same 75e9056cac but for the Geometry Proximity node.

Pull Request: https://projects.blender.org/blender/blender/pulls/118467
2024-02-20 17:15:23 +01:00
Jacques Lucke 75e9056cac Geometry Nodes: support group ids in Sample Nearest Surface node
This adds group ids to the `Sample Nearest Surface` node. This allows e.g. finding
the closest point on a specific mesh island.

Three new sockets are added:
* `Group ID`: Is evaluated on the face domain and splits the input mesh into  multiple
  parts, each with its own id.
* `Sample Group ID`: Determines in which group the closest nearest surface is detected.
* `Is Valid`: Outputs true if a nearest surface was found, it's false if the group is empty.

Pull Request: https://projects.blender.org/blender/blender/pulls/118150
2024-02-15 20:35:02 +01:00
Germano Cavalcante 1c77779160 Refactor: Store a 'Mesh' in the editmesh snap cache and use it for snapping
In this commit, a temporary mesh is created representing the edit mesh.
This mesh is then used in the Edit Mesh snapping system instead of the
BMesh.

By using a Mesh object for snapping, we remove a considerable amount of
code and use a more optimized version of snapping.

This simplifies the code and makes it easier to implement new features.

## Performance test: Face + Edge + Vert
|        | Cache     | Gen. Snap |
|--------|-----------|-----------|
| Before | 680.88 ms | 0.1250 ms |
| After  | 489.06 ms | 0.1064 ms |
| Improv | 28.65%    | 14.88%    |

## Performance test: Face
|        | Cache     | Gen. Snap |
|--------|-----------|-----------|
| Before | 293.90 ms | 0.0230 ms |
| After  | 411.92 ms | 0.0256 ms |
| Improv | -40.15%   | -11.30%   |

Pull Request: https://projects.blender.org/blender/blender/pulls/117047
2024-02-12 18:59:13 +01:00
Hans Goudey e9b8460ebe Cleanup: Use blender::int2 instead of vec2i 2024-02-12 10:45:02 -05:00
Hans Goudey 7c69c8827b Mesh: Rename MLoopTri variable names, and functions
Make the naming consistent with the recent change from "loop" to
"corner". Avoid the need for a special type for these triangles by
conveying the semantics in the naming instead.

- `looptris` -> `corner_tris`
- `lt` -> `tri` (or `corner_tri` when there is less context)
- `looptri_index` -> `tri_index` (or `corner_tri_index`)
- `lt->tri[0]` -> `tri[0]`
- `Span<MLoopTri>` -> `Span<int3>`
- `looptri_faces` -> `tri_faces` (or `corner_tri_faces`)

If we followed the naming pattern of "corner_verts" and "edge_verts"
exactly, we'd probably use "tri_corners" instead. But that sounds much
worse and less intuitive to me.

I've found that by using standard vector types for this sort of data,
the commonalities with other areas become much clearer, and code ends
up being naturally more data oriented. Besides that, the consistency
is nice, and we get to mostly remove use of `DNA_meshdata_types.h`.

Pull Request: https://projects.blender.org/blender/blender/pulls/116238
2023-12-19 14:57:49 +01:00
Campbell Barton 0d9acf84c6 Cleanup: match argument naming for headers/source 2023-12-14 12:51:18 +11:00
Campbell Barton 944e0483a6 Cleanup: clarify naming for MLoopTri
The term `looptri` was used ambiguously for both single & arrays.
The term `tri` was also used, causing `tri->tri`.

Use terms:

- `looptris` for an array or when dealing with multiple items.
- `looptri` is used when dealing with a single item.
- `lt` for a single MLoopTri variables & arguments.

This was already a convention but not followed closely.
2023-12-14 12:32:11 +11:00
Hans Goudey aca27e5462 Cleanup: Store BVH and shrinkwrap data with C++ types 2023-11-28 16:40:43 -05:00
Hans Goudey f27aee857b Cleanup: Remove unnecessary keywords from newly C++ headers 2023-11-16 12:00:26 +01:00
Hans Goudey 3d57bc4397 Cleanup: Move several blenkernel headers to C++
Mostly focus on areas where we're already using C++ features,
where combining C and C++ APIs is getting in the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/114972
2023-11-16 11:41:55 +01:00