Commit Graph

142 Commits

Author SHA1 Message Date
4ca67869cc Code cleanup: remove unused includes
Opted to keep includes if they are used indirectly (even if removing is possible).
2014-05-01 04:47:51 +10:00
a2c107aef1 Code cleanup: use 'const' for arrays (blenkernel) 2014-04-27 00:25:15 +10:00
70fdcebb93 Fix T39781: Autosmooth feature: erroneously showing hidden vertices' normals too when in "vertex per face" display
So, turned out after all we need a foreachmapped helper for loops as well... :/

CDDM and EBDM were reasonably simple, but I fought hours with CCGDM (subsurf) to find only a
bad working solution (see D478). So I fallback to a code similar to CDDM one.
Probably not nice for performances, but loops and subsurf are not matching well...

Reviewers: campbellbarton

CC: brecht

Differential Revision: https://developer.blender.org/D478
2014-04-23 15:25:12 +02:00
dcd2a8fcc4 Fix stupid typo that broke split normal shading in edit mode, when there was some deform modifiers. 2014-04-20 23:12:18 +02:00
1c0b6c4f30 Code cleanup: use bools for DM 2014-04-17 20:03:39 +10:00
41b8f88732 Split Normals I (3/5): Add 3Dview shading support of split normals.
Mostly monkey coding in gpu ("modern" VBO drawing) and DM variants ("legacy" drawing) code...

Reviewers: brecht

Reviewed By: brecht

CC: campbellbarton

Differential Revision: https://developer.blender.org/D367
2014-04-13 12:34:45 +02:00
0b7f581397 Split Normals I (2/5): Add basic BMesh support of split normals.
* Merely a re-implementation of core split algorithm for BMesh, taking advantage of topological data available.
* This code needs valid loop indices, so added BM_LOOP support to BM_mesh_elem_index_ensure() & co.

Reviewers: campbellbarton

Reviewed By: campbellbarton

CC: brecht

Differential Revision: https://developer.blender.org/D366
2014-04-13 12:25:54 +02:00
18e4224142 Split Normals I (1/5): basis for split normals (nearly nothing user-visible here):
* Add a new calcLoopNormals function to DerivedMesh struct, and implement it for CDDM and CCGDM (subsurf).
  EditDerivedBMesh (edit mode DM) only gets a dummy one in this commit.
* Add a tessellated version of CD_LOOPNORMAL layer (CD_TESSLOOPNORMAL), with relevant code to handle it
  (tessellation, rna access, etc.).
* Change auto_smooth options of Mesh (angle now in radian internaly, and toggle is now used to enable/disable
  split normals in DM creation process). Note BI render code is not touched here, hence its behavior regarding
  this option is now incoherent, will be addressed in a separate commit.

Reviewers: campbellbarton

CC: brecht

Differential Revision: https://developer.blender.org/D365
2014-04-13 12:19:00 +02:00
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
62a0350957 Editmode drawing: avoid glBegin/End for every tri (emDM_drawMappedFacesMat,GLSL) 2014-03-25 20:36:11 +11:00
436d6ec2e9 Code cleanup: editmode opengl drawing 2014-03-25 20:36:11 +11:00
58c22d8fe8 Fix T39351: Blender crashes when enabling Mesh Analysis.
This code was using a //const// char array for fallback colors and then
writing to it (hidden to the compiler by explicit casting). Bad!
2014-03-23 11:37:04 +01:00
ec55074f89 Code cleanup: jitter, use 2d float array 2014-03-18 10:52:38 +11:00
e72775e34a Fix T38795: Mesh Analysis overhang faces show gray 2014-02-24 19:55:04 +11:00
70905a6e02 Fix Editderivedmeshes vertices normals computation.
Those derived meshes (used in Edit mode) were using simple sum of neighbor poly normals to get vertex normals,
while everywhere else in Blender we use weighted sum of such poly normals.

Patch: D311

Reviewed and enhanced by Campbell, thanks!
2014-02-12 20:48:09 +01:00
37026b12ec Code cleanup: use bool for static methods 2014-02-05 22:36:15 +11:00
238d2f962d BMesh Refactor: BKE_bmbvh_new can now be created without an EditMesh.
This adds BM_bmesh_calc_tessellation() so we can get triangles from a
bmesh without having to have an editmesh available.
2013-11-18 18:25:47 +11:00
beae4f498d code cleanup: spelling 2013-10-31 14:10:01 +00:00
3264461598 move bmesh array lookup data and utility functions from editmesh into bmesh,
since enough bmesh operations can also take advantage of direct index lookups on verts/edges/faces.

developers note:
- EDBM_index_arrays_init/ensure/free -> BM_mesh_elem_table_ensure/init/free
- EDBM_vert/edge/face_at_index -> BM_vert/edge/face_at_index
- EDBM_uv_element_map_create/free -> BM_uv_element_map_create/free
- ED_uv_element_get -> BM_uv_element_get
2013-10-28 02:05:33 +00:00
7c8c49a34a style cleanup 2013-10-21 23:35:08 +00:00
abee8a8717 Fix #37109: missing cycles texture display in edit mode.
My previous fix for uninitialized texture coordinates was not working well,
and in fact there was a bigger issue with GLSL drawing and missing attributes
with immediate draw mode. Now it will explicitly pass zero rather than having
it use whatever value was set last.
2013-10-17 14:04:10 +00:00
86f8470a5d Some knife fixes. Avoids duplicating verts; better handling of cut-through ortho.
Now cut lines detect vertices that they pass (almost) exactly over
and snap to them, to avoid making verts vert close to other ones.

