Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2022-04-05 21:42:55 +0300
committerJoseph Eagar <joeedh@gmail.com>2022-04-05 21:42:55 +0300
commiteae36be372a6b16ee3e76eff0485a47da4f3c230 (patch)
treed1ca2dc30951e31f1b91eed6a4edfdfb0824bf1f /source/blender/blenkernel/BKE_pbvh.h
parenta3e122b9aec59fc303c2375a78183cfb8642c14f (diff)
Refactor: Unify vertex and sculpt colors into new
color attribute system. This commit removes sculpt colors from experimental status and unifies it with vertex colors. It introduces the concept of "color attributes", which are any attributes that represents colors. Color attributes can be represented with byte or floating-point numbers and can be stored in either vertices or face corners. Color attributes share a common namespace (so you can no longer have a floating-point sculpt color attribute and a byte vertex color attribute with the same name). Note: this commit does not include vertex paint mode, which is a separate patch, see: https://developer.blender.org/D14179 Differential Revision: https://developer.blender.org/D12587 Ref D12587
Diffstat (limited to 'source/blender/blenkernel/BKE_pbvh.h')
-rw-r--r--source/blender/blenkernel/BKE_pbvh.h54
1 files changed, 46 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index eadbe52d091..775847f27f8 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -11,6 +11,7 @@
#include "BLI_ghash.h"
/* For embedding CCGKey in iterator. */
+#include "BKE_attribute.h"
#include "BKE_ccg.h"
#ifdef __cplusplus
@@ -34,6 +35,7 @@ struct PBVH;
struct PBVHNode;
struct SubdivCCG;
struct TaskParallelSettings;
+struct MeshElemMap;
typedef struct PBVH PBVH;
typedef struct PBVHNode PBVHNode;
@@ -299,6 +301,10 @@ void BKE_pbvh_node_get_verts(PBVH *pbvh,
PBVHNode *node,
const int **r_vert_indices,
struct MVert **r_verts);
+void BKE_pbvh_node_get_loops(PBVH *pbvh,
+ PBVHNode *node,
+ const int **r_loop_indices,
+ const struct MLoop **r_loops);
void BKE_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3]);
void BKE_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max[3]);
@@ -388,7 +394,6 @@ typedef struct PBVHVertexIter {
float (*vert_normals)[3];
int totvert;
const int *vert_indices;
- struct MPropCol *vcol;
float *vmask;
/* bmesh */
@@ -405,7 +410,6 @@ typedef struct PBVHVertexIter {
float *no;
float *fno;
float *mask;
- float *col;
bool visible;
} PBVHVertexIter;
@@ -461,17 +465,14 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
if (vi.vmask) { \
vi.mask = &vi.vmask[vi.index]; \
} \
- if (vi.vcol) { \
- vi.col = vi.vcol[vi.index].color; \
- } \
} \
else { \
if (!BLI_gsetIterator_done(&vi.bm_unique_verts)) { \
- vi.bm_vert = BLI_gsetIterator_getKey(&vi.bm_unique_verts); \
+ vi.bm_vert = (BMVert *)BLI_gsetIterator_getKey(&vi.bm_unique_verts); \
BLI_gsetIterator_step(&vi.bm_unique_verts); \
} \
else { \
- vi.bm_vert = BLI_gsetIterator_getKey(&vi.bm_other_verts); \
+ vi.bm_vert = (BMVert *)BLI_gsetIterator_getKey(&vi.bm_other_verts); \
BLI_gsetIterator_step(&vi.bm_other_verts); \
} \
vi.visible = !BM_elem_flag_test_bool(vi.bm_vert, BM_ELEM_HIDDEN); \
@@ -481,7 +482,7 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
vi.co = vi.bm_vert->co; \
vi.fno = vi.bm_vert->no; \
vi.index = BM_elem_index_get(vi.bm_vert); \
- vi.mask = BM_ELEM_CD_GET_VOID_P(vi.bm_vert, vi.cd_vert_mask_offset); \
+ vi.mask = (float *)BM_ELEM_CD_GET_VOID_P(vi.bm_vert, vi.cd_vert_mask_offset); \
}
#define BKE_pbvh_vertex_iter_end \
@@ -526,6 +527,43 @@ const float (*BKE_pbvh_get_vert_normals(const PBVH *pbvh))[3];
PBVHColorBufferNode *BKE_pbvh_node_color_buffer_get(PBVHNode *node);
void BKE_pbvh_node_color_buffer_free(PBVH *pbvh);
+bool BKE_pbvh_get_color_layer(const struct Mesh *me,
+ CustomDataLayer **r_layer,
+ AttributeDomain *r_attr);
+
+/* Swaps colors at each element in indices (of domain pbvh->vcol_domain)
+ * with values in colors. */
+void BKE_pbvh_swap_colors(PBVH *pbvh,
+ const int *indices,
+ const int indices_num,
+ float (*colors)[4]);
+
+/* Stores colors from the elements in indices (of domain pbvh->vcol_domain)
+ * into colors. */
+void BKE_pbvh_store_colors(PBVH *pbvh,
+ const int *indices,
+ const int indices_num,
+ float (*colors)[4]);
+
+/* Like BKE_pbvh_store_colors but handles loop->vert conversion */
+void BKE_pbvh_store_colors_vertex(PBVH *pbvh,
+ const int *indices,
+ const int indices_num,
+ float (*colors)[4]);
+
+bool BKE_pbvh_is_drawing(const PBVH *pbvh);
+void BKE_pbvh_is_drawing_set(PBVH *pbvh, bool val);
+
+/* Do not call in PBVH_GRIDS mode */
+void BKE_pbvh_node_num_loops(PBVH *pbvh, PBVHNode *node, int *r_totloop);
+
+void BKE_pbvh_update_active_vcol(PBVH *pbvh, const struct Mesh *mesh);
+void BKE_pbvh_pmap_set(PBVH *pbvh, const struct MeshElemMap *pmap);
+
+void BKE_pbvh_vertex_color_set(PBVH *pbvh, int vertex, const float color[4]);
+void BKE_pbvh_vertex_color_get(const PBVH *pbvh, int vertex, float r_color[4]);
+
+void BKE_pbvh_ensure_node_loops(PBVH *pbvh);
#ifdef __cplusplus
}