[Bf-blender-cvs] [d3500c482fa] master: Cleanup: Move DRW_pbvh.h header to C++

Hans Goudey noreply at git.blender.org
Mon Feb 6 22:52:33 CET 2023


Commit: d3500c482fae55497abc5c02c7ccf9e5e7d22020
Author: Hans Goudey
Date:   Mon Feb 6 16:52:02 2023 -0500
Branches: master
https://developer.blender.org/rBd3500c482fae55497abc5c02c7ccf9e5e7d22020

Cleanup: Move DRW_pbvh.h header to C++

For continued refactoring of the Mesh data structure. See T103343.

===================================================================

M	source/blender/blenkernel/intern/pbvh.cc
M	source/blender/blenkernel/intern/pbvh_bmesh.cc
M	source/blender/draw/CMakeLists.txt
D	source/blender/draw/DRW_pbvh.h
A	source/blender/draw/DRW_pbvh.hh
M	source/blender/draw/intern/draw_manager_data.cc
M	source/blender/draw/intern/draw_pbvh.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/pbvh.cc b/source/blender/blenkernel/intern/pbvh.cc
index b45a136f28c..7c829d32a82 100644
--- a/source/blender/blenkernel/intern/pbvh.cc
+++ b/source/blender/blenkernel/intern/pbvh.cc
@@ -26,7 +26,7 @@
 #include "BKE_pbvh.h"
 #include "BKE_subdiv_ccg.h"
 
-#include "DRW_pbvh.h"
+#include "DRW_pbvh.hh"
 
 #include "PIL_time.h"
 
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.cc b/source/blender/blenkernel/intern/pbvh_bmesh.cc
index f8d4bdc88da..ec09f254ff4 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.cc
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.cc
@@ -17,7 +17,7 @@
 #include "BKE_ccg.h"
 #include "BKE_pbvh.h"
 