Added radius arg to BKE_bmbvh_ray_cast so that can detect an obscuring
face when the ray might otherwise go exactly between two triangles.
Needed an isect_line_tri_epsilon function for similar reason.

Fixes last part of bug #35002. Other knife bugs still present but
getting this commit in now before continuing bug fixing.
2013-08-30 16:34:44 +00:00
00b39c4e5b code cleanup: more confusion with 0/NULL/false 2013-08-07 03:55:21 +00:00
7c58ec9337 use math functions for copying matrix/vector types, also cast const pointers for freeing (clang error's out otherwise) 2013-07-26 10:43:23 +00:00
a788cca141 correct own error in recent edits to editderivedmesh 2013-07-23 15:05:33 +00:00
04ea8c0ee8 remove the pointer from BLI_bitmap's typedef,
hides that an arg passed is really an array which may be modified by other functions.
2013-07-22 23:20:48 +00:00
b7bf20d950 optimization: only calculate the normals for passing into derivedMesh foreachMappedVert/foreachMappedFaceCenter when needed,
this means in editmode with wire draw, face and vertex normals don't have to be calculated at all.

in most cases the normals are not used so add a flag that makes calculating them only for functions that need them.
also fix face normal calculation for CDDM, was using quad calculation for ngons too.
2013-07-22 22:59:47 +00:00
e590abfb87 optimization:
- halve the number of allocs in layerInterp_mdeformvert list creation.
- use direct loop access in emDM_copyLoopArray
2013-07-22 18:01:27 +00:00
90fdaa8219 optimization: lazy initialize EditDerivedBMesh members vertexNos, polyNos.
also add polyCos array which cache's face centers, gives overall ~20% speedup to drawing on a high-poly mesh in face-editmode.
2013-07-22 16:49:37 +00:00
3daa153d74 code cleanup: use boolean for derived mesh face test function 2013-07-19 10:40:52 +00:00
c3c84521f1 fix [#36055] Edge/Face Info display on wrong position with key frames
display editmesh stats with deform modifiers.
2013-07-09 12:59:31 +00:00
e6830300b7 Fix incorrect GLSL bump mapping in editmode when the UV coordinates are
flipped, was not passing sign on to GLSL shader.
2013-07-01 14:49:08 +00:00
09e11ad6ef modifier stack: lazy initialize normals
many modifiers were calculating normals, when those normals were ignored by the next modifier.
now flag normals as dirty and recalculate for modifiers that set use `dependsOnNormals()` callback.

Quick test on mesh with 12 modifiers (mostly build type), calculated normals 6 times, now it only runs once - so this will give some speedup too.
2013-05-30 17:36:43 +00:00
083115c5e7 bmesh optimization: use offsets for deform-vert lookups to avoid customdata layer lookups within loops. 2013-05-27 12:42:48 +00:00
7a547e441b avoid customdata lookups for selection test/enable disable.
also add uvedit_face_select_set, uvedit_edge_select_set, uvedit_uv_select_set - since quite a few areas where setting based on a boolean.
2013-05-10 06:46:32 +00:00
34c28e3a0e fix [#35259] Crash when enabling mesh analysis intersect. 2013-05-08 12:40:23 +00:00
f2f113fbd3 tweak for epsilon of intersection check, was too small for some cases. 2013-04-28 22:35:08 +00:00
46b40e112b skip checks in statvis_calc_thickness(). also remove paranoid NULL checks in smallhash.c 2013-04-20 16:49:02 +00:00
106d41699a fix [#35025] Mesh Debug samples strange behavior 2013-04-20 16:29:37 +00:00
5502c74a1a fix for problem with too low epsilon when calculating thickness, also increase limits. 2013-04-18 17:23:02 +00:00
5c72a19c09 add display mode for sharp edges. 2013-04-18 17:09:56 +00:00
5f613886ef fix range for face distortion and display for concave ngons. 2013-04-18 09:12:06 +00:00
8a06acfd7a add mesh distort display mode (highlights distorted faces) 2013-04-18 04:24:18 +00:00
9cceec40c4 use modified vertex coords for calculating display thickness and intersections.
internal improvement to editmesh_bvh.c

- optionally pass cage-coords as an arg, rather then calculating the coords in BKE_bmbvh_new(),
  since all callers already have coords calculated.
- de-duplicate coords creation function from knife and bmbvhm, move into own generic function: BKE_editmesh_vertexCos_get()
2013-04-18 01:20:04 +00:00
4a7feafa49 Support object scale for mesh display options. (currently only uniform scale for thickness test) 2013-04-17 23:30:19 +00:00
14f9f167b2 display options to help with 3d printing.
editmesh debug info,
- overhang (with axis angle options)
- wall thickness (with min/max distance)
- self-intersections.

access below 'Mesh Display' panel.
2013-04-17 09:27:23 +00:00
37e73aa368 code cleanup: use BKE naming conventions for functions in BKE_editmesh.h and BKE_editmesh_bvh.h 2013-04-16 05:59:48 +00:00
77da6b3662 move editmesh functions out editderivedmesh.c into editmesh.c 2013-04-16 05:46:17 +00:00
81cfbaacb0 code cleanup: edit-derived-mesh, define 'BMesh *bm' as local variable, avoid 'bmdm->em->bm' within functions. 2013-04-13 20:58:49 +00:00
5996242291 fix for error in editmesh derived callbacks, emDM_getVert(), emDM_getEdge(), emDM_getTessFace().
Currently the functions aren't used since they would fail have failed immediately.
2013-04-13 20:40:34 +00:00