47 float *quarter_coords_x,
48 float *quarter_coords_y)
52 const float dangle =
float(
M_PI_2) / (curve->bevresol + 1);
53 for (
int i = 0; i < curve->bevresol + 1; i++) {
54 quarter_coords_x[i] =
float(
cosf(angle) * (curve->bevel_radius));
55 quarter_coords_y[i] =
float(
sinf(angle) * (curve->bevel_radius));
61 BLI_assert(curve->bevel_profile->segments !=
nullptr);
62 BLI_assert(curve->bevel_profile->segments_len == curve->bevresol + 1);
66 quarter_coords_x[0] = curve->bevel_radius;
67 quarter_coords_y[0] = 0.0f;
68 for (
int i = 1; i < curve->bevresol + 1; i++) {
69 quarter_coords_x[i] =
float(curve->bevel_profile->segments[i].x * (curve->bevel_radius));
70 quarter_coords_y[i] =
float(curve->bevel_profile->segments[i].y * (curve->bevel_radius));
77 const bool use_extrude,
88 float *quarter_coords_x =
static_cast<float *
>(alloca(
sizeof(
float) * (cu->
bevresol + 1)));
89 float *quarter_coords_y =
static_cast<float *
>(alloca(
sizeof(
float) * (cu->
bevresol + 1)));
93 if (fill_type ==
FULL) {
95 nr = 4 * cu->
bevresol + (use_extrude ? 6 : 4);
98 else if (fill_type ==
HALF) {
100 nr = 2 * (cu->
bevresol + 1) + (use_extrude ? 2 : 1);
116 float *fp = dl->
verts;
126 for (
int i = cu->
bevresol; i >= 0; i--) {
128 fp[1] = quarter_coords_x[i];
129 fp[2] = -quarter_coords_y[i] - cu->
extrude;
145 const int front_start = (!use_extrude &&
ELEM(fill_type,
HALF,
FULL)) ? 1 : 0;
146 for (
int i = front_start; i < cu->
bevresol + 1; i++) {
148 fp[1] = quarter_coords_x[i];
149 fp[2] = quarter_coords_y[i] + cu->
extrude;
160 if (fill_type ==
FULL) {
161 for (
int i = cu->
bevresol; i > 0; i--) {
163 fp[1] = -quarter_coords_x[i];
164 fp[2] = quarter_coords_y[i] + cu->
extrude;
176 for (
int i = 0; i < cu->
bevresol + 1; i++) {
178 fp[1] = -quarter_coords_x[i];
179 fp[2] = -quarter_coords_y[i] - cu->
extrude;
187 const int nr = 4 + 2 * cu->
bevresol;
197 float *fp = dl->
verts;
198 const float dangle = (2.0f *
float(
M_PI) / (nr));
199 float angle = -(nr - 1) * dangle;
201 for (
int i = 0; i < nr; i++) {
220 float *fp = dl->
verts;
229 if (cu->
bevobj ==
nullptr) {
238 ListBase bevdisp = {
nullptr,
nullptr};
255 dlnew->
verts =
static_cast<float *
>(
264 float *fp = dlnew->
verts;
265 int nr = dlnew->
parts * dlnew->
nr;
267 fp[2] = fp[1] * facy;
268 fp[1] = -fp[0] * facx;
282 ListBase bevel_shape = {
nullptr,
nullptr};
285 if (curve->bevobj !=
nullptr) {
290 const bool use_extrude = curve->extrude != 0.0f;
291 const bool use_bevel = curve->bevel_radius != 0.0f;
293 if (use_extrude && !use_bevel) {
296 else if (use_extrude || use_bevel) {
display list (or rather multi purpose list) stuff.
void BKE_displist_free(struct ListBase *lb)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
static void curve_bevel_make_extrude_and_fill(const Curve *cu, ListBase *disp, const bool use_extrude, const CurveBevelFillType fill_type)
static void curve_bevel_make_only_extrude(const Curve *cu, ListBase *disp)
static CurveBevelFillType curve_bevel_get_fill_type(const Curve *curve)
ListBase BKE_curve_bevel_make(const Curve *curve)
static void curve_bevel_make_from_object(const Curve *cu, ListBase *disp)
static void bevel_quarter_fill(const Curve *curve, float *quarter_coords_x, float *quarter_coords_y)
static void curve_bevel_make_full_circle(const Curve *cu, ListBase *disp)
draw_view in_light_buf[] float
void *(* MEM_mallocN)(size_t len, const char *str)
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void *(* MEM_callocN)(size_t len, const char *str)
ObjectRuntimeHandle * runtime