diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_paint.h')
-rw-r--r-- | source/blender/blenkernel/BKE_paint.h | 76 |
1 files changed, 64 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 73413b61456..22362b34548 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -23,15 +23,18 @@ * \ingroup bke */ +#include "BKE_pbvh.h" #include "BLI_bitmap.h" #include "BLI_utildefines.h" #include "DNA_brush_enums.h" +#include "DNA_customdata_types.h" #include "DNA_object_enums.h" #ifdef __cplusplus extern "C" { #endif +struct MDynTopoVert; struct BMFace; struct BMesh; struct BlendDataReader; @@ -342,6 +345,11 @@ typedef struct SculptClothSimulation { /** #PBVHNode pointer as a key, index in #SculptClothSimulation.node_state as value. */ struct GHash *node_state_index; eSculptClothNodeSimState *node_state; + + // persistent base customdata layer offsets + int cd_pers_co; + int cd_pers_no; + int cd_pers_disp; } SculptClothSimulation; typedef struct SculptPersistentBase { @@ -360,7 +368,8 @@ typedef struct SculptVertexInfo { typedef struct SculptBoundaryEditInfo { /* Vertex index from where the topology propagation reached this vertex. */ - int original_vertex; + SculptVertRef original_vertex; + int original_vertex_i; /* How many steps were needed to reach this vertex from the boundary. */ int num_propagation_steps; @@ -371,13 +380,23 @@ typedef struct SculptBoundaryEditInfo { /* Edge for drawing the boundary preview in the cursor. */ typedef struct SculptBoundaryPreviewEdge { - int v1; - int v2; + SculptVertRef v1; + SculptVertRef v2; } SculptBoundaryPreviewEdge; +#define MAX_STORED_COTANGENTW_EDGES 7 + +typedef struct StoredCotangentW { + float static_weights[MAX_STORED_COTANGENTW_EDGES]; + float *weights; + int length; +} StoredCotangentW; + typedef struct SculptBoundary { /* Vertex indices of the active boundary. */ - int *vertices; + SculptVertRef *vertices; + int *vertex_indices; + int vertices_capacity; int num_vertices; @@ -386,6 +405,14 @@ typedef struct SculptBoundary { * a distance of 0. */ float *distance; + float (*smoothco)[3]; + float *boundary_dist; // distances from verts to boundary + float (*boundary_tangents)[3]; + + StoredCotangentW *boundary_cotangents; + SculptVertRef *boundary_closest; + int sculpt_totvert; + /* Data for drawing the preview. */ SculptBoundaryPreviewEdge *edges; int edges_capacity; @@ -395,12 +422,12 @@ typedef struct SculptBoundary { bool forms_loop; /* Initial vertex in the boundary which is closest to the current sculpt active vertex. */ - int initial_vertex; + SculptVertRef initial_vertex; /* Vertex that at max_propagation_steps from the boundary and closest to the original active * vertex that was used to initialize the boundary. This is used as a reference to check how much * the deformation will go into the mesh and to calculate the strength of the brushes. */ - int pivot_vertex; + SculptVertRef pivot_vertex; /* Stores the initial positions of the pivot and boundary initial vertex as they may be deformed * during the brush action. This allows to use them as a reference positions and vectors for some @@ -418,7 +445,7 @@ typedef struct SculptBoundary { /* Bend Deform type. */ struct { float (*pivot_rotation_axis)[3]; - float (*pivot_positions)[3]; + float (*pivot_positions)[4]; } bend; /* Slide Deform type. */ @@ -440,7 +467,7 @@ typedef struct SculptFakeNeighbors { float current_max_distance; /* Indexed by vertex, stores the vertex index of its fake neighbor if available. */ - int *fake_neighbor_index; + SculptVertRef *fake_neighbor_index; } SculptFakeNeighbors; @@ -459,8 +486,15 @@ typedef struct SculptSession { /* These are always assigned to base mesh data when using PBVH_FACES and PBVH_GRIDS. */ struct MVert *mvert; - struct MPoly *mpoly; + struct MEdge *medge; struct MLoop *mloop; + struct MPoly *mpoly; + + // only assigned in PBVH_FACES and PBVH_GRIDS + CustomData *vdata, *edata, *ldata, *pdata; + + // for grids + CustomData temp_vdata, temp_pdata; /* These contain the vertex and poly counts of the final mesh. */ int totvert, totpoly; @@ -495,8 +529,13 @@ typedef struct SculptSession { /* BMesh for dynamic topology sculpting */ struct BMesh *bm; + int cd_dyn_vert; int cd_vert_node_offset; int cd_face_node_offset; + int cd_vcol_offset; + int cd_faceset_offset; + int cd_face_areas; + bool bm_smooth_shading; /* Undo/redo log for dynamic topology sculpting */ struct BMLog *bm_log; @@ -524,9 +563,9 @@ typedef struct SculptSession { struct ExpandCache *expand_cache; /* Cursor data and active vertex for tools */ - int active_vertex_index; + SculptVertRef active_vertex_index; + SculptFaceRef active_face_index; - int active_face_index; int active_grid_index; /* When active, the cursor draws with faded colors, indicating that there is an action enabled. @@ -548,9 +587,12 @@ typedef struct SculptSession { struct RegionView3D *rv3d; struct View3D *v3d; struct Scene *scene; + int cd_origvcol_offset; + int cd_origco_offset; + int cd_origno_offset; /* Dynamic mesh preview */ - int *preview_vert_index_list; + SculptVertRef *preview_vert_index_list; int preview_vert_index_count; /* Pose Brush Preview */ @@ -612,6 +654,13 @@ typedef struct SculptSession { */ char needs_flush_to_id; + // id of current stroke, used to detect + // if vertex original data needs to be updated + int stroke_id, boundary_symmetry; + + bool fast_draw; // hides facesets/masks and forces smooth to save GPU bandwidth + struct MDynTopoVert *mdyntopo_verts; // for non-bmesh + int mdyntopo_verts_size; } SculptSession; void BKE_sculptsession_free(struct Object *ob); @@ -619,6 +668,7 @@ void BKE_sculptsession_free_deformMats(struct SculptSession *ss); void BKE_sculptsession_free_vwpaint_data(struct SculptSession *ss); void BKE_sculptsession_bm_to_me(struct Object *ob, bool reorder); void BKE_sculptsession_bm_to_me_for_render(struct Object *object); +bool BKE_sculptsession_check_mdyntopo(SculptSession *ss, int totvert); /* Create new color layer on object if it doesn't have one and if experimental feature set has * sculpt vertex color enabled. Returns truth if new layer has been added, false otherwise. */ @@ -655,6 +705,8 @@ void BKE_sculpt_ensure_orig_mesh_data(struct Scene *scene, struct Object *object bool BKE_sculptsession_use_pbvh_draw(const struct Object *ob, const struct View3D *v3d); +char BKE_get_fset_boundary_symflag(struct Object *object); + enum { SCULPT_MASK_LAYER_CALC_VERT = (1 << 0), SCULPT_MASK_LAYER_CALC_LOOP = (1 << 1), |