diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_subdiv_ccg.h')
-rw-r--r-- | source/blender/blenkernel/BKE_subdiv_ccg.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_subdiv_ccg.h b/source/blender/blenkernel/BKE_subdiv_ccg.h index 8d2565c31f7..5808f223f32 100644 --- a/source/blender/blenkernel/BKE_subdiv_ccg.h +++ b/source/blender/blenkernel/BKE_subdiv_ccg.h @@ -214,6 +214,12 @@ typedef struct SubdivCCG { /* Corresponds to MULTIRES_HIDDEN_MODIFIED. */ bool hidden; } dirty; + + /* Cached values, are not supposed to be accessed directly. */ + struct { + /* Indexed by face, indicates index of the first grid which corresponds to the face. */ + int *start_face_grid_index; + } cache_; } SubdivCCG; /* Create CCG representation of subdivision surface. @@ -307,6 +313,31 @@ void BKE_subdiv_ccg_neighbor_coords_get(const SubdivCCG *subdiv_ccg, int BKE_subdiv_ccg_grid_to_face_index(const SubdivCCG *subdiv_ccg, const int grid_index); +typedef enum SubdivCCGAdjacencyType { + SUBDIV_CCG_ADJACENT_NONE, + SUBDIV_CCG_ADJACENT_VERTEX, + SUBDIV_CCG_ADJACENT_EDGE, +} SubdivCCGAdjacencyType; + +/* Returns if a grid coordinates is adjacent to a coarse mesh edge, vertex or nothing. If it is + * adjacent to an edge, r_v1 and r_v2 will be set to the two vertices of that edge. If it is + * adjacent to a vertex, r_v1 and r_v2 will be the index of that vertex. */ +SubdivCCGAdjacencyType BKE_subdiv_ccg_coarse_mesh_adjacency_info_get(const SubdivCCG *subdiv_ccg, + const SubdivCCGCoord *coord, + const MLoop *mloop, + const MPoly *mpoly, + int *r_v1, + int *r_v2); + +/* Get array which is indexed by face index and contains index of a first grid of the face. + * + * The "ensure" version allocates the mapping if it's not know yet and stores it in the subdiv_ccg + * descriptor. This function is NOT safe for threading. + * + * The "get" version simply returns cached array. */ +const int *BKE_subdiv_ccg_start_face_grid_index_ensure(SubdivCCG *subdiv_ccg); +const int *BKE_subdiv_ccg_start_face_grid_index_get(const SubdivCCG *subdiv_ccg); + #ifdef __cplusplus } #endif |