Cleanup: Move remaining mesh draw code to C++
After this commit, all mesh data extraction and drawing code is in C++, including headers, making it possible to use improved types for future performance improvements and simplifications. The only non-trivial changes are in `draw_cache_impl_mesh.cc`, where use of certain features and macros in C necessitated larger changes. Differential Revision: https://developer.blender.org/D15088
This commit is contained in:
parent
31da775ec2
commit
176d7bcc2e
Notes:
blender-bot
2023-02-14 08:33:26 +01:00
Referenced by commit 7eb2018a0b
, Fix Windows compiler error
|
@ -39,8 +39,8 @@ set(INC
|
|||
set(SRC
|
||||
intern/draw_cache.c
|
||||
intern/draw_cache_extract_mesh.cc
|
||||
intern/draw_cache_extract_mesh_render_data.c
|
||||
intern/mesh_extractors/extract_mesh.c
|
||||
intern/draw_cache_extract_mesh_render_data.cc
|
||||
intern/mesh_extractors/extract_mesh.cc
|
||||
intern/mesh_extractors/extract_mesh_ibo_edituv.cc
|
||||
intern/mesh_extractors/extract_mesh_ibo_fdots.cc
|
||||
intern/mesh_extractors/extract_mesh_ibo_lines.cc
|
||||
|
@ -75,7 +75,7 @@ set(SRC
|
|||
intern/draw_cache_impl_displist.c
|
||||
intern/draw_cache_impl_gpencil.c
|
||||
intern/draw_cache_impl_lattice.c
|
||||
intern/draw_cache_impl_mesh.c
|
||||
intern/draw_cache_impl_mesh.cc
|
||||
intern/draw_cache_impl_metaball.c
|
||||
intern/draw_cache_impl_particles.c
|
||||
intern/draw_cache_impl_pointcloud.c
|
||||
|
@ -201,7 +201,7 @@ set(SRC
|
|||
intern/DRW_render.h
|
||||
intern/draw_attributes.h
|
||||
intern/draw_cache.h
|
||||
intern/draw_cache_extract.h
|
||||
intern/draw_cache_extract.hh
|
||||
intern/draw_cache_impl.h
|
||||
intern/draw_cache_inline.h
|
||||
intern/draw_color_management.h
|
||||
|
@ -221,7 +221,7 @@ set(SRC
|
|||
intern/draw_texture_pool.h
|
||||
intern/draw_view.h
|
||||
intern/draw_view_data.h
|
||||
intern/mesh_extractors/extract_mesh.h
|
||||
intern/mesh_extractors/extract_mesh.hh
|
||||
intern/smaa_textures.h
|
||||
engines/basic/basic_engine.h
|
||||
engines/basic/basic_private.h
|
||||
|
|
|
@ -84,9 +84,9 @@ DRW_AttributeRequest *drw_attributes_add_request(DRW_Attributes *attrs,
|
|||
bool drw_custom_data_match_attribute(const CustomData *custom_data,
|
||||
const char *name,
|
||||
int *r_layer_index,
|
||||
int *r_type)
|
||||
eCustomDataType *r_type)
|
||||
{
|
||||
const int possible_attribute_types[7] = {
|
||||
const eCustomDataType possible_attribute_types[7] = {
|
||||
CD_PROP_BOOL,
|
||||
CD_PROP_INT8,
|
||||
CD_PROP_INT32,
|
||||
|
@ -97,7 +97,7 @@ bool drw_custom_data_match_attribute(const CustomData *custom_data,
|
|||
};
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(possible_attribute_types); i++) {
|
||||
const int attr_type = possible_attribute_types[i];
|
||||
const eCustomDataType attr_type = possible_attribute_types[i];
|
||||
int layer_index = CustomData_get_named_layer(custom_data, attr_type, name);
|
||||
if (layer_index == -1) {
|
||||
continue;
|
||||
|
|
|
@ -53,7 +53,7 @@ DRW_AttributeRequest *drw_attributes_add_request(DRW_Attributes *attrs,
|
|||
bool drw_custom_data_match_attribute(const CustomData *custom_data,
|
||||
const char *name,
|
||||
int *r_layer_index,
|
||||
int *r_type);
|
||||
eCustomDataType *r_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -7,11 +7,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
struct DRWSubdivCache;
|
||||
struct MeshRenderData;
|
||||
struct TaskGraph;
|
||||
#include <algorithm>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_customdata_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_view3d_enums.h"
|
||||
|
||||
#include "BKE_attribute.h"
|
||||
#include "BKE_object.h"
|
||||
|
@ -22,8 +24,12 @@ struct TaskGraph;
|
|||
|
||||
#include "draw_attributes.h"
|
||||
|
||||
struct DRWSubdivCache;
|
||||
struct MeshRenderData;
|
||||
struct TaskGraph;
|
||||
|
||||
/* Vertex Group Selection and display options */
|
||||
typedef struct DRW_MeshWeightState {
|
||||
struct DRW_MeshWeightState {
|
||||
int defgroup_active;
|
||||
int defgroup_len;
|
||||
|
||||
|
@ -37,7 +43,7 @@ typedef struct DRW_MeshWeightState {
|
|||
/* Set of all locked and unlocked deform bones for Lock Relative mode. */
|
||||
bool *defgroup_locked; /* [defgroup_len] */
|
||||
bool *defgroup_unlocked; /* [defgroup_len] */
|
||||
} DRW_MeshWeightState;
|
||||
};
|
||||
|
||||
/* DRW_MeshWeightState.flags */
|
||||
enum {
|
||||
|
@ -46,7 +52,7 @@ enum {
|
|||
DRW_MESH_WEIGHT_STATE_LOCK_RELATIVE = (1 << 2),
|
||||
};
|
||||
|
||||
typedef struct DRW_MeshCDMask {
|
||||
struct DRW_MeshCDMask {
|
||||
uint32_t uv : 8;
|
||||
uint32_t tan : 8;
|
||||
uint32_t vcol : 8;
|
||||
|
@ -56,20 +62,20 @@ typedef struct DRW_MeshCDMask {
|
|||
/** Edit uv layer is from the base edit mesh as
|
||||
* modifiers could remove it. (see T68857) */
|
||||
uint32_t edit_uv : 1;
|
||||
} DRW_MeshCDMask;
|
||||
};
|
||||
/* Keep `DRW_MeshCDMask` struct within an `uint32_t`.
|
||||
* bit-wise and atomic operations are used to compare and update the struct.
|
||||
* See `mesh_cd_layers_type_*` functions. */
|
||||
BLI_STATIC_ASSERT(sizeof(DRW_MeshCDMask) <= sizeof(uint32_t), "DRW_MeshCDMask exceeds 32 bits")
|
||||
typedef enum eMRIterType {
|
||||
enum eMRIterType {
|
||||
MR_ITER_LOOPTRI = 1 << 0,
|
||||
MR_ITER_POLY = 1 << 1,
|
||||
MR_ITER_LEDGE = 1 << 2,
|
||||
MR_ITER_LVERT = 1 << 3,
|
||||
} eMRIterType;
|
||||
};
|
||||
ENUM_OPERATORS(eMRIterType, MR_ITER_LVERT)
|
||||
|
||||
typedef enum eMRDataType {
|
||||
enum eMRDataType {
|
||||
MR_DATA_NONE = 0,
|
||||
MR_DATA_POLY_NOR = 1 << 1,
|
||||
MR_DATA_LOOP_NOR = 1 << 2,
|
||||
|
@ -78,25 +84,37 @@ typedef enum eMRDataType {
|
|||
/** Force loop normals calculation. */
|
||||
MR_DATA_TAN_LOOP_NOR = 1 << 5,
|
||||
MR_DATA_POLYS_SORTED = 1 << 6,
|
||||
} eMRDataType;
|
||||
};
|
||||
ENUM_OPERATORS(eMRDataType, MR_DATA_POLYS_SORTED)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
BLI_INLINE int mesh_render_mat_len_get(const Object *object, const Mesh *me)
|
||||
{
|
||||
if (me->edit_mesh != NULL) {
|
||||
const Mesh *editmesh_eval_final = BKE_object_get_editmesh_eval_final(object);
|
||||
if (editmesh_eval_final != NULL) {
|
||||
return MAX2(1, editmesh_eval_final->totcol);
|
||||
return std::max<int>(1, editmesh_eval_final->totcol);
|
||||
}
|
||||
}
|
||||
return MAX2(1, me->totcol);
|
||||
return std::max<int>(1, me->totcol);
|
||||
}
|
||||
|
||||
typedef struct MeshBufferList {
|
||||
struct MeshBufferList {
|
||||
|
||||
// enum class BufferItem {
|
||||
// PosNor,
|
||||
// LNor,
|
||||
// EdgeFac,
|
||||
// Weights,
|
||||
// UV,
|
||||
// Tan,
|
||||
// VCol,
|
||||
// SculptData,
|
||||
// Orco,
|
||||
// EditData,
|
||||
// EditUVData,
|
||||
// EditUVStretchArea,
|
||||
|
||||
// }
|
||||
/* Every VBO below contains at least enough
|
||||
* data for every loops in the mesh (except fdots and skin roots).
|
||||
* For some VBOs, it extends to (in this exact order) :
|
||||
|
@ -148,9 +166,9 @@ typedef struct MeshBufferList {
|
|||
GPUIndexBuf *edituv_points;
|
||||
GPUIndexBuf *edituv_fdots;
|
||||
} ibo;
|
||||
} MeshBufferList;
|
||||
};
|
||||
|
||||
typedef struct MeshBatchList {
|
||||
struct MeshBatchList {
|
||||
/* Surfaces / Render */
|
||||
GPUBatch *surface;
|
||||
GPUBatch *surface_weights;
|
||||
|
@ -184,7 +202,7 @@ typedef struct MeshBatchList {
|
|||
GPUBatch *wire_loops; /* Loops around faces. no edges between selected faces */
|
||||
GPUBatch *wire_loops_uvs; /* Same as wire_loops but only has uvs. */
|
||||
GPUBatch *sculpt_overlays;
|
||||
} MeshBatchList;
|
||||
};
|
||||
|
||||
#define MBC_BATCH_LEN (sizeof(MeshBatchList) / sizeof(void *))
|
||||
#define MBC_VBO_LEN (sizeof(((MeshBufferList){0}).vbo) / sizeof(void *))
|
||||
|
@ -192,7 +210,7 @@ typedef struct MeshBatchList {
|
|||
|
||||
#define MBC_BATCH_INDEX(batch) (offsetof(MeshBatchList, batch) / sizeof(void *))
|
||||
|
||||
typedef enum DRWBatchFlag {
|
||||
enum DRWBatchFlag {
|
||||
MBC_SURFACE = (1u << MBC_BATCH_INDEX(surface)),
|
||||
MBC_SURFACE_WEIGHTS = (1u << MBC_BATCH_INDEX(surface_weights)),
|
||||
MBC_EDIT_TRIANGLES = (1u << MBC_BATCH_INDEX(edit_triangles)),
|
||||
|
@ -221,23 +239,25 @@ typedef enum DRWBatchFlag {
|
|||
MBC_WIRE_LOOPS = (1u << MBC_BATCH_INDEX(wire_loops)),
|
||||
MBC_WIRE_LOOPS_UVS = (1u << MBC_BATCH_INDEX(wire_loops_uvs)),
|
||||
MBC_SCULPT_OVERLAYS = (1u << MBC_BATCH_INDEX(sculpt_overlays)),
|
||||
} DRWBatchFlag;
|
||||
MBC_SURFACE_PER_MAT = (1u << MBC_BATCH_LEN),
|
||||
};
|
||||
ENUM_OPERATORS(DRWBatchFlag, MBC_SURFACE_PER_MAT);
|
||||
|
||||
BLI_STATIC_ASSERT(MBC_BATCH_LEN < 32, "Number of batches exceeded the limit of bit fields");
|
||||
|
||||
typedef struct MeshExtractLooseGeom {
|
||||
struct MeshExtractLooseGeom {
|
||||
int edge_len;
|
||||
int vert_len;
|
||||
int *verts;
|
||||
int *edges;
|
||||
} MeshExtractLooseGeom;
|
||||
};
|
||||
|
||||
/**
|
||||
* Data that are kept around between extractions to reduce rebuilding time.
|
||||
*
|
||||
* - Loose geometry.
|
||||
*/
|
||||
typedef struct MeshBufferCache {
|
||||
struct MeshBufferCache {
|
||||
MeshBufferList buff;
|
||||
|
||||
MeshExtractLooseGeom loose_geom;
|
||||
|
@ -247,7 +267,7 @@ typedef struct MeshBufferCache {
|
|||
int *mat_tri_len;
|
||||
int visible_tri_len;
|
||||
} poly_sorted;
|
||||
} MeshBufferCache;
|
||||
};
|
||||
|
||||
#define FOREACH_MESH_BUFFER_CACHE(batch_cache, mbc) \
|
||||
for (MeshBufferCache *mbc = &batch_cache->final; \
|
||||
|
@ -256,7 +276,7 @@ typedef struct MeshBufferCache {
|
|||
&batch_cache->cage : \
|
||||
((mbc == &batch_cache->cage) ? &batch_cache->uv_cage : NULL))
|
||||
|
||||
typedef struct MeshBatchCache {
|
||||
struct MeshBatchCache {
|
||||
MeshBufferCache final, cage, uv_cage;
|
||||
|
||||
MeshBatchList batch;
|
||||
|
@ -302,12 +322,14 @@ typedef struct MeshBatchCache {
|
|||
|
||||
eV3DShadingColorType color_type;
|
||||
bool pbvh_is_drawing;
|
||||
} MeshBatchCache;
|
||||
};
|
||||
|
||||
#define MBC_EDITUV \
|
||||
(MBC_EDITUV_FACES_STRETCH_AREA | MBC_EDITUV_FACES_STRETCH_ANGLE | MBC_EDITUV_FACES | \
|
||||
MBC_EDITUV_EDGES | MBC_EDITUV_VERTS | MBC_EDITUV_FACEDOTS | MBC_WIRE_LOOPS_UVS)
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
|
||||
MeshBatchCache *cache,
|
||||
MeshBufferCache *mbc,
|
||||
|
@ -328,6 +350,4 @@ void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache,
|
|||
struct DRWSubdivCache *subdiv_cache,
|
||||
struct MeshRenderData *mr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
} // namespace blender::draw
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
#include "GPU_capabilities.h"
|
||||
|
||||
#include "draw_cache_extract.h"
|
||||
#include "draw_cache_extract.hh"
|
||||
#include "draw_cache_inline.h"
|
||||
#include "draw_subdivision.h"
|
||||
|
||||
#include "mesh_extractors/extract_mesh.h"
|
||||
#include "mesh_extractors/extract_mesh.hh"
|
||||
|
||||
// #define DEBUG_TIME
|
||||
|
||||
|
@ -551,21 +551,21 @@ static struct TaskNode *mesh_extract_render_data_node_create(struct TaskGraph *t
|
|||
/** \name Extract Loop
|
||||
* \{ */
|
||||
|
||||
static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
|
||||
MeshBatchCache *cache,
|
||||
MeshBufferCache *mbc,
|
||||
Object *object,
|
||||
Mesh *me,
|
||||
void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
|
||||
MeshBatchCache *cache,
|
||||
MeshBufferCache *mbc,
|
||||
Object *object,
|
||||
Mesh *me,
|
||||
|
||||
const bool is_editmode,
|
||||
const bool is_paint_mode,
|
||||
const bool is_mode_active,
|
||||
const float obmat[4][4],
|
||||
const bool do_final,
|
||||
const bool do_uvedit,
|
||||
const Scene *scene,
|
||||
const ToolSettings *ts,
|
||||
const bool use_hide)
|
||||
const bool is_editmode,
|
||||
const bool is_paint_mode,
|
||||
const bool is_mode_active,
|
||||
const float obmat[4][4],
|
||||
const bool do_final,
|
||||
const bool do_uvedit,
|
||||
const Scene *scene,
|
||||
const ToolSettings *ts,
|
||||
const bool use_hide)
|
||||
{
|
||||
/* For each mesh where batches needs to be updated a sub-graph will be added to the task_graph.
|
||||
* This sub-graph starts with an extract_render_data_node. This fills/converts the required
|
||||
|
@ -772,10 +772,10 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
|
|||
/** \name Subdivision Extract Loop
|
||||
* \{ */
|
||||
|
||||
static void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache,
|
||||
MeshBufferCache *mbc,
|
||||
DRWSubdivCache *subdiv_cache,
|
||||
MeshRenderData *mr)
|
||||
void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache,
|
||||
MeshBufferCache *mbc,
|
||||
DRWSubdivCache *subdiv_cache,
|
||||
MeshRenderData *mr)
|
||||
{
|
||||
/* Create an array containing all the extractors that needs to be executed. */
|
||||
ExtractorRunDatas extractors;
|
||||
|
@ -908,46 +908,3 @@ static void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache,
|
|||
/** \} */
|
||||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
|
||||
MeshBatchCache *cache,
|
||||
MeshBufferCache *mbc,
|
||||
Object *object,
|
||||
Mesh *me,
|
||||
|
||||
const bool is_editmode,
|
||||
const bool is_paint_mode,
|
||||
const bool is_mode_active,
|
||||
const float obmat[4][4],
|
||||
const bool do_final,
|
||||
const bool do_uvedit,
|
||||
const Scene *scene,
|
||||
const ToolSettings *ts,
|
||||
const bool use_hide)
|
||||
{
|
||||
blender::draw::mesh_buffer_cache_create_requested(task_graph,
|
||||
cache,
|
||||
mbc,
|
||||
object,
|
||||
me,
|
||||
is_editmode,
|
||||
is_paint_mode,
|
||||
is_mode_active,
|
||||
obmat,
|
||||
do_final,
|
||||
do_uvedit,
|
||||
scene,
|
||||
ts,
|
||||
use_hide);
|
||||
}
|
||||
|
||||
void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache,
|
||||
MeshBufferCache *mbc,
|
||||
DRWSubdivCache *subdiv_cache,
|
||||
MeshRenderData *mr)
|
||||
{
|
||||
blender::draw::mesh_buffer_cache_create_requested_subdiv(cache, mbc, subdiv_cache, mr);
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_alloca.h"
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_bitmap.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_task.h"
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "ED_mesh.h"
|
||||
|
||||
#include "mesh_extractors/extract_mesh.h"
|
||||
#include "mesh_extractors/extract_mesh.hh"
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Update Loose Geometry
|
||||
|
@ -78,7 +78,8 @@ static void mesh_render_data_loose_geom_mesh(const MeshRenderData *mr, MeshBuffe
|
|||
{
|
||||
BLI_bitmap *lvert_map = BLI_BITMAP_NEW(mr->vert_len, __func__);
|
||||
|
||||
cache->loose_geom.edges = MEM_mallocN(mr->edge_len * sizeof(*cache->loose_geom.edges), __func__);
|
||||
cache->loose_geom.edges = static_cast<int *>(
|
||||
MEM_mallocN(mr->edge_len * sizeof(*cache->loose_geom.edges), __func__));
|
||||
const MEdge *med = mr->medge;
|
||||
for (int med_index = 0; med_index < mr->edge_len; med_index++, med++) {
|
||||
if (med->flag & ME_LOOSEEDGE) {
|
||||
|
@ -89,19 +90,20 @@ static void mesh_render_data_loose_geom_mesh(const MeshRenderData *mr, MeshBuffe
|
|||
BLI_BITMAP_ENABLE(lvert_map, med->v2);
|
||||
}
|
||||
if (cache->loose_geom.edge_len < mr->edge_len) {
|
||||
cache->loose_geom.edges = MEM_reallocN(
|
||||
cache->loose_geom.edges, cache->loose_geom.edge_len * sizeof(*cache->loose_geom.edges));
|
||||
cache->loose_geom.edges = static_cast<int *>(MEM_reallocN(
|
||||
cache->loose_geom.edges, cache->loose_geom.edge_len * sizeof(*cache->loose_geom.edges)));
|
||||
}
|
||||
|
||||
cache->loose_geom.verts = MEM_mallocN(mr->vert_len * sizeof(*cache->loose_geom.verts), __func__);
|
||||
cache->loose_geom.verts = static_cast<int *>(
|
||||
MEM_mallocN(mr->vert_len * sizeof(*cache->loose_geom.verts), __func__));
|
||||
for (int v = 0; v < mr->vert_len; v++) {
|
||||
if (!BLI_BITMAP_TEST(lvert_map, v)) {
|
||||
cache->loose_geom.verts[cache->loose_geom.vert_len++] = v;
|
||||
}
|
||||
}
|
||||
if (cache->loose_geom.vert_len < mr->vert_len) {
|
||||
cache->loose_geom.verts = MEM_reallocN(
|
||||
cache->loose_geom.verts, cache->loose_geom.vert_len * sizeof(*cache->loose_geom.verts));
|
||||
cache->loose_geom.verts = static_cast<int *>(MEM_reallocN(
|
||||
cache->loose_geom.verts, cache->loose_geom.vert_len * sizeof(*cache->loose_geom.verts)));
|
||||
}
|
||||
|
||||
MEM_freeN(lvert_map);
|
||||
|
@ -112,15 +114,16 @@ static void mesh_render_data_lverts_bm(const MeshRenderData *mr, MeshBufferCache
|
|||
int elem_id;
|
||||
BMIter iter;
|
||||
BMVert *eve;
|
||||
cache->loose_geom.verts = MEM_mallocN(mr->vert_len * sizeof(*cache->loose_geom.verts), __func__);
|
||||
cache->loose_geom.verts = static_cast<int *>(
|
||||
MEM_mallocN(mr->vert_len * sizeof(*cache->loose_geom.verts), __func__));
|
||||
BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, elem_id) {
|
||||
if (eve->e == NULL) {
|
||||
cache->loose_geom.verts[cache->loose_geom.vert_len++] = elem_id;
|
||||
}
|
||||
}
|
||||
if (cache->loose_geom.vert_len < mr->vert_len) {
|
||||
cache->loose_geom.verts = MEM_reallocN(
|
||||
cache->loose_geom.verts, cache->loose_geom.vert_len * sizeof(*cache->loose_geom.verts));
|
||||
cache->loose_geom.verts = static_cast<int *>(MEM_reallocN(
|
||||
cache->loose_geom.verts, cache->loose_geom.vert_len * sizeof(*cache->loose_geom.verts)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,15 +132,16 @@ static void mesh_render_data_ledges_bm(const MeshRenderData *mr, MeshBufferCache
|
|||
int elem_id;
|
||||
BMIter iter;
|
||||
BMEdge *ede;
|
||||
cache->loose_geom.edges = MEM_mallocN(mr->edge_len * sizeof(*cache->loose_geom.edges), __func__);
|
||||
cache->loose_geom.edges = static_cast<int *>(
|
||||
MEM_mallocN(mr->edge_len * sizeof(*cache->loose_geom.edges), __func__));
|
||||
BM_ITER_MESH_INDEX (ede, &iter, bm, BM_EDGES_OF_MESH, elem_id) {
|
||||
if (ede->l == NULL) {
|
||||
cache->loose_geom.edges[cache->loose_geom.edge_len++] = elem_id;
|
||||
}
|
||||
}
|
||||
if (cache->loose_geom.edge_len < mr->edge_len) {
|
||||
cache->loose_geom.edges = MEM_reallocN(
|
||||
cache->loose_geom.edges, cache->loose_geom.edge_len * sizeof(*cache->loose_geom.edges));
|
||||
cache->loose_geom.edges = static_cast<int *>(MEM_reallocN(
|
||||
cache->loose_geom.edges, cache->loose_geom.edge_len * sizeof(*cache->loose_geom.edges)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,12 +196,13 @@ static void mesh_render_data_polys_sorted_ensure(MeshRenderData *mr, MeshBufferC
|
|||
|
||||
static void mesh_render_data_polys_sorted_build(MeshRenderData *mr, MeshBufferCache *cache)
|
||||
{
|
||||
int *tri_first_index = MEM_mallocN(sizeof(*tri_first_index) * mr->poly_len, __func__);
|
||||
int *tri_first_index = static_cast<int *>(
|
||||
MEM_mallocN(sizeof(*tri_first_index) * mr->poly_len, __func__));
|
||||
int *mat_tri_len = mesh_render_data_mat_tri_len_build(mr);
|
||||
|
||||
/* Apply offset. */
|
||||
int visible_tri_len = 0;
|
||||
int *mat_tri_offs = BLI_array_alloca(mat_tri_offs, mr->mat_len);
|
||||
blender::Array<int, 32> mat_tri_offs(mr->mat_len);
|
||||
{
|
||||
for (int i = 0; i < mr->mat_len; i++) {
|
||||
mat_tri_offs[i] = visible_tri_len;
|
||||
|
@ -245,8 +250,8 @@ static void mesh_render_data_mat_tri_len_bm_range_fn(void *__restrict userdata,
|
|||
const int iter,
|
||||
const TaskParallelTLS *__restrict tls)
|
||||
{
|
||||
MeshRenderData *mr = userdata;
|
||||
int *mat_tri_len = tls->userdata_chunk;
|
||||
MeshRenderData *mr = static_cast<MeshRenderData *>(userdata);
|
||||
int *mat_tri_len = static_cast<int *>(tls->userdata_chunk);
|
||||
|
||||
BMesh *bm = mr->bm;
|
||||
BMFace *efa = BM_face_at_index(bm, iter);
|
||||
|
@ -260,8 +265,8 @@ static void mesh_render_data_mat_tri_len_mesh_range_fn(void *__restrict userdata
|
|||
const int iter,
|
||||
const TaskParallelTLS *__restrict tls)
|
||||
{
|
||||
MeshRenderData *mr = userdata;
|
||||
int *mat_tri_len = tls->userdata_chunk;
|
||||
MeshRenderData *mr = static_cast<MeshRenderData *>(userdata);
|
||||
int *mat_tri_len = static_cast<int *>(tls->userdata_chunk);
|
||||
|
||||
const MPoly *mp = &mr->mpoly[iter];
|
||||
if (!(mr->use_hide && (mp->flag & ME_HIDE))) {
|
||||
|
@ -274,9 +279,9 @@ static void mesh_render_data_mat_tri_len_reduce_fn(const void *__restrict userda
|
|||
void *__restrict chunk_join,
|
||||
void *__restrict chunk)
|
||||
{
|
||||
const MeshRenderData *mr = userdata;
|
||||
int *dst_mat_len = chunk_join;
|
||||
int *src_mat_len = chunk;
|
||||
const MeshRenderData *mr = static_cast<const MeshRenderData *>(userdata);
|
||||
int *dst_mat_len = static_cast<int *>(chunk_join);
|
||||
int *src_mat_len = static_cast<int *>(chunk);
|
||||
for (int i = 0; i < mr->mat_len; i++) {
|
||||
dst_mat_len[i] += src_mat_len[i];
|
||||
}
|
||||
|
@ -288,7 +293,7 @@ static int *mesh_render_data_mat_tri_len_build_threaded(MeshRenderData *mr,
|
|||
{
|
||||
/* Extending the #MatOffsetUserData with an int per material slot. */
|
||||
size_t mat_tri_len_size = sizeof(int) * mr->mat_len;
|
||||
int *mat_tri_len = MEM_callocN(mat_tri_len_size, __func__);
|
||||
int *mat_tri_len = static_cast<int *>(MEM_callocN(mat_tri_len_size, __func__));
|
||||
|
||||
TaskParallelSettings settings;
|
||||
BLI_parallel_range_settings_defaults(&settings);
|
||||
|
@ -330,7 +335,8 @@ void mesh_render_data_update_looptris(MeshRenderData *mr,
|
|||
/* NOTE(campbell): It's possible to skip allocating tessellation,
|
||||
* the tessellation can be calculated as part of the iterator, see: P2188.
|
||||
* The overall advantage is small (around 1%), so keep this as-is. */
|
||||
mr->mlooptri = MEM_mallocN(sizeof(*mr->mlooptri) * mr->tri_len, "MR_DATATYPE_LOOPTRI");
|
||||
mr->mlooptri = static_cast<MLoopTri *>(
|
||||
MEM_mallocN(sizeof(*mr->mlooptri) * mr->tri_len, "MR_DATATYPE_LOOPTRI"));
|
||||
if (mr->poly_normals != NULL) {
|
||||
BKE_mesh_recalc_looptri_with_normals(me->mloop,
|
||||
me->mpoly,
|
||||
|
@ -368,8 +374,10 @@ void mesh_render_data_update_normals(MeshRenderData *mr, const eMRDataType data_
|
|||
mr->poly_normals = BKE_mesh_poly_normals_ensure(mr->me);
|
||||
}
|
||||
if (((data_flag & MR_DATA_LOOP_NOR) && is_auto_smooth) || (data_flag & MR_DATA_TAN_LOOP_NOR)) {
|
||||
mr->loop_normals = MEM_mallocN(sizeof(*mr->loop_normals) * mr->loop_len, __func__);
|
||||
short(*clnors)[2] = CustomData_get_layer(&mr->me->ldata, CD_CUSTOMLOOPNORMAL);
|
||||
mr->loop_normals = static_cast<float(*)[3]>(
|
||||
MEM_mallocN(sizeof(*mr->loop_normals) * mr->loop_len, __func__));
|
||||
short(*clnors)[2] = static_cast<short(*)[2]>(
|
||||
CustomData_get_layer(&mr->me->ldata, CD_CUSTOMLOOPNORMAL));
|
||||
BKE_mesh_normals_loop_split(mr->me->mvert,
|
||||
mr->vert_normals,
|
||||
mr->vert_len,
|
||||
|
@ -405,7 +413,8 @@ void mesh_render_data_update_normals(MeshRenderData *mr, const eMRDataType data_
|
|||
poly_normals = mr->bm_poly_normals;
|
||||
}
|
||||
|
||||
mr->loop_normals = MEM_mallocN(sizeof(*mr->loop_normals) * mr->loop_len, __func__);
|
||||
mr->loop_normals = static_cast<float(*)[3]>(
|
||||
MEM_mallocN(sizeof(*mr->loop_normals) * mr->loop_len, __func__));
|
||||
const int clnors_offset = CustomData_get_offset(&mr->bm->ldata, CD_CUSTOMLOOPNORMAL);
|
||||
BM_loops_calc_normal_vcos(mr->bm,
|
||||
vert_coords,
|
||||
|
@ -432,7 +441,7 @@ MeshRenderData *mesh_render_data_create(Object *object,
|
|||
const bool do_uvedit,
|
||||
const ToolSettings *ts)
|
||||
{
|
||||
MeshRenderData *mr = MEM_callocN(sizeof(*mr), __func__);
|
||||
MeshRenderData *mr = static_cast<MeshRenderData *>(MEM_callocN(sizeof(*mr), __func__));
|
||||
mr->toolsettings = ts;
|
||||
mr->mat_len = mesh_render_mat_len_get(object, me);
|
||||
|
||||
|
@ -491,9 +500,12 @@ MeshRenderData *mesh_render_data_create(Object *object,
|
|||
#endif
|
||||
|
||||
if (use_mapped) {
|
||||
mr->v_origindex = CustomData_get_layer(&mr->me->vdata, CD_ORIGINDEX);
|
||||
mr->e_origindex = CustomData_get_layer(&mr->me->edata, CD_ORIGINDEX);
|
||||
mr->p_origindex = CustomData_get_layer(&mr->me->pdata, CD_ORIGINDEX);
|
||||
mr->v_origindex = static_cast<const int *>(
|
||||
CustomData_get_layer(&mr->me->vdata, CD_ORIGINDEX));
|
||||
mr->e_origindex = static_cast<const int *>(
|
||||
CustomData_get_layer(&mr->me->edata, CD_ORIGINDEX));
|
||||
mr->p_origindex = static_cast<const int *>(
|
||||
CustomData_get_layer(&mr->me->pdata, CD_ORIGINDEX));
|
||||
|
||||
use_mapped = (mr->v_origindex || mr->e_origindex || mr->p_origindex);
|
||||
}
|
||||
|
@ -513,9 +525,12 @@ MeshRenderData *mesh_render_data_create(Object *object,
|
|||
|
||||
bool use_mapped = is_paint_mode && mr->me && !mr->me->runtime.is_original;
|
||||
if (use_mapped) {
|
||||
mr->v_origindex = CustomData_get_layer(&mr->me->vdata, CD_ORIGINDEX);
|
||||
mr->e_origindex = CustomData_get_layer(&mr->me->edata, CD_ORIGINDEX);
|
||||
mr->p_origindex = CustomData_get_layer(&mr->me->pdata, CD_ORIGINDEX);
|
||||
mr->v_origindex = static_cast<const int *>(
|
||||
CustomData_get_layer(&mr->me->vdata, CD_ORIGINDEX));
|
||||
mr->e_origindex = static_cast<const int *>(
|
||||
CustomData_get_layer(&mr->me->edata, CD_ORIGINDEX));
|
||||
mr->p_origindex = static_cast<const int *>(
|
||||
CustomData_get_layer(&mr->me->pdata, CD_ORIGINDEX));
|
||||
|
||||
use_mapped = (mr->v_origindex || mr->e_origindex || mr->p_origindex);
|
||||
}
|
||||
|
@ -531,14 +546,14 @@ MeshRenderData *mesh_render_data_create(Object *object,
|
|||
mr->poly_len = mr->me->totpoly;
|
||||
mr->tri_len = poly_to_tri_count(mr->poly_len, mr->loop_len);
|
||||
|
||||
mr->mvert = CustomData_get_layer(&mr->me->vdata, CD_MVERT);
|
||||
mr->medge = CustomData_get_layer(&mr->me->edata, CD_MEDGE);
|
||||
mr->mloop = CustomData_get_layer(&mr->me->ldata, CD_MLOOP);
|
||||
mr->mpoly = CustomData_get_layer(&mr->me->pdata, CD_MPOLY);
|
||||
mr->mvert = static_cast<MVert *>(CustomData_get_layer(&mr->me->vdata, CD_MVERT));
|
||||
mr->medge = static_cast<MEdge *>(CustomData_get_layer(&mr->me->edata, CD_MEDGE));
|
||||
mr->mloop = static_cast<MLoop *>(CustomData_get_layer(&mr->me->ldata, CD_MLOOP));
|
||||
mr->mpoly = static_cast<MPoly *>(CustomData_get_layer(&mr->me->pdata, CD_MPOLY));
|
||||
|
||||
mr->v_origindex = CustomData_get_layer(&mr->me->vdata, CD_ORIGINDEX);
|
||||
mr->e_origindex = CustomData_get_layer(&mr->me->edata, CD_ORIGINDEX);
|
||||
mr->p_origindex = CustomData_get_layer(&mr->me->pdata, CD_ORIGINDEX);
|
||||
mr->v_origindex = static_cast<const int *>(CustomData_get_layer(&mr->me->vdata, CD_ORIGINDEX));
|
||||
mr->e_origindex = static_cast<const int *>(CustomData_get_layer(&mr->me->edata, CD_ORIGINDEX));
|
||||
mr->p_origindex = static_cast<const int *>(CustomData_get_layer(&mr->me->pdata, CD_ORIGINDEX));
|
||||
}
|
||||
else {
|
||||
/* #BMesh */
|
|
@ -512,7 +512,7 @@ static bool curves_ensure_attributes(const Curves &curves,
|
|||
ListBase gpu_attrs = GPU_material_attributes(gpu_material);
|
||||
LISTBASE_FOREACH (GPUMaterialAttribute *, gpu_attr, &gpu_attrs) {
|
||||
const char *name = gpu_attr->name;
|
||||
int type = gpu_attr->type;
|
||||
eCustomDataType type = static_cast<eCustomDataType>(gpu_attr->type);
|
||||
int layer = -1;
|
||||
eAttrDomain domain;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -39,10 +39,10 @@
|
|||
#include "opensubdiv_evaluator_capi.h"
|
||||
#include "opensubdiv_topology_refiner_capi.h"
|
||||
|
||||
#include "draw_cache_extract.h"
|
||||
#include "draw_cache_extract.hh"
|
||||
#include "draw_cache_impl.h"
|
||||
#include "draw_cache_inline.h"
|
||||
#include "mesh_extractors/extract_mesh.h"
|
||||
#include "mesh_extractors/extract_mesh.hh"
|
||||
|
||||
extern "C" char datatoc_common_subdiv_custom_data_interp_comp_glsl[];
|
||||
extern "C" char datatoc_common_subdiv_ibo_lines_comp_glsl[];
|
||||
|
@ -2099,7 +2099,7 @@ static bool draw_subdiv_create_requested_buffers(const Scene *scene,
|
|||
|
||||
draw_subdiv_cache_update_extra_coarse_face_data(draw_cache, mesh_eval, mr);
|
||||
|
||||
mesh_buffer_cache_create_requested_subdiv(batch_cache, mbc, draw_cache, mr);
|
||||
blender::draw::mesh_buffer_cache_create_requested_subdiv(batch_cache, mbc, draw_cache, mr);
|
||||
|
||||
mesh_render_data_free(mr);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "ED_uvedit.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_cache_impl.h"
|
||||
|
||||
|
@ -29,7 +29,7 @@ void *mesh_extract_buffer_get(const MeshExtract *extractor, MeshBufferList *mbuf
|
|||
|
||||
eMRIterType mesh_extract_iter_type(const MeshExtract *ext)
|
||||
{
|
||||
eMRIterType type = 0;
|
||||
eMRIterType type = (eMRIterType)0;
|
||||
SET_FLAG_FROM_TEST(type, (ext->iter_looptri_bm || ext->iter_looptri_mesh), MR_ITER_LOOPTRI);
|
||||
SET_FLAG_FROM_TEST(type, (ext->iter_poly_bm || ext->iter_poly_mesh), MR_ITER_POLY);
|
||||
SET_FLAG_FROM_TEST(type, (ext->iter_ledge_bm || ext->iter_ledge_mesh), MR_ITER_LEDGE);
|
|
@ -17,11 +17,7 @@
|
|||
#include "BKE_customdata.h"
|
||||
#include "BKE_editmesh.h"
|
||||
|
||||
#include "draw_cache_extract.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "draw_cache_extract.hh"
|
||||
|
||||
struct DRWSubdivCache;
|
||||
|
||||
|
@ -31,13 +27,13 @@ struct DRWSubdivCache;
|
|||
/** \name Mesh Render Data
|
||||
* \{ */
|
||||
|
||||
typedef enum eMRExtractType {
|
||||
enum eMRExtractType {
|
||||
MR_EXTRACT_BMESH,
|
||||
MR_EXTRACT_MAPPED,
|
||||
MR_EXTRACT_MESH,
|
||||
} eMRExtractType;
|
||||
};
|
||||
|
||||
typedef struct MeshRenderData {
|
||||
struct MeshRenderData {
|
||||
eMRExtractType extract_type;
|
||||
|
||||
int poly_len, edge_len, vert_len, loop_len;
|
||||
|
@ -95,7 +91,7 @@ typedef struct MeshRenderData {
|
|||
int *mat_tri_len;
|
||||
int visible_tri_len;
|
||||
} poly_sorted;
|
||||
} MeshRenderData;
|
||||
};
|
||||
|
||||
BLI_INLINE BMFace *bm_original_face_get(const MeshRenderData *mr, int idx)
|
||||
{
|
||||
|
@ -159,71 +155,71 @@ BLI_INLINE const float *bm_face_no_get(const MeshRenderData *mr, const BMFace *e
|
|||
|
||||
/* TODO(jbakker): move parameters inside a struct. */
|
||||
|
||||
typedef void(ExtractTriBMeshFn)(const MeshRenderData *mr, BMLoop **elt, int elt_index, void *data);
|
||||
typedef void(ExtractTriMeshFn)(const MeshRenderData *mr,
|
||||
const MLoopTri *mlt,
|
||||
int elt_index,
|
||||
void *data);
|
||||
typedef void(ExtractPolyBMeshFn)(const MeshRenderData *mr,
|
||||
const BMFace *f,
|
||||
int f_index,
|
||||
void *data);
|
||||
typedef void(ExtractPolyMeshFn)(const MeshRenderData *mr,
|
||||
const MPoly *mp,
|
||||
int mp_index,
|
||||
using ExtractTriBMeshFn = void(const MeshRenderData *mr, BMLoop **elt, int elt_index, void *data);
|
||||
using ExtractTriMeshFn = void(const MeshRenderData *mr,
|
||||
const MLoopTri *mlt,
|
||||
int elt_index,
|
||||
void *data);
|
||||
using ExtractPolyBMeshFn = void(const MeshRenderData *mr,
|
||||
const BMFace *f,
|
||||
int f_index,
|
||||
void *data);
|
||||
typedef void(ExtractLEdgeBMeshFn)(const MeshRenderData *mr,
|
||||
const BMEdge *eed,
|
||||
int ledge_index,
|
||||
void *data);
|
||||
typedef void(ExtractLEdgeMeshFn)(const MeshRenderData *mr,
|
||||
const MEdge *med,
|
||||
using ExtractPolyMeshFn = void(const MeshRenderData *mr,
|
||||
const MPoly *mp,
|
||||
int mp_index,
|
||||
void *data);
|
||||
using ExtractLEdgeBMeshFn = void(const MeshRenderData *mr,
|
||||
const BMEdge *eed,
|
||||
int ledge_index,
|
||||
void *data);
|
||||
typedef void(ExtractLVertBMeshFn)(const MeshRenderData *mr,
|
||||
const BMVert *eve,
|
||||
int lvert_index,
|
||||
void *data);
|
||||
typedef void(ExtractLVertMeshFn)(const MeshRenderData *mr,
|
||||
const MVert *mv,
|
||||
using ExtractLEdgeMeshFn = void(const MeshRenderData *mr,
|
||||
const MEdge *med,
|
||||
int ledge_index,
|
||||
void *data);
|
||||
using ExtractLVertBMeshFn = void(const MeshRenderData *mr,
|
||||
const BMVert *eve,
|
||||
int lvert_index,
|
||||
void *data);
|
||||
typedef void(ExtractLooseGeomSubdivFn)(const struct DRWSubdivCache *subdiv_cache,
|
||||
const MeshRenderData *mr,
|
||||
void *buffer,
|
||||
void *data);
|
||||
typedef void(ExtractInitFn)(const MeshRenderData *mr,
|
||||
struct MeshBatchCache *cache,
|
||||
void *buffer,
|
||||
void *r_data);
|
||||
typedef void(ExtractFinishFn)(const MeshRenderData *mr,
|
||||
struct MeshBatchCache *cache,
|
||||
void *buffer,
|
||||
void *data);
|
||||
typedef void(ExtractTaskReduceFn)(void *userdata, void *task_userdata);
|
||||
using ExtractLVertMeshFn = void(const MeshRenderData *mr,
|
||||
const MVert *mv,
|
||||
int lvert_index,
|
||||
void *data);
|
||||
using ExtractLooseGeomSubdivFn = void(const struct DRWSubdivCache *subdiv_cache,
|
||||
const MeshRenderData *mr,
|
||||
void *buffer,
|
||||
void *data);
|
||||
using ExtractInitFn = void(const MeshRenderData *mr,
|
||||
struct MeshBatchCache *cache,
|
||||
void *buffer,
|
||||
void *r_data);
|
||||
using ExtractFinishFn = void(const MeshRenderData *mr,
|
||||
struct MeshBatchCache *cache,
|
||||
void *buffer,
|
||||
void *data);
|
||||
using ExtractTaskReduceFn = void(void *userdata, void *task_userdata);
|
||||
|
||||
typedef void(ExtractInitSubdivFn)(const struct DRWSubdivCache *subdiv_cache,
|
||||
const MeshRenderData *mr,
|
||||
struct MeshBatchCache *cache,
|
||||
void *buf,
|
||||
void *data);
|
||||
typedef void(ExtractIterSubdivBMeshFn)(const struct DRWSubdivCache *subdiv_cache,
|
||||
const MeshRenderData *mr,
|
||||
void *data,
|
||||
uint subdiv_quad_index,
|
||||
const BMFace *coarse_quad);
|
||||
typedef void(ExtractIterSubdivMeshFn)(const struct DRWSubdivCache *subdiv_cache,
|
||||
using ExtractInitSubdivFn = void(const struct DRWSubdivCache *subdiv_cache,
|
||||
const MeshRenderData *mr,
|
||||
struct MeshBatchCache *cache,
|
||||
void *buf,
|
||||
void *data);
|
||||
using ExtractIterSubdivBMeshFn = void(const struct DRWSubdivCache *subdiv_cache,
|
||||
const MeshRenderData *mr,
|
||||
void *data,
|
||||
uint subdiv_quad_index,
|
||||
const MPoly *coarse_quad);
|
||||
typedef void(ExtractFinishSubdivFn)(const struct DRWSubdivCache *subdiv_cache,
|
||||
const MeshRenderData *mr,
|
||||
struct MeshBatchCache *cache,
|
||||
void *buf,
|
||||
void *data);
|
||||
const BMFace *coarse_quad);
|
||||
using ExtractIterSubdivMeshFn = void(const struct DRWSubdivCache *subdiv_cache,
|
||||
const MeshRenderData *mr,
|
||||
void *data,
|
||||
uint subdiv_quad_index,
|
||||
const MPoly *coarse_quad);
|
||||
using ExtractFinishSubdivFn = void(const struct DRWSubdivCache *subdiv_cache,
|
||||
const MeshRenderData *mr,
|
||||
struct MeshBatchCache *cache,
|
||||
void *buf,
|
||||
void *data);
|
||||
|
||||
typedef struct MeshExtract {
|
||||
struct MeshExtract {
|
||||
/** Executed on main thread and return user data for iteration functions. */
|
||||
ExtractInitFn *init;
|
||||
/** Executed on one (or more if use_threading) worker thread(s). */
|
||||
|
@ -254,7 +250,7 @@ typedef struct MeshExtract {
|
|||
* buffer.
|
||||
*/
|
||||
size_t mesh_buffer_offset;
|
||||
} MeshExtract;
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
|
@ -291,14 +287,14 @@ void mesh_render_data_update_looptris(MeshRenderData *mr,
|
|||
|
||||
/* draw_cache_extract_mesh_extractors.c */
|
||||
|
||||
typedef struct EditLoopData {
|
||||
struct EditLoopData {
|
||||
uchar v_flag;
|
||||
uchar e_flag;
|
||||
/* This is used for both vertex and edge creases. The edge crease value is stored in the bottom 4
|
||||
* bits, while the vertex crease is stored in the upper 4 bits. */
|
||||
uchar crease;
|
||||
uchar bweight;
|
||||
} EditLoopData;
|
||||
};
|
||||
|
||||
void *mesh_extract_buffer_get(const MeshExtract *extractor, MeshBufferList *mbuflist);
|
||||
eMRIterType mesh_extract_iter_type(const MeshExtract *ext);
|
||||
|
@ -359,7 +355,3 @@ extern const MeshExtract extract_edge_idx;
|
|||
extern const MeshExtract extract_vert_idx;
|
||||
extern const MeshExtract extract_fdot_idx;
|
||||
extern const MeshExtract extract_attr[GPU_MAX_ATTR];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "BLI_bitmap.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
|
||||
|
@ -584,9 +584,7 @@ constexpr MeshExtract create_extractor_edituv_fdots()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_edituv_tris = blender::draw::create_extractor_edituv_tris();
|
||||
const MeshExtract extract_edituv_lines = blender::draw::create_extractor_edituv_lines();
|
||||
const MeshExtract extract_edituv_points = blender::draw::create_extractor_edituv_points();
|
||||
const MeshExtract extract_edituv_fdots = blender::draw::create_extractor_edituv_fdots();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "BLI_bitmap.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -95,6 +95,4 @@ constexpr MeshExtract create_extractor_fdots()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_fdots = blender::draw::create_extractor_fdots();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
|
||||
|
@ -320,9 +320,7 @@ constexpr MeshExtract create_extractor_lines_loose_only()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_lines = blender::draw::create_extractor_lines();
|
||||
const MeshExtract extract_lines_with_lines_loose =
|
||||
blender::draw::create_extractor_lines_with_lines_loose();
|
||||
const MeshExtract extract_lines_loose_only = blender::draw::create_extractor_lines_loose_only();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -253,6 +253,4 @@ constexpr MeshExtract create_extractor_lines_adjacency()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_lines_adjacency = blender::draw::create_extractor_lines_adjacency();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -181,6 +181,4 @@ constexpr MeshExtract create_extractor_lines_paint_mask()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_lines_paint_mask = blender::draw::create_extractor_lines_paint_mask();
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -322,6 +322,4 @@ constexpr MeshExtract create_extractor_points()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_points = blender::draw::create_extractor_points();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
|
||||
|
@ -243,7 +243,5 @@ constexpr MeshExtract create_extractor_tris_single_mat()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_tris = blender::draw::create_extractor_tris();
|
||||
const MeshExtract extract_tris_single_mat = blender::draw::create_extractor_tris_single_mat();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "draw_attributes.h"
|
||||
#include "draw_subdivision.h"
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -447,7 +447,6 @@ constexpr MeshExtract create_extractor_attr(ExtractInitFn fn, ExtractInitSubdivF
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
#define CREATE_EXTRACTOR_ATTR(index) \
|
||||
blender::draw::create_extractor_attr<index>(blender::draw::extract_attr_init##index, \
|
||||
blender::draw::extract_attr_init_subdiv##index)
|
||||
|
@ -469,4 +468,3 @@ const MeshExtract extract_attr[GPU_MAX_ATTR] = {
|
|||
CREATE_EXTRACTOR_ATTR(13),
|
||||
CREATE_EXTRACTOR_ATTR(14),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "GPU_capabilities.h"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -303,6 +303,4 @@ constexpr MeshExtract create_extractor_edge_fac()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_edge_fac = blender::draw::create_extractor_edge_fac();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_cache_impl.h"
|
||||
|
||||
|
@ -367,6 +367,4 @@ constexpr MeshExtract create_extractor_edit_data()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_edit_data = blender::draw::create_extractor_edit_data();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_cache_impl.h"
|
||||
|
||||
|
@ -199,6 +199,4 @@ constexpr MeshExtract create_extractor_edituv_data()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_edituv_data = blender::draw::create_extractor_edituv_data();
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "BKE_mesh.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
|
||||
|
@ -292,7 +292,5 @@ constexpr MeshExtract create_extractor_edituv_edituv_stretch_angle()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_edituv_stretch_angle =
|
||||
blender::draw::create_extractor_edituv_edituv_stretch_angle();
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "BKE_mesh.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
|
||||
|
@ -180,7 +180,5 @@ constexpr MeshExtract create_extractor_edituv_stretch_area()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_edituv_stretch_area =
|
||||
blender::draw::create_extractor_edituv_stretch_area();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_cache_impl.h"
|
||||
|
||||
|
@ -81,6 +81,4 @@ constexpr MeshExtract create_extractor_fdots_edituv_data()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_fdots_edituv_data = blender::draw::create_extractor_fdots_edituv_data();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -180,7 +180,5 @@ constexpr MeshExtract create_extractor_fdots_nor_hq()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_fdots_nor = blender::draw::create_extractor_fdots_nor();
|
||||
const MeshExtract extract_fdots_nor_hq = blender::draw::create_extractor_fdots_nor_hq();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "BLI_bitmap.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
|
||||
|
@ -139,6 +139,4 @@ constexpr MeshExtract create_extractor_fdots_pos()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_fdots_pos = blender::draw::create_extractor_fdots_pos();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "BLI_bitmap.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -109,6 +109,4 @@ constexpr MeshExtract create_extractor_fdots_uv()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_fdots_uv = blender::draw::create_extractor_fdots_uv();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
|
||||
|
@ -234,7 +234,5 @@ constexpr MeshExtract create_extractor_lnor_hq()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_lnor = blender::draw::create_extractor_lnor();
|
||||
const MeshExtract extract_lnor_hq = blender::draw::create_extractor_lnor_hq();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "BKE_editmesh_bvh.h"
|
||||
#include "BKE_editmesh_cache.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -633,6 +633,4 @@ constexpr MeshExtract create_extractor_mesh_analysis()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_mesh_analysis = blender::draw::create_extractor_mesh_analysis();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -94,6 +94,4 @@ constexpr MeshExtract create_extractor_orco()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_orco = blender::draw::create_extractor_orco();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
|
||||
|
@ -552,7 +552,5 @@ constexpr MeshExtract create_extractor_pos_nor_hq()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_pos_nor = blender::draw::create_extractor_pos_nor();
|
||||
const MeshExtract extract_pos_nor_hq = blender::draw::create_extractor_pos_nor_hq();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "BKE_paint.h"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -215,6 +215,4 @@ constexpr MeshExtract create_extractor_sculpt_data()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_sculpt_data = blender::draw::create_extractor_sculpt_data();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -411,9 +411,7 @@ constexpr MeshExtract create_extractor_fdot_idx()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_poly_idx = blender::draw::create_extractor_poly_idx();
|
||||
const MeshExtract extract_edge_idx = blender::draw::create_extractor_edge_idx();
|
||||
const MeshExtract extract_vert_idx = blender::draw::create_extractor_vert_idx();
|
||||
const MeshExtract extract_fdot_idx = blender::draw::create_extractor_fdot_idx();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -72,6 +72,4 @@ constexpr MeshExtract create_extractor_skin_roots()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_skin_roots = blender::draw::create_extractor_skin_roots();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "BKE_mesh.h"
|
||||
#include "BKE_mesh_tangent.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
|
||||
|
@ -367,7 +367,5 @@ constexpr MeshExtract create_extractor_tan_hq()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_tan = blender::draw::create_extractor_tan();
|
||||
const MeshExtract extract_tan_hq = blender::draw::create_extractor_tan_hq();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "BLI_string.h"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -168,6 +168,4 @@ constexpr MeshExtract create_extractor_uv()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_uv = blender::draw::create_extractor_uv();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "BLI_vector.hh"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
struct VColRef {
|
||||
const CustomDataLayer *layer;
|
||||
|
@ -380,6 +380,4 @@ constexpr MeshExtract create_extractor_vcol()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_vcol = blender::draw::create_extractor_vcol();
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "BKE_deform.h"
|
||||
|
||||
#include "draw_subdivision.h"
|
||||
#include "extract_mesh.h"
|
||||
#include "extract_mesh.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@ -208,6 +208,4 @@ constexpr MeshExtract create_extractor_weights()
|
|||
|
||||
} // namespace blender::draw
|
||||
|
||||
extern "C" {
|
||||
const MeshExtract extract_weights = blender::draw::create_extractor_weights();
|
||||
}
|
||||
|
|
|
@ -347,7 +347,7 @@ static char attr_prefix_get(eCustomDataType type)
|
|||
|
||||
static void attr_input_name(GPUMaterialAttribute *attr)
|
||||
{
|
||||
/* NOTE: Replicate changes to mesh_render_data_create() in draw_cache_impl_mesh.c */
|
||||
/* NOTE: Replicate changes to mesh_render_data_create() in draw_cache_impl_mesh.cc */
|
||||
if (attr->type == CD_ORCO) {
|
||||
/* OPTI: orco is computed from local positions, but only if no modifier is present. */
|
||||
STRNCPY(attr->input_name, "orco");
|
||||
|
|
|
@ -83,7 +83,7 @@ typedef struct Mesh_Runtime {
|
|||
|
||||
/**
|
||||
* Data used to efficiently draw the mesh in the viewport, especially useful when
|
||||
* the same mesh is used in many objects or instances. See `draw_cache_impl_mesh.c`.
|
||||
* the same mesh is used in many objects or instances. See `draw_cache_impl_mesh.cc`.
|
||||
*/
|
||||
void *batch_cache;
|
||||
|
||||
|
|
Loading…
Reference in New Issue