47 #define ACTIVE_NURB (1 << 2)
48 #define BEZIER_HANDLE (1 << 3)
49 #define EVEN_U_BIT (1 << 4)
80 vert_len += nu->pntsu * 3;
82 edge_len += 2 * nu->pntsu;
85 vert_len += nu->pntsu * nu->pntsv;
87 edge_len += (nu->pntsu - 1) * nu->pntsv;
88 edge_len += (nu->pntsv - 1) * nu->pntsu;
92 *r_vert_len = vert_len;
95 *r_edge_len = edge_len;
104 *r_curve_len =
curves.curves_num();
105 *r_vert_len =
curves.evaluated_points_num();
109 for (
const int i :
curves.curves_range()) {
123 int skip = nu->
resolu / 16;
131 normal_len += (nr / (skip + 1)) + ((nr % (skip + 1)) != 0);
223 nurbs = &editnurb->
nurbs;
240 rdata->
nurbs = nurbs;
250 if (rdata->loose_verts) {
334 if (cache ==
nullptr) {
364 memset(cache, 0,
sizeof(*cache));
371 nurbs = &editnurb->
nurbs;
399 if (cache ==
nullptr) {
424 for (
int i = 0; i <
sizeof(cache->
ordered) /
sizeof(
void *); i++) {
428 for (
int i = 0; i <
sizeof(cache->
edit) /
sizeof(
void *); i++) {
432 for (
int i = 0; i <
sizeof(cache->
ibo) /
sizeof(
void *); i++) {
436 for (
int i = 0; i <
sizeof(cache->
batch) /
sizeof(
void *); i++) {
463 if (
format.attr_len == 0) {
487 const int index_len = edge_len + curve_len * 2;
495 for (
const int i :
curves.curves_range()) {
497 if (cyclic[i] && points.
size() > 1) {
500 for (
const int i_point : points) {
520 uint pos_hq, nor_hq, tan_hq, rad_hq;
522 if (
format.attr_len == 0) {
542 int vbo_len_used = 0;
561 int skip = nu->
resolu / 16;
564 float nor[3] = {1.0f, 0.0f, 0.0f};
586 BLI_assert(vbo_len_used == verts_len_capacity);
595 const bool handle_selected)
642 int vbo_len_used = 0;
644 #define DRW_TEST_ASSIGN_VBO(v) (v = (DRW_vbo_requested(v) ? (v) : nullptr))
645 #define DRW_TEST_ASSIGN_IBO(v) (v = (DRW_ibo_requested(v) ? (v) : nullptr))
659 elbp_verts = &elb_verts;
663 elbp_lines = &elb_lines;
667 #undef DRW_TEST_ASSIGN_VBO
668 #undef DRW_TEST_ASSIGN_IBO
673 const BPoint *bp = nu->bp;
676 for (
int a = 0;
a < nu->pntsu;
a++, bezt++) {
677 if (bezt->
hide != 0) {
697 for (
int j = 0; j < 3; j++) {
702 for (
int j = 0; j < 3; j++) {
710 int pt_len = nu->pntsu * nu->pntsv;
711 for (
int a = 0;
a < pt_len;
a++, bp++, vbo_len_used += 1) {
715 int u = (
a % nu->pntsu);
716 int v = (
a / nu->pntsu);
723 const BPoint *bp_next_u = (u < (nu->pntsu - 1)) ? &nu->bp[
a + 1] :
nullptr;
724 const BPoint *bp_next_v = (
v < (nu->pntsv - 1)) ? &nu->bp[
a + nu->pntsu] :
nullptr;
725 if (bp_next_u && (bp_next_u->
hide ==
false)) {
728 if (bp_next_v && (bp_next_v->
hide ==
false)) {
744 if (elbp_verts !=
nullptr) {
747 if (elbp_lines !=
nullptr) {
750 if (vbo_len_used != verts_len_capacity) {
751 if (vbo_pos !=
nullptr) {
754 if (vbo_data !=
nullptr) {
829 #ifdef DRW_DEBUG_MESH_CACHE_REQUEST
830 printf(
"-- %s %s --\n", __func__, ob->
id.
name + 2);
844 #ifdef DRW_DEBUG_MESH_CACHE_REQUEST
845 printf(
" mr_flag %d\n\n", mr_flag);
860 rdata, cache->edit.pos, cache->edit.data, cache->ibo.edit_verts, cache->ibo.edit_lines);
870 for (
int i = 0; i <
sizeof(cache->batch) /
sizeof(
void *); i++) {
@ BKE_CURVE_BATCH_DIRTY_SELECT
@ BKE_CURVE_BATCH_DIRTY_ALL
Low-level operations for curves.
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_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 *)
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_fill(GPUVertBuf *, uint a_idx, const void *data)
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.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to curves
ATTR_WARN_UNUSED_RESULT const BMVert * v
constexpr int64_t last(const int64_t n=0) const
constexpr int64_t size() const
static CurvesGeometry & wrap(::CurvesGeometry &dna_struct)
@ VFLAG_VERT_SELECTED_BEZT_HANDLE
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)
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)
#define DRW_TEST_ASSIGN_VBO(v)
GPUBatch * DRW_curve_batch_cache_get_edit_edges(Curve *cu)
static CurveBatchCache * curve_batch_cache_get(Curve *cu)
static int curve_render_data_normal_len_get(const CurveRenderData *rdata)
static void curve_batch_cache_clear(Curve *cu)
#define DRW_TEST_ASSIGN_IBO(v)
static CurveRenderData * curve_render_data_create(Curve *cu, CurveCache *ob_curve_cache, const int types)
static void curve_render_data_free(CurveRenderData *rdata)
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_normal_edge(Curve *cu)
void DRW_curve_batch_cache_dirty_tag(Curve *cu, int mode)
@ CU_DATATYPE_TEXT_SELECT
static int curve_render_data_wire_curve_len_get(const CurveRenderData *rdata)
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)
static void curve_eval_render_wire_verts_edges_len_get(const blender::bke::CurvesGeometry &curves, int *r_curve_len, int *r_vert_len, int *r_edge_len)
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_ADD_FLAG_FROM_IBO_REQUEST(flag, ibo, value)
#define DRW_ADD_FLAG_FROM_VBO_REQUEST(flag, vbo, value)
BLI_INLINE void DRW_ibo_request(GPUBatch *batch, GPUIndexBuf **ibo)
BLI_INLINE bool DRW_ibo_requested(GPUIndexBuf *ibo)
BLI_INLINE bool DRW_batch_requested(GPUBatch *batch, GPUPrimType prim_type)
BLI_INLINE GPUBatch * DRW_batch_request(GPUBatch **batch)
struct @653::@656 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)
int segments_num(const int points_num, const bool cyclic)
vec_base< float, 3 > float3
MutableSpan< float3 > positions
struct CurveBatchCache::@283 ordered
GPUIndexBuf * curves_lines
struct CurveBatchCache::@284 edit
struct CurveBatchCache::@286 batch
struct CurveBatchCache::@285 ibo
struct CurveRenderData::@280 wire
struct CurveRenderData::@279 overlay
const Curves * curve_eval
struct CurveRenderData::@282 text
CurveCache * ob_curve_cache
struct CurveRenderData::@281 normal
const struct Curves * curve_eval
struct EditFont * editfont
struct CurveCache * curve_cache