Commit Graph

95 Commits

Author SHA1 Message Date
e87c462890 Fix T38736: ShrinkWrap modifier doesn't work after Subsurf 2014-02-21 18:10:44 +11:00
c1c26c36f6 Style Cleanup: remove preprocessor indentation (updated wiki style guide too) 2013-12-22 14:12:19 +11:00
3073a5b1c4 Mark some CCG funcrions as inlined
This seems to be giving speedup up to 10% in own tests.

--
svn merge -r60104:60105 ^/branches/soc-2013-depsgraph_mt
2013-10-01 09:17:35 +00:00
1f091fd234 add missing gpl headers 2013-07-02 09:47:22 +00:00
225c5fee6b move BLO_sys_types.h -> BLI_sys_types.h (it had nothing todo with loading)
remove MEM_sys_types.h which was a duplicate.
2013-05-28 19:35:26 +00:00
0d488c5580 add subsurf limits, in RNA, there were none, but subsurf would assert at 29.
Checked and subsurf level 11 gives over 3 million faces from a single triangle. So use this as a limit.
2013-04-26 11:30:16 +00:00
93ac968db3 code cleanup: include order 2013-04-05 17:56:54 +00:00
69993c5d40 style cleanup: spaces -> tabs 2013-02-04 00:18:09 +00:00
f414d2980a code cleanup: remove some paranoid checks which would have crashed anyway earlier on.
Also some minor formatting.
2013-01-20 14:50:50 +00:00
9c003a36d6 patch from Harley Acheson to remove multiple inline defines. 2013-01-12 17:12:48 +00:00
f3ece5a108 style cleanup: trailing tabs & expand some non prefix tabs into spaces. 2012-10-21 05:46:41 +00:00
25c96bc9f3 code cleanup: remove unused macros, commet some which may be useful later - or good to keep for completeness. quieted some warnings and add flags -Wmissing-include-dirs and -Wno-div-by-zero to cmake/gcc 2012-09-20 01:02:39 +00:00
12425588f2 Fix simple subsurf on wire edges
Subsurf on wire edges gave smooth results even if set to simple
subdiv. Added a field to the CCG meshIFC to flag simple subdivision,
then when syncing vertices simply skip moving vertices if in
simple-subdiv mode.

This change affects two places, the level-1 build in sync and the
subdivision up to other levels.

