53 #define ACTIVE_NURB (1 << 2)
54 #define BEZIER_HANDLE (1 << 3)
55 #define EVEN_U_BIT (1 << 4)
86 vert_len += nu->pntsu * 3;
88 edge_len += 2 * nu->pntsu;
91 vert_len += nu->pntsu * nu->pntsv;
93 edge_len += (nu->pntsu - 1) * nu->pntsv;
94 edge_len += (nu->pntsv - 1) * nu->pntsu;
98 *r_vert_len = vert_len;
101 *r_edge_len = edge_len;
116 const bool is_cyclic = bl->poly != -1;
117 edge_len += (is_cyclic) ? bl->nr : bl->nr - 1;
125 const bool is_cyclic = dl->type ==
DL_POLY;
126 edge_len += (is_cyclic) ? dl->nr : dl->nr - 1;
132 *r_vert_len = vert_len;
135 *r_edge_len = edge_len;
138 *r_curve_len = curve_len;
149 int skip = nu->
resolu / 16;
157 normal_len += (nr / (skip + 1)) + ((nr % (skip + 1)) != 0);
241 nurbs = &editnurb->
nurbs;
258 rdata->
nurbs = nurbs;
268 if (rdata->loose_verts) {
313 int gpumat_array_len)
315 for (
int i = 0; i < gpumat_array_len; i++) {
317 if (gpumat ==
NULL) {
323 const char *
name = gpu_attr->name;
324 int type = gpu_attr->type;
328 if (
name[0] !=
'\0') {
450 memset(cache, 0,
sizeof(*cache));
457 nurbs = &editnurb->
nurbs;
516 for (
int i = 0; i <
sizeof(cache->
ordered) /
sizeof(
void *); i++) {
520 for (
int i = 0; i <
sizeof(cache->
edit) /
sizeof(
void *); i++) {
524 for (
int i = 0; i <
sizeof(cache->
ibo) /
sizeof(
void *); i++) {
528 for (
int i = 0; i <
sizeof(cache->
batch) /
sizeof(
void *); i++) {
533 for (
int i = 0; i < cache->
mat_len; i++) {
562 if (
format.attr_len == 0) {
575 const int i_end = v_idx + bl->nr;
576 for (
const BevPoint *bevp = bl->bevpoints; v_idx < i_end; v_idx++, bevp++) {
582 for (
int i = 0; i < dl->nr; v_idx++, i++) {
598 const int index_len = edge_len + curve_len * 2;
608 const bool is_cyclic = bl->poly != -1;
612 for (
int i = 0; i < bl->nr; i++) {
620 const bool is_cyclic = dl->type ==
DL_POLY;
624 for (
int i = 0; i < dl->nr; i++) {
645 uint pos_hq, nor_hq, tan_hq, rad_hq;
647 if (
format.attr_len == 0) {
667 int vbo_len_used = 0;
684 int skip = nu->
resolu / 16;
687 float nor[3] = {1.0f, 0.0f, 0.0f};
709 BLI_assert(vbo_len_used == verts_len_capacity);
718 const bool handle_selected)
765 int vbo_len_used = 0;
779 elbp_verts = &elb_verts;
783 elbp_lines = &elb_lines;
788 for (
Nurb *nu = rdata->
nurbs->
first; nu; nu = nu->next, nu_id++) {
790 const BPoint *bp = nu->bp;
793 for (
int a = 0;
a < nu->pntsu;
a++, bezt++) {
794 if (bezt->
hide ==
true) {
814 for (
int j = 0; j < 3; j++) {
819 for (
int j = 0; j < 3; j++) {
827 int pt_len = nu->pntsu * nu->pntsv;
828 for (
int a = 0;
a < pt_len;
a++, bp++, vbo_len_used += 1) {
829 if (bp->hide ==
true) {
832 int u = (
a % nu->pntsu);
833 int v = (
a / nu->pntsu);
840 const BPoint *bp_next_u = (u < (nu->pntsu - 1)) ? &nu->bp[
a + 1] :
NULL;
841 const BPoint *bp_next_v = (
v < (nu->pntsv - 1)) ? &nu->bp[
a + nu->pntsu] :
NULL;
842 if (bp_next_u && (bp_next_u->
hide ==
false)) {
845 if (bp_next_v && (bp_next_v->
hide ==
false)) {
861 if (elbp_verts !=
NULL) {
864 if (elbp_lines !=
NULL) {
867 if (vbo_len_used != verts_len_capacity) {
868 if (vbo_pos !=
NULL) {
871 if (vbo_data !=
NULL) {
915 uint gpumat_array_len)
923 for (
int i = 0; i < cache->
mat_len; i++) {
977 for (
int i = 0; i < cache->
mat_len; i++) {
1019 for (
int i = 0; i < cache->
mat_len; i++) {
1034 #ifdef DRW_DEBUG_MESH_CACHE_REQUEST
1035 printf(
"-- %s %s --\n", __func__, ob->
id.
name + 2);
1058 for (
int i = 0; i < cache->
mat_len; i++) {
1062 #ifdef DRW_DEBUG_MESH_CACHE_REQUEST
1063 printf(
" mr_flag %d\n\n", mr_flag);
1120 for (
int i = 0; i <
sizeof(cache->
batch) /
sizeof(
void *); i++) {
@ BKE_CURVE_BATCH_DIRTY_SELECT
@ BKE_CURVE_BATCH_DIRTY_ALL
display list (or rather multi purpose list) stuff.
#define LISTBASE_FOREACH(type, var, list)
MINLINE int max_ii(int a, int b)
void mul_qt_v3(const float q[4], float r[3])
#define SET_FLAG_FROM_TEST(value, test, flag)
#define BEZT_ISSEL_ANY(bezt)
#define GPU_BATCH_CLEAR_SAFE(batch)
#define GPU_BATCH_DISCARD_SAFE(batch)
bool GPU_use_hq_normals_workaround(void)
struct GPUIndexBuf GPUIndexBuf
#define GPU_INDEXBUF_DISCARD_SAFE(elem)
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
void GPU_indexbuf_add_primitive_restart(GPUIndexBufBuilder *)
void GPU_indexbuf_add_point_vert(GPUIndexBufBuilder *, uint v)
void GPU_indexbuf_add_line_verts(GPUIndexBufBuilder *, uint v1, uint v2)
void GPU_indexbuf_add_generic_vert(GPUIndexBufBuilder *, uint v)
void GPU_indexbuf_init_ex(GPUIndexBufBuilder *, GPUPrimType, uint index_len, uint vertex_len)
void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *, GPUIndexBuf *)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
ListBase GPU_material_attributes(GPUMaterial *material)
struct GPUVertBuf GPUVertBuf
void GPU_vertbuf_data_alloc(GPUVertBuf *, uint v_len)
#define GPU_vertbuf_init_with_format(verts, format)
#define GPU_VERTBUF_DISCARD_SAFE(verts)
void GPU_vertbuf_attr_set(GPUVertBuf *, uint a_idx, uint v_idx, const void *data)
void GPU_vertbuf_data_resize(GPUVertBuf *, uint v_len)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v
void DRW_displist_indexbuf_create_edges_adjacency_lines(struct ListBase *lb, struct GPUIndexBuf *ibo, bool *r_is_manifold)
void DRW_displist_indexbuf_create_triangles_loop_split_by_material(struct ListBase *lb, struct GPUIndexBuf **ibo_mat, uint mat_len)
void DRW_displist_vertbuf_create_wiredata(struct ListBase *lb, struct GPUVertBuf *vbo)
void DRW_displist_vertbuf_create_loop_pos_and_nor_and_uv_and_tan(struct ListBase *lb, struct GPUVertBuf *vbo_pos_nor, struct GPUVertBuf *vbo_uv, struct GPUVertBuf *vbo_tan, const struct Scene *scene)
@ VFLAG_VERT_SELECTED_BEZT_HANDLE
void DRW_displist_indexbuf_create_triangles_in_order(struct ListBase *lb, struct GPUIndexBuf *ibo)
void DRW_displist_indexbuf_create_lines_in_order(struct ListBase *lb, struct GPUIndexBuf *ibo)
void DRW_displist_vertbuf_create_pos_and_nor(struct ListBase *lb, struct GPUVertBuf *vbo, const struct Scene *scene)
static bool curve_batch_cache_valid(Curve *cu)
static void curve_create_edit_data_and_handles(CurveRenderData *rdata, GPUVertBuf *vbo_pos, GPUVertBuf *vbo_data, GPUIndexBuf *ibo_edit_verts_points, GPUIndexBuf *ibo_edit_lines)
static int curve_render_data_wire_verts_len_get(const CurveRenderData *rdata)
struct CurveRenderData CurveRenderData
static uint8_t bpoint_vflag_get(CurveRenderData *rdata, uint8_t flag, int v_idx, int nu_id, int u)
static void curve_batch_cache_init(Curve *cu)
GPUBatch * DRW_curve_batch_cache_get_wireframes_face(Curve *cu)
@ CU_DATATYPE_TEXT_SELECT
GPUBatch * DRW_curve_batch_cache_get_edit_edges(Curve *cu)
static CurveBatchCache * curve_batch_cache_get(Curve *cu)
static void curve_cd_calc_used_gpu_layers(CustomDataMask *cd_layers, struct GPUMaterial **gpumat_array, int gpumat_array_len)
static int curve_render_data_normal_len_get(const CurveRenderData *rdata)
static void curve_batch_cache_clear(Curve *cu)
static CurveRenderData * curve_render_data_create(Curve *cu, CurveCache *ob_curve_cache, const int types)
GPUVertBuf * DRW_curve_batch_cache_pos_vertbuf_get(struct Curve *cu)
static void curve_render_data_free(CurveRenderData *rdata)
struct CurveBatchCache CurveBatchCache
static void curve_create_edit_curves_nor(CurveRenderData *rdata, GPUVertBuf *vbo_curves_nor, const Scene *scene)
static int curve_render_normal_len_get(const ListBase *lb, const CurveCache *ob_curve_cache)
static void curve_create_curves_pos(CurveRenderData *rdata, GPUVertBuf *vbo_curves_pos)
static int curve_render_data_wire_edges_len_get(const CurveRenderData *rdata)
int DRW_curve_material_count_get(Curve *cu)
static void curve_create_curves_lines(CurveRenderData *rdata, GPUIndexBuf *ibo_curve_lines)
GPUBatch * DRW_curve_batch_cache_get_triangles_with_normals(struct Curve *cu)
GPUBatch * DRW_curve_batch_cache_get_normal_edge(Curve *cu)
void DRW_curve_batch_cache_dirty_tag(Curve *cu, int mode)
GPUBatch ** DRW_curve_batch_cache_get_surface_shaded(struct Curve *cu, struct GPUMaterial **gpumat_array, uint gpumat_array_len)
static int curve_render_data_wire_curve_len_get(const CurveRenderData *rdata)
GPUBatch * DRW_curve_batch_cache_get_edge_detection(Curve *cu, bool *r_is_manifold)
static void curve_render_wire_verts_edges_len_get(const CurveCache *ob_curve_cache, int *r_curve_len, int *r_vert_len, int *r_edge_len)
static void curve_render_overlay_verts_edges_len_get(ListBase *lb, int *r_vert_len, int *r_edge_len)
static uint8_t beztriple_vflag_get(CurveRenderData *rdata, uint8_t flag, uint8_t col_id, int v_idx, int nu_id, bool handle_point, const bool handle_selected)
GPUBatch * DRW_curve_batch_cache_get_edit_verts(Curve *cu)
void DRW_curve_batch_cache_validate(Curve *cu)
void DRW_curve_batch_cache_create_requested(Object *ob, const struct Scene *scene)
void DRW_curve_batch_cache_free(Curve *cu)
static int curve_render_data_overlay_verts_len_get(const CurveRenderData *rdata)
static int curve_render_data_overlay_edges_len_get(const CurveRenderData *rdata)
GPUBatch * DRW_curve_batch_cache_get_wire_edge(Curve *cu)
BLI_INLINE void DRW_vbo_request(GPUBatch *batch, GPUVertBuf **vbo)
BLI_INLINE bool DRW_vbo_requested(GPUVertBuf *vbo)
#define DRW_TEST_ASSIGN_VBO(v)
#define DRW_TEST_ASSIGN_IBO(v)
#define DRW_ADD_FLAG_FROM_IBO_REQUEST(flag, ibo, value)
#define DRW_ADD_FLAG_FROM_VBO_REQUEST(flag, vbo, value)
BLI_INLINE bool DRW_batch_requested(GPUBatch *batch, int prim_type)
BLI_INLINE void DRW_ibo_request(GPUBatch *batch, GPUIndexBuf **ibo)
BLI_INLINE bool DRW_ibo_requested(GPUIndexBuf *ibo)
BLI_INLINE GPUBatch * DRW_batch_request(GPUBatch **batch)
struct @612::@615 attr_id
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
INLINE Rall1d< T, V, S > tan(const Rall1d< T, V, S > &arg)
struct CurveBatchCache::@274 batch
GPUIndexBuf ** surf_per_mat_tris
struct CurveBatchCache::@273 ibo
GPUIndexBuf * surfaces_tris
GPUIndexBuf * surfaces_lines
GPUBatch * surfaces_edges
GPUBatch * edge_detection
struct CurveBatchCache::@272 edit
GPUIndexBuf * curves_lines
GPUVertBuf * curves_weight
struct CurveBatchCache::@271 ordered
GPUIndexBuf * edges_adj_lines
GPUVertBuf * loop_pos_nor
struct CurveRenderData::@270 text
struct CurveRenderData::@269 normal
struct CurveRenderData::@268 wire
struct CurveRenderData::@267 overlay
CurveCache * ob_curve_cache
struct EditFont * editfont
struct CurveCache * curve_cache