Commit Graph

65 Commits

Author SHA1 Message Date
Campbell Barton 01f9e13c30 Cleanup: use 'e' prefix for enum types 2018-05-30 10:29:41 +02:00
Sergey Sharybin 301a27187c Cleanup: More typed allocation type enum usage
Majority of the code is EOL, but still handy for debug purposes.
2018-05-30 10:22:28 +02:00
Brecht Van Lommel 2fb9a50a4f Fix T55146: hair + subsurf modifier not positioning hair correctly.
ORIGSPACE data was not being preserved correctly through subsurf.
2018-05-22 18:43:20 +02:00
Sybren A. Stüvel 1553f6b656 Introduced CDDM_from_mesh_ex() to create a non-referencing CDDM
This allows the mesh to be freed and the CDDM kept.
2018-05-01 18:02:17 +02:00
Sergey Sharybin 03544eccb4 Fix missing hair after rendering with different viewport/render settings
Derived mesh for particles did not include tessellated faces when it
was expected to. Now added explicit function to copy CDDM with tess
faces without need to re-tessellate the result.
2017-02-07 14:21:29 +01:00
Campbell Barton f964334b88 Fix T46215: Explode modifier looses textures 2015-09-23 22:57:00 +10:00
Campbell Barton 595a491e63 Add tessellation data to DerivedMesh (LoopTri)
This stores loop indices into the loop array giving easier acess
to data such as vertex-colors and UV's,
removing the need to store an MFace duplicate of custom-data.

This doesn't yet move all internal code from MFace to LoopTri just yet.

Only applies to:
- opengl drawing
- sculpting (pbvh)
- vertex/weight paint

Thanks to @psy-fi for review, fixes and improvements to drawing!
2015-07-17 03:55:14 +10:00
Bastien Montagne 138c9dba9b Add Custom Loop Normals.
This is the core code for it, tools (datatransfer and modifier) will come in next commits).
RNA api is already there, though.

See the code for details, but basically, we define, for each 'smooth fan'
(which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal),
a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store
custom normal as two angular factors inside that space. This allows to have custom normals
'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer.

Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals,
and be converted back into storage format at the end.

Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can
be rather heavy with high poly meshes.

Also, bumping subversion, and fix mess in 2.70 versioning code.
2015-02-05 14:32:57 +01:00
Bastien Montagne 0af11a1742 Make use/computation of lnors consistant.
Issue was, when requesting (building) lnors for a mesh that has
autosmooth disabled, one would expect to simply get vnors as lnors.

Until now, it wasn't the case, which was bad e.g. for normal projections
of loops in recent remap code (projecting along split loop normals
when you would expect projection along vertex normals...).

Also, removed the 'angle' parameter from RNA's `mesh.calc_normals_split`.
This should *always* use mesh settings (both autosmooth and smoothresh),
otherwise once again we'd get inconsistencies in some cases.
Will update fbx and obj addons too.
2015-01-19 15:51:20 +01:00
Campbell Barton ab06ec7a24 Rewritten Array Modifier D443
Patch by PatB with own edits

- replace BMesh with CDDM functions.
- faster remove-vertex merging.
- extend CDDM_merge_verts to be more flexible.
2014-08-12 13:52:17 +10:00
Bastien Montagne 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
Bastien Montagne c37e8ecc50 Cleanup: int/short to bool in BKE_cdderivedmesh.h functions (and TRUE/FALSE to true/false in code using them). 2014-01-23 14:52:46 +01:00
Campbell Barton 4ae7ae6f2e Code Cleanup: use bool for return values and correct comments
also remove CDDM_Check, theres no need for it.
2014-01-22 02:53:48 +11:00
Campbell Barton a5606fadbb Code Cleanup: remove object arg to CDDM_from_mesh mesh_create_derived 2013-12-26 08:27:08 +11:00
Campbell Barton d07f3f793b add CDDM_lower_num_loops(), for completeness (currently unused). 2013-11-04 12:01:46 +00:00
Campbell Barton a70fa65592 optimize mirror merging, remove array reallocation, replace with fixed size arrays. 2013-05-27 20:11:12 +00:00
Brecht Van Lommel b39090bb5a Fix #33752: UV Orco coordinates were wrong for Cycles (and other external
render engines). Replaced generating orco_index by filling the UV loop data
directly which is easier and all that needed to be done anyway.
2013-01-10 17:37:17 +00:00
Campbell Barton 2de2acc681 add CDDM_from_bmesh(), avoids using BMEditMesh in modifiers. 2012-10-24 07:24:11 +00:00
Campbell Barton 8f6197bd08 support for curve orco uv's as UV's in cycles.
ideally these would be used as generated coordinates, but this is tricly because cycles calculates its own orco's and doesnt know about curve settings.
2012-07-31 13:43:26 +00:00
Sergey Sharybin 8a9d1c0a79 Fix #31021: Render settings are not taken into account for curves
Refactored code a bit to make naming a bit more clear and added a
function to create mesh from given display list rather than from
object's displist.

