Commit Graph

132 Commits

Author SHA1 Message Date
6fe983ddf5 Fix #34413 Dyntopo, smooth shading normals not getting uploaded to GPU
and undo buffers.

When we have smooth shading we must not only update the unique vertex
normals.
2013-08-18 19:47:33 +00:00
754b4ab3bc add hash function BLI_ghash_assign, BLI_edgehash_assign
avoids remove,insert and only hashes the key once.
2013-08-18 03:41:39 +00:00
5fafc222f0 style cleanup 2013-08-17 08:21:40 +00:00
2d2f5f59d7 dyn-topo: maintain materials for new faces.
also minor optimization for BM_edge_in_face(), check edges radial loops rather then the faces edges
since normally there are 0-2 faces attached to an edge compared to 3+ edges in a face.
2013-07-24 19:58:16 +00:00
cd6b27f2b5 remove return value from MEM_freeN, it wasn't used anywhere and was cast to a different function signature. (which evidently works but error prone). 2013-05-21 07:37:59 +00:00
61dafba0bc fix for mistake in r56903 2013-05-19 08:46:17 +00:00
fa043d208b Optimizations for dyntopo
- creating faces was unnecessarily checking if they already existed.
- deleting a face did edge-lookups, when the edges are already available from the face-loops.
2013-05-18 19:18:55 +00:00
655ed9cc7f style cleanup 2013-03-18 11:44:56 +00:00
0d0291f6e1 code cleanup: incorrect sized array args, remove some redundant code. 2013-03-17 10:26:23 +00:00
0fedc6e45b Stop dyntopo updates from happening in masked areas
Fixes [#34348] Collapse short edges affects masked geometry
/projects.blender.org/tracker/?func=detail&aid=34348&group_id=9&atid=498

Fixed by disallowing topology updates on edges with a vertex masked at
50% or greater. This is a necessarily arbitrary choice; can't do
halfway updates for topology like we can with displacement.
2013-03-16 18:22:45 +00:00
7485724160 style cleanup: whitespace 2013-03-10 05:19:29 +00:00
c36f20a7d2 style cleanup 2013-03-08 04:00:06 +00:00
0d5b028d43 patch [#34103] use boolean in path functions and add comments.
path_util_1.patch from Lawrence D'Oliveiro (ldo)
2013-03-04 19:27:51 +00:00
0ac07404ba style cleanup: braces with multi-line statements, also add some comments. 2013-03-01 14:47:06 +00:00
07beb61b1e Fix for collapse-edges crash in dyntopo
Was incorrectly testing for a vertex in a set with BLI_ghash_lookup
rather than BLI_ghash_haskey; the key in this case is always null so
the test failed.

This could leave the PBVH in an inconsistent state, since the
top-level map of BMesh vertices to PBVH nodes would indicate the
vertex was in a node, but that node wouldn't actually have any faces
using the vertex. That inconsistent state would eventually lead to a
crash in pbvh_bmesh_vert_remove().

Fixes
http://projects.blender.org/tracker/?func=detail&atid=498&aid=34370&group_id=9
2013-02-25 00:02:25 +00:00
518bfbb1c9 style cleanup 2013-02-02 04:58:03 +00:00
7e49a39acd Check for deletion before moving vert in dyntopo collapse edge
Fixes [#33964] Dyntopo crash with edge collapse + undo
projects.blender.org/tracker/?func=detail&aid=33964&group_id=9&atid=498
2013-01-26 17:19:21 +00:00
4ca7bad748 Delete loose edges left behind by sculpting with collapse-short-edges
After deleting a face, check for unused edges and delete them.

Fixes bug [#33891]
projects.blender.org/tracker/?func=detail&aid=33891&group_id=9&atid=498
2013-01-20 00:46:33 +00:00
9a50f45469 Skip hidden faces in PBVH BMesh ray intersection test
Moved the GPU function gpu_bmesh_face_visible() to BKE_paint and
inverted the test to match equivalent tests for other mesh types:
paint_is_bmesh_face_hidden().

Changed BKE_pbvh_bmesh_node_save_orig() to not save hidden faces into
the triangle array.

Modified the non-use-original branch of pbvh_bmesh_node_raycast() to
skip hidden faces.

Fixes bug #33914:
projects.blender.org/tracker/index.php?func=detail&aid=33914&group_id=9&atid=498
2013-01-19 16:10:21 +00:00
a8abc11e42 dyntopo optimization - fast path for edges with 2 faces using it, was counting the edge-faces then using an iterator,
instead use BM_edge_loop_pair()
2013-01-19 00:17:10 +00:00
93b58752d2 minor speedup for dyntopo edge queue - replace iterator with while loop. 2013-01-16 23:20:09 +00:00
d6c4d2a415 fix bug in dyntopo - check to remove pbvh vert was always false. 2013-01-16 23:12:43 +00:00
ba5e6380be code cleanup: rename BMVert *v[3]; --> 'v_tri', since 'v' is normally for single verts. 2013-01-16 23:10:32 +00:00
4585336285 speed-up dyn-topo by storing the edge-loops rather then edge-faces.
- no need for bm_triangle_other_vert_find(), the other vert is known relative to the loop.
- no need for bm_face_edge_backwards(), the verts are in order in the loop.
2013-01-16 22:56:08 +00:00
5ddc7d64a8 optimize bmesh operations that use triangle BMFace's (dyn-topo and mesh conversion). 2013-01-16 21:09:54 +00:00
b27854bd47 use booleans for bmesh api. 2013-01-14 16:42:43 +00:00
9190c493c1 extend BLI_buffer
- add option to calloc or not, existing code wasnt consistent here, would calloc on first alloc but not on realloc, also - the static memory was never zero'd.
  use flag BLI_BUFFER_USE_CALLOC to ensure all new memory is zero'd (static/alloc/realloc's).

- add BLI_buffer_declare_static / BLI_buffer_declare so its possible to have a buffer that never uses static memory.
2013-01-02 05:00:02 +00:00
c9d16fd22c add ".hh" as an extension for source scripts. 2012-12-31 07:06:51 +00:00
827f9aa737 rename BM_edge_calc_squared_length -> BM_edge_calc_length_squared, matching len_v3, len_squared_v3 2012-12-31 02:40:15 +00:00
1aebc0e790 style cleanup 2012-12-31 02:37:28 +00:00
22c02c9d3a Code cleanup: rename BLI_pbvh to BKE_pbvh 2012-12-30 18:31:31 +00:00
2e69b0cd0b Add dynamic topology support to the PBVH
* Add BLI_pbvh_build_bmesh(), similar to the other PBVH builders but
  specialized for BMesh. Whereas the PBVH leaf nodes for mesh and
  grids only store a start-index and count into the primitive indices
  array, the BMesh version uses GHashes to store the full set of faces
  and vertices in leaf nodes

* Update PBVH iterator to handle BMesh

* Make some of the pbvh.c functions non-static so they can be used by
  the new pbvh_bmesh code

* The BLI_pbvh_bmesh_update_topology() function is the main reason for
  adding BMesh support to the PBVH. This function is used during a
  sculpt stroke to dynamically collapse edges that are particular
  short and subdivide edges that are particularly long.
2012-12-30 18:28:36 +00:00