diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-06 18:06:17 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-11 17:37:02 +0300 |
commit | 3fbdcefa174dd85972b7b63c0955e3a8d42f6943 (patch) | |
tree | 6b1d4b1538f18e847f2e12204a79d89b937edc28 /source/blender/blenkernel/BKE_subdiv_ccg.h | |
parent | 998a80435819387ce88d922d7fd7049e8e27b7bf (diff) |
Subdiv: Initial implementation of CCG
Attempts to substitude CCGDM with an OpenSubdiv based structure
which has less abstraction levels. The missing part in this
substitude is a face pointers which old CCGDM/multires code was
using to stitch faces (averaging boundaries).
Another curial bit missing: "reshaping" of multires CD_MDISPS
to the state of new PBVH grids.
The new code is only available when OpenSubdiv modifier is
enabled (WITH_OPENSUBDIV_MODIFIER=ON) and with debug value of
128. This is so this WIP code is not interfering with current
production machines in the studio.
Reviewers: brecht
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D3685
Diffstat (limited to 'source/blender/blenkernel/BKE_subdiv_ccg.h')
-rw-r--r-- | source/blender/blenkernel/BKE_subdiv_ccg.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_subdiv_ccg.h b/source/blender/blenkernel/BKE_subdiv_ccg.h index b1acf43ad25..8f8a605d309 100644 --- a/source/blender/blenkernel/BKE_subdiv_ccg.h +++ b/source/blender/blenkernel/BKE_subdiv_ccg.h @@ -33,10 +33,12 @@ #define __BKE_SUBDIV_CCG_H__ #include "BKE_customdata.h" +#include "BLI_bitmap.h" #include "BLI_sys_types.h" struct CCGElem; struct CCGKey; +struct DMFlagMat; struct Mesh; struct Subdiv; @@ -67,7 +69,12 @@ typedef struct SubdivCCG { * corresponding to face-corners of coarse mesh, each grid has * grid_size^2 elements. */ + /* Indexed by a grid index, points to a grid data which is stored in + * grids_storage. + */ struct CCGElem **grids; + /* Flat array of all grids' data. */ + unsigned char *grids_storage; int num_grids; /* Loose edges, each array element contains grid_size elements * corresponding to vertices created by subdividing coarse edges. @@ -91,6 +98,9 @@ typedef struct SubdivCCG { int normal_offset; int mask_offset; + struct DMFlagMat *grid_flag_mats; + BLI_bitmap **grid_hidden; + /* TODO(sergey): Consider adding some accessors to a "decoded" geometry, * to make integration with draw manager and such easy. */ @@ -106,9 +116,18 @@ struct SubdivCCG *BKE_subdiv_to_ccg( const SubdivToCCGSettings *settings, const struct Mesh *coarse_mesh); + /* Destroy CCG representation of subdivision surface. */ void BKE_subdiv_ccg_destroy(SubdivCCG *subdiv_ccg); +/* Helper function, creates Mesh structure which is properly setup to use + * grids. + */ +struct Mesh *BKE_subdiv_to_ccg_mesh( + struct Subdiv *subdiv, + const SubdivToCCGSettings *settings, + const struct Mesh *coarse_mesh); + /* Create a key for accessing grid elements at a given level. */ void BKE_subdiv_ccg_key( struct CCGKey *key, const SubdivCCG *subdiv_ccg, int level); |