Tested using plain curves (which doesn't imply using derived meshes)
and curves with constructive modifiers (which are using derived meshed).
2012-07-14 17:30:49 +00:00
Campbell Barton 9892736206 code cleanup: header cleanup and remove some duplicate defines. 2012-05-12 20:39:39 +00:00
Campbell Barton 4f19c1a995 spelling cleanup 2012-03-18 07:38:51 +00:00
Campbell Barton e56f714000 ngons draw with uniform normals in object mode now, I had this code disabled for speed (it was being called when it didnt need to), but for CDDM meshes without face normal layers this should still be called. 2012-03-18 06:49:32 +00:00
Campbell Barton 4f7bdc59d3 style cleanup: spelling.
also remove large, duplicate comments from sunsky.h
2012-03-09 00:41:09 +00:00
Campbell Barton 95670e03a0 style cleanup / comment formatting for bli/bke/bmesh 2012-03-03 20:19:11 +00:00
Campbell Barton 7bbf4b7831 style cleanup
- spelling - turns out we had tessellation spelt wrong all over.
- use \directive for doxy (not @directive)
- remove BLI_sparsemap.h - was from bmesh merge IIRC but entire file commented and not used.
2012-03-02 16:05:54 +00:00
Campbell Barton a368e6771a - remove some unused editmesh functions.
- copy & rename EditMesh stricts for use with scanfill (remove unused members)
2012-02-19 22:17:30 +00:00
Campbell Barton 48006292d8 svn merge ^/trunk/blender -r44189:44204 2012-02-17 20:56:25 +00:00
Campbell Barton 2b7ca2304a unify include guard defines, __$FILENAME__
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
Campbell Barton 7c2715a7ad rename CDDM_To_BMesh to DM_to_editbmesh, since theres no requirement for
the input to be a CDDM.

remove conversions to CDDM for edge split and bevel (will give some
speedup).
2012-02-12 15:02:33 +00:00
Nicholas Bishop 5f6395d69e Code cleanup for BMesh CDDM access functions, no functional changes.
Renamed CDDM_get_face() to CDDM_get_poly() to match array access
functions. Added function definitions for CDDM_get_loop() and
CDDM_get_poly().
2012-02-07 01:13:04 +00:00
Campbell Barton 2ea8a3b8ca remove CDDM_copy second argument, added CDDM_copy_from_tessface instead.
this function caused too many conflicts and in most cases was zero anyway.
2012-01-29 21:59:47 +00:00
Campbell Barton 61a5cc28be disable re-tesselation for modifiers that use bmesh, array/bevel/edge split - were tesselating 2 times and didnt need to.
also comment array modifier from flushing selection flags.
2012-01-22 21:12:18 +00:00
Campbell Barton 1f84876e89 ensure defoem DM has tessface data for the few places that need it.
also add a workaround for CDDM_recalc_tesselation_ex() which would add a CD_NORMAL to dm->fdata and then overwrite immediate
2012-01-19 19:23:25 +00:00
Campbell Barton 9d782c8a1a argument for CDDM_from_BMEditMesh() so creating tessface data is optional, no functional changes since all callers use this so far. 2012-01-18 15:09:27 +00:00
Campbell Barton be1bc0eb98 rename
* CDDM_calc_edges --> CDDM_calc_edges_tessface
* CDDM_calc_edges_poly --> CDDM_calc_edges
2012-01-06 02:59:28 +00:00
Campbell Barton 5c59f0d589 added
* CDDM_calc_normals
* CDDM_calc_normals_tessface

these match what we have in trunk - CDDM_calc_normals_mapping() is kept for more comprehensive operatons.
2012-01-06 00:45:07 +00:00
Campbell Barton ded0af482b rename CDDM_calc_normals() --> CDDM_calc_normals_mapping 2012-01-06 00:12:24 +00:00
Campbell Barton 20b425e5d1 minor changes for mirror modifier, bigger changes coming. 2012-01-03 09:37:57 +00:00
Campbell Barton 71bc053bb2 remesh now working for bmesh 2011-12-31 12:58:03 +00:00
Andrew Wiggin 2266c7fc1c Add CD_POLYINDEX layer to reduce need for retesselations 2011-11-13 15:13:59 +00:00
Campbell Barton 15e6d6cd75 svn merge ^/trunk/blender -r41226:41227 . 2011-10-24 12:43:08 +00:00
Campbell Barton 4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
Campbell Barton 4e118bb22f svn merge ^/trunk/blender -r40890:40950 2011-10-14 01:35:20 +00:00
Campbell Barton bc40f11093 header cleanup (no functional changes) 2011-10-10 09:38:02 +00:00
Joseph Eagar 6ef77cf95a =bmesh= merge from trunk at r36529 2011-05-08 23:43:18 +00:00
Joseph Eagar 7d43a48993 =bmesh=
Multires interpolation is considerably better
now, though it still has a problem with occasionally
producing little random tangent spikes.  Still, it's
far better then it was.

Also fixed a bug in dissolve faces.
2011-03-29 05:48:18 +00:00
Joseph Eagar d88bb9115f =bmesh=
Coded a new modifier, "Precision UV Interpolation", 
that triangulates, subdivides, then uses brecht's mean
value interpolation to interpolate face data.

Textures on ngon faces get interpolated a bit nicer, in 
other words (though concave cases, e.g. 'N', don't work very well).
2011-03-25 00:32:38 +00:00
Joseph Eagar f01261d040 merge with/from trunk at r35190 2011-02-27 06:19:40 +00:00
Nathan Letwory 22638e22ea doxygen: blenkernel under core as module. 2011-02-18 13:05:18 +00:00