Fixes bug [#32268] Simple Subsurf Modifier gives unexpected results on
edges without faces
projects.blender.org/tracker/index.php?func=detail&aid=32268&group_id=9&atid=498
2012-08-18 19:54:21 +00:00
cfb7aee017 style cleanup 2012-07-07 22:51:57 +00:00
74c9c24d27 style cleanyp 2012-06-23 23:22:19 +00:00
c9e98e848d Fix for subsurf oscillations along creased boundary edges
Changed the "exterior edge interior shift" section of subsurf calc to
always treat boundary edges the same, regardless of sharpness. We
should revisit subsurf creasing to see if more consistent and
predictable results are possible, but for now this a non-intrusive way
to avoid wavyness along the boundary.

Fixes bug [#31864] Artifacts when using Subsurf+Crease on plane
http://projects.blender.org/tracker/index.php?func=detail&aid=31864&group_id=9&atid=498
2012-06-18 20:50:35 +00:00
fd36fb8f63 Code cleanup: use float* rather than void* in subsurf calculation
No functional changes.
2012-06-18 20:50:25 +00:00
f5f25b81e8 style cleanup:
also fix for building ghost test and fix double free in one of the tests
2012-06-17 09:58:26 +00:00
2ab62ce126 code cleanup: defines with braces - end with '(void)0' so callers must end with ';' like normal function.
... without this some editors dont parse the source so well.
2012-05-27 12:21:13 +00:00
2d2d36fe3b code cleanup:
- style - multi-line ifs move braces onto new lines.
- iterators - convert some to macros, other split up and move brace.
2012-05-20 19:49:27 +00:00
9dd981a440 style cleanup: block comments 2012-05-16 23:37:23 +00:00
4f2c83f573 style cleanup: imbuf & icons 2012-05-13 22:05:51 +00:00
145289ad95 code cleanup: minor improvements to float/vector usage. 2012-05-12 22:13:38 +00:00
53ee7908d6 style cleanup: whitespace 2012-05-12 16:11:34 +00:00
f4929ad609 Add mask support to CCGSubSurf and multires.
* Add new CCG function ccgSubSurf_setAllocMask(). Similar to to
  ccgSubSurf_setCalcVertexNormals(), it sets whether the CCG elements
  have a mask layer and what that layer's offset is. Unlike normals
  however, it doesn't change any behavior during CCG calculation; it's
  there only to give CCGKey information on the mask.

* Add a new flag to _getSubSurf(), CCG_ALLOC_MASK. If set, space for
  an extra layer is allocated, but the number of CCG layers is not set
  to include it. This is done because GridPaintMasks are absolute,
  rather than being relative to the subdivided output (as MDisp
  displacements are), so we skip subdividing paint masks here.

* Add a new flag to subsurf_make_derived_from_derived(),
  SUBSURF_ALLOC_PAINT_MASK. This controls whether CCG_ALLOC_MASK is
  set for _getSubSurf(). Related, masks are never loaded in during
  ss_sync_from_derivedmesh(). After subdivision is finished, if the
  alloc mask flag is set, the number of CCG layers is increase to 4
  with ccgSubSurf_setNumLayers().

* Add a new flag to multires_make_from_derived(),
  MULTIRES_ALLOC_PAINT_MASK. Not all multires functions need paint
  mask data (e.g. multiresModifier_base_apply.) This flag is always
  set in MOD_multires.c so that subdividing a mesh with a mask updates
  properly even when not in sculpt mode.

* Update multiresModifier_disp_run() to apply, calculate, and add mask
  elements. It's almost the same as the existing operations with xyz
  coordinates, but treats masks as absolute rather than displacements
  relative to subdivided values.

* Update multires_customdata_delete to free CD_GRID_PAINT_MASK in
  addition to CD_MDISPS.

* Update multires_del_higher() to call the new function
  multires_grid_paint_mask_downsample(), which allocates a
  lower-resolution paint mask grid and copies values over from the
  high-resolution grid.
2012-05-10 20:34:08 +00:00
2ca64189b7 Add CCGKey/CCGElem for accessing CCGSubSurf elements.
CCGKey caches information about the CCGSubSurf element layout. This
data, along with the CCG_* inline functions, allows access to
CCGSubSurf elements with an arbitrary number of layers (as opposed to
the hardcoded DMGridData structure which assumes xyz coordinates
followed by three normal components.)

The CCGElem structure is declared but not defined anywhere, just used
as a convenient type.
2012-05-10 20:32:51 +00:00
dcacbc25bc Modify CCGSubsurf to subdivide an arbitrary number of (float) layers.
The layout of vert data in CCGSubSurf is almost the same; previously
it was three floats (for xyz coordinate) optionally followed by three
floats for the normal. The only change is that the first three floats
can now be any number of floats.

* _getSubSurf takes a numLayers parameter to set the number of layers,
  stored in CCGMeshIFC.numLayers.

* All calls to _getSubSurf currently have numLayers set to 3, except
  for UV subsurf, where it is reduced to 2 (with a corresponding
  change when reading the results out to use float (*)[2] rather than
  float (*)[3].)

* The various VertData* macros in CCGSubSurf.c are now functions that
  take a CCGSubSurf pointer, which provides access to CCGMeshIFC,
  which has numLayers.

* Add ccgSubSurf_setNumLayers() to the API. Only changes the number of
  layers that get subdivided, doesn't change the amount of memory
  allocated. So if space for N layers is allocated, it's safe to set
  the number of layers to less than N, but not more.

* The rest of the changes are just adding the 'ss' parameter.
2012-05-10 20:32:41 +00:00
b340f930ec style cleanup: changes to brace placement / newlines - for/while/if/switch 2012-04-28 06:31:57 +00:00
cd2b142ba0 small speedup to VertDataMulN(av, n), when passed expressions to 'n' they were calculated 3 times, cuts 78 instructions from resulting assembly (gcc -O2). 2012-04-22 03:25:48 +00:00
ac5058b281 subsurf - avoid 'for' loop finding the edge index in a face multiple times when calling _face_getIFCoEdge. add asset so passing wrong value errors out in debug mode. gives small speedup to subsurf. 2012-04-22 03:07:21 +00:00
126f766b4c style cleanup 2012-04-22 00:20:58 +00:00
b4a0152e76 code cleanup: float formatting was confusing in some cases - eg: (0.,0.,0.) 2012-04-11 08:15:13 +00:00
0c91821364 Add new CCG accessor functions.
ccg_gridsize() converts a level into gridsize, ccg_factor() is for
converting coordinates between different multires levels.
2012-03-14 06:31:24 +00:00
06b2343b50 Use sqrtf rather than sqrt in CCGSubSurf.c 2012-03-08 22:33:34 +00:00
9c7e8e837d Code cleanup: remove unused parameter from some ccgSubSurf accessors.
Remove 'CCGSubSurf *ss' parameter from ccgSubSurf_getFaceFaceHandle,
ccgSubSurf_getFaceVert, and ccgSubSurf_getFaceEdge.
2012-03-06 01:01:42 +00:00
95670e03a0 style cleanup / comment formatting for bli/bke/bmesh 2012-03-03 20:19:11 +00:00
33baddfc47 Code cleanup: replace a few macros in CCGSubSurf with inline functions. 2012-02-29 08:35:23 +00:00
8fcb66588b Code cleanup, remove redefinition of UNUSED macro.
Patch from Jason Wilkins:
http://projects.blender.org/tracker/index.php?func=detail&aid=30350&group_id=9&atid=127
2012-02-27 02:46:25 +00:00
e3877a625e Style cleanup: remove underscore prefix from CCG struct names. 2012-02-26 06:50:54 +00:00
1df41811ac Code cleanup: replace some common CCG operations with functions.
The new functions are ccg_gridsize, ccg_edgesize, ccg_spacing, and
ccg_edgebase. These target most of the left-shift operations in the
code.
2012-02-23 07:21:33 +00:00
53fece44cf style cleanup for blenkernel, no functional changes. 2012-02-23 02:17:50 +00:00
84236c2502 use 2d copy functions with UV's in more places. 2011-12-17 03:46:38 +00:00
0c965e16ac Fix #29366: multires crash with meshes that had verts/edges not connected to any face. 2011-11-24 17:06:50 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
bc40f11093 header cleanup (no functional changes) 2011-10-10 09:38:02 +00:00
77e3eac389 Fix for old bug with subsurf not initializing normals for edges that had no faces,
Noted that a floating point exception caused by this r28953.

With the render engine using DerivedMesh normals this came up as a memory error when rendering some files.

for now zero the normals, could interpolate between vertex normals if needed.
2011-03-30 02:05:10 +00:00
a73c3fe5c9 subsurf, derived mesh and other misc files: floats were being implicitly promoted to doubles, adjust to use floats. 2011-03-27 17:22:04 +00:00
Nathan Letwory
0ff06e21cd doxygen: blender/blenkernel tagged. 2011-02-27 20:40:57 +00:00
1b25f48542 clear some unused warnings 2011-02-17 12:05:09 +00:00
8b7482892b made most variables which are only used in a single file and not defined in header static for blenlib, blenkernel and editors. 2011-02-14 17:55:27 +00:00