-#include "DRW_pbvh.h"
+#include "DRW_pbvh.hh"
 
 #include "bmesh.h"
 #include "pbvh_intern.hh"
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index d2835639686..19bd2267db5 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -220,7 +220,7 @@ set(SRC
   engines/overlay/overlay_wireframe.cc
 
   DRW_engine.h
-  DRW_pbvh.h
+  DRW_pbvh.hh
   DRW_select_buffer.h
   intern/DRW_gpu_wrapper.hh
   intern/DRW_render.h
diff --git a/source/blender/draw/DRW_pbvh.h b/source/blender/draw/DRW_pbvh.h
deleted file mode 100644
index 00c76b641ee..00000000000
--- a/source/blender/draw/DRW_pbvh.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright 2022 Blender Foundation. */
-
-/** \file
- * \ingroup draw
- */
-
-#pragma once
-
-/* Needed for BKE_ccg.h. */
-#include "BLI_assert.h"
-#include "BLI_bitmap.h"
-
-#include "BKE_ccg.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct PBVHAttrReq;
-struct GPUBatch;
-struct PBVHNode;
-struct GSet;
-struct DMFlagMat;
-struct Mesh;
-struct MLoopTri;
-struct CustomData;
-struct MLoop;
-struct MPoly;
-struct SubdivCCG;
-struct BMesh;
-
-typedef struct PBVHBatches PBVHBatches;
-
-typedef struct PBVH_GPU_Args {
-  int pbvh_type;
-
-  struct BMesh *bm;
-  const struct Mesh *me;
-  const float (*vert_positions)[3];
-  const struct MLoop *mloop;
-  const struct MPoly *mpoly;
-  int mesh_verts_num, mesh_faces_num, mesh_grids_num;
-  struct CustomData *vdata, *ldata, *pdata;
-  const float (*vert_normals)[3];
-
-  const char *active_color;
-  const char *render_color;
-
-  int face_sets_color_seed, face_sets_color_default;
-  int *face_sets; /* for PBVH_FACES and PBVH_GRIDS */
-
-  struct SubdivCCG *subdiv_ccg;
-  const struct DMFlagMat *grid_flag_mats;
-  const int *grid_indices;
-  CCGKey ccg_key;
-  CCGElem **grids;
-  void **gridfaces;
-  BLI_bitmap **grid_hidden;
-
-  int *prim_indices;
-  int totprim;
-
-  const bool *hide_poly;
-
-  int node_verts_num;
-
-  const struct MLoopTri *mlooptri;
-  struct PBVHNode *node;
-
-  /* BMesh. */
-  struct GSet *bm_unique_vert, *bm_other_verts, *bm_faces;
-  int cd_mask_layer;
-} PBVH_GPU_Args;
-
-typedef struct PBVHGPUFormat PBVHGPUFormat;
-
-void DRW_pbvh_node_update(PBVHBatches *batches, PBVH_GPU_Args *args);
-void DRW_pbvh_update_pre(PBVHBatches *batches, PBVH_GPU_Args *args);
-
-void DRW_pbvh_node_gpu_flush(PBVHBatches *batches);
-struct PBVHBatches *DRW_pbvh_node_create(PBVH_GPU_Args *args);
-void DRW_pbvh_node_free(PBVHBatches *batches);
-struct GPUBatch *DRW_pbvh_tris_get(PBVHBatches *batches,
-                                   struct PBVHAttrReq *attrs,
-                                   int attrs_num,
-                                   PBVH_GPU_Args *args,
-                                   int *r_prim_count,
-                                   bool do_coarse_grids);
-struct GPUBatch *DRW_pbvh_lines_get(struct PBVHBatches *batches,
-                                    struct PBVHAttrReq *attrs,
-                                    int attrs_num,
-                                    PBVH_GPU_Args *args,
-                                    int *r_prim_count,
-                                    bool do_coarse_grids);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/source/blender/draw/DRW_pbvh.hh b/source/blender/draw/DRW_pbvh.hh
new file mode 100644
index 00000000000..74cf1f93594
--- /dev/null
+++ b/source/blender/draw/DRW_pbvh.hh
@@ -0,0 +1,89 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. */
+
+/** \file
+ * \ingroup draw
+ */
+
+#pragma once
+
+/* Needed for BKE_ccg.h. */
+#include "BLI_assert.h"
+#include "BLI_bitmap.h"
+
+#include "BKE_ccg.h"
+
+struct PBVHAttrReq;
+struct GPUBatch;
+struct PBVHNode;
+struct PBVHBatches;
+struct PBVHGPUFormat;
+struct GSet;
+struct DMFlagMat;
+struct Mesh;
+struct MLoopTri;
+struct CustomData;
+struct MLoop;
+struct MPoly;
+struct SubdivCCG;
+struct BMesh;
+
+struct PBVH_GPU_Args {
+  int pbvh_type;
+
+  BMesh *bm;
+  const Mesh *me;
+  const float (*vert_positions)[3];
+  const MLoop *mloop;
+  const MPoly *mpoly;
+  int mesh_verts_num, mesh_faces_num, mesh_grids_num;
+  CustomData *vdata, *ldata, *pdata;
+  const float (*vert_normals)[3];
+
+  const char *active_color;
+  const char *render_color;
+
+  int face_sets_color_seed, face_sets_color_default;
+  int *face_sets; /* for PBVH_FACES and PBVH_GRIDS */
+
+  SubdivCCG *subdiv_ccg;
+  const DMFlagMat *grid_flag_mats;
+  const int *grid_indices;
+  CCGKey ccg_key;
+  CCGElem **grids;
+  void **gridfaces;
+  BLI_bitmap **grid_hidden;
+
+  int *prim_indices;
+  int totprim;
+
+  const bool *hide_poly;
+
+  int node_verts_num;
+
+  const MLoopTri *mlooptri;
+  PBVHNode *node;
+
+  /* BMesh. */
+  GSet *bm_unique_vert, *bm_other_verts, *bm_faces;
+  int cd_mask_layer;
+};
+
+void DRW_pbvh_node_update(PBVHBatches *batches, PBVH_GPU_Args *args);
+void DRW_pbvh_update_pre(PBVHBatches *batches, PBVH_GPU_Args *args);
+
+void DRW_pbvh_node_gpu_flush(PBVHBatches *batches);
+PBVHBatches *DRW_pbvh_node_create(PBVH_GPU_Args *args);
+void DRW_pbvh_node_free(PBVHBatches *batches);
+GPUBatch *DRW_pbvh_tris_get(PBVHBatches *batches,
+                            PBVHAttrReq *attrs,
+                            int attrs_num,
+                            PBVH_GPU_Args *args,
+                            int *r_prim_count,
+                            bool do_coarse_grids);
+GPUBatch *DRW_pbvh_lines_get(PBVHBatches *batches,
+                             PBVHAttrReq *attrs,
+                             int attrs_num,
+                             PBVH_GPU_Args *args,
+                             int *r_prim_count,
+                             bool do_coarse_grids);
diff --git a/source/blender/draw/intern/draw_manager_data.cc b/source/blender/draw/intern/draw_manager_data.cc
index 779266a7b12..569fea083ef 100644
--- a/source/blender/draw/intern/draw_manager_data.cc
+++ b/source/blender/draw/intern/draw_manager_data.cc
@@ -5,7 +5,7 @@
  * \ingroup draw
  */
 
-#include "DRW_pbvh.h"
+#include "DRW_pbvh.hh"
 
 #include "draw_attributes.h"
 #include "draw_manager.h"
diff --git a/source/blender/draw/intern/draw_pbvh.cc b/source/blender/draw/intern/draw_pbvh.cc
index 68ef6cef8a6..04d985be71e 100644
--- a/source/blender/draw/intern/draw_pbvh.cc
+++ b/source/blender/draw/intern/draw_pbvh.cc
@@ -44,7 +44,7 @@
 #include "GPU_batch.h"
 
 #include "DRW_engine.h"
-#include "DRW_pbvh.h"
+#include "DRW_pbvh.hh"
 
 #include "bmesh.h"
 #include "draw_pbvh.h"



More information about the Bf-blender-cvs mailing list