Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/displist.c
| Context not available. | |||||
| #include <math.h> | #include <math.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include <time.h> | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_curve_types.h" | #include "DNA_curve_types.h" | ||||
| Context not available. | |||||
| Curve *cu = ob->data; | Curve *cu = ob->data; | ||||
| DispList *dl; | DispList *dl; | ||||
| float *data; | float *data; | ||||
| int len; | int len=10; | ||||
| time_t timer_start = clock(); | |||||
| if (!for_render && cu->editnurb) { | if (!for_render && cu->editnurb) { | ||||
| BKE_nurbList_duplicate(&nubase, BKE_curve_editNurbs_get(cu)); | BKE_nurbList_duplicate(&nubase, BKE_curve_editNurbs_get(cu)); | ||||
| Context not available. | |||||
| BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, 3 * sizeof(float)); | BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, 3 * sizeof(float)); | ||||
| } | } | ||||
| else { | else { | ||||
| len = (nu->pntsu * resolu) * (nu->pntsv * resolv); | // len = (nu->pntsu * resolu) * (nu->pntsv * resolv); | ||||
| dl = MEM_callocN(sizeof(DispList), "makeDispListsurf"); | dl = MEM_callocN(sizeof(DispList), "makeDispListsurf"); | ||||
| dl->verts = MEM_mallocN(len * sizeof(float[3]), "dlverts"); | // dl->verts = MEM_mallocN(len * sizeof(float[3]), "dlverts"); | ||||
| BLI_addtail(dispbase, dl); | // BLI_addtail(dispbase, dl); // <----- WHERE MESH GETS OUTPUTTED TO CALLER | ||||
| dl->col = nu->mat_nr; | // dl->col = nu->mat_nr; | ||||
| dl->charidx = nu->charidx; | // dl->charidx = nu->charidx; | ||||
| /* dl->rt will be used as flag for render face and */ | // /* dl->rt will be used as flag for render face and */ | ||||
| /* CU_2D conflicts with R_NOPUNOFLIP */ | // /* CU_2D conflicts with R_NOPUNOFLIP */ | ||||
| dl->rt = nu->flag & ~CU_2D; | // dl->rt = nu->flag & ~CU_2D; | ||||
| data = dl->verts; | // data = dl->verts; | ||||
| dl->type = DL_SURF; | // dl->type = DL_SURF; | ||||
| dl->parts = (nu->pntsu * resolu); /* in reverse, because makeNurbfaces works that way */ | // dl->parts = (nu->pntsu * resolu); /* in reverse, because makeNurbfaces works that way */ | ||||
| dl->nr = (nu->pntsv * resolv); | // dl->nr = (nu->pntsv * resolv); | ||||
| if (nu->flagv & CU_NURB_CYCLIC) { | // if (nu->flagv & CU_NURB_CYCLIC) { | ||||
| dl->flag |= DL_CYCL_U; /* reverse too! */ | // dl->flag |= DL_CYCL_U; /* reverse too! */ | ||||
| } | // } | ||||
| if (nu->flagu & CU_NURB_CYCLIC) { | // if (nu->flagu & CU_NURB_CYCLIC) { | ||||
| dl->flag |= DL_CYCL_V; | // dl->flag |= DL_CYCL_V; | ||||
| } | // } | ||||
| BKE_nurb_makeFaces(nu, data, 0, resolu, resolv); | // BKE_nurb_makeFaces(nu, data, 0, resolu, resolv); | ||||
| /* gl array drawing: using indices */ | // /* gl array drawing: using indices */ | ||||
| displist_surf_indices(dl); | // displist_surf_indices(dl); | ||||
| BLI_addtail(dispbase, dl); | |||||
| BKE_nurb_make_displist(nu, dl); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase); | BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase); | ||||
| curve_calc_modifiers_post(depsgraph, scene, ob, &nubase, dispbase, r_final, for_render); | curve_calc_modifiers_post(depsgraph, scene, ob, &nubase, dispbase, r_final, for_render); | ||||
| } | } | ||||
| time_t timer_stop = clock(); | |||||
| int t = timer_stop - timer_start; | |||||
| nu = nubase.first; | |||||
| printf("%i %i %i %i\n", len, nu->pntsu * nu->resolu, nu->pntsv * nu->resolv, t); | |||||
| BKE_nurbList_free(&nubase); | BKE_nurbList_free(&nubase); | ||||
| } | } | ||||
| Context not available. | |||||