Cleanup: Remove unused functions

This commit is contained in:
Sergey Sharybin 2019-05-10 17:26:16 +02:00
parent 93aecd2b81
commit df42994652
Notes: blender-bot 2023-02-14 06:00:51 +01:00
Referenced by commit d2e473a2dd, Cleanup: Remove unused "for_orco" argument to curve evaluation
4 changed files with 0 additions and 245 deletions

View File

@ -134,10 +134,6 @@ void BKE_curve_editNurb_keyIndex_free(struct GHash **keyindex);
void BKE_curve_editNurb_free(struct Curve *cu);
struct ListBase *BKE_curve_editNurbs_get(struct Curve *cu);
float *BKE_curve_make_orco(struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob,
int *r_numVerts);
float *BKE_curve_surf_make_orco(struct Object *ob);
void BKE_curve_bevelList_free(struct ListBase *bev);

View File

@ -101,11 +101,6 @@ void BKE_displist_make_curveTypes_forRender(struct Depsgraph *depsgraph,
const bool for_orco,
const bool use_render_resolution,
struct LinkNode *ob_cyclic_list);
void BKE_displist_make_curveTypes_forOrco(struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob,
struct ListBase *dispbase,
struct LinkNode *ob_cyclic_list);
void BKE_displist_make_mball(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
void BKE_displist_make_mball_forRender(struct Depsgraph *depsgraph,
struct Scene *scene,

View File

@ -1737,232 +1737,6 @@ static void forward_diff_bezier_cotangent(const float p0[3],
}
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
float *BKE_curve_surf_make_orco(Object *ob)
{
/* Note: this function is used in convertblender only atm, so
* suppose nonzero curve's render resolution should always be used */
Curve *cu = ob->data;
Nurb *nu;
int a, b, tot = 0;
int sizeu, sizev;
int resolu, resolv;
float *fp, *coord_array;
/* first calculate the size of the datablock */
nu = cu->nurb.first;
while (nu) {
/* as we want to avoid the seam in a cyclic nurbs
* texture wrapping, reserve extra orco data space to save these extra needed
* vertex based UV coordinates for the meridian vertices.
* Vertices on the 0/2pi boundary are not duplicated inside the displist but later in
* the renderface/vert construction.
*
* See also convertblender.c: init_render_surf()
*/
resolu = cu->resolu_ren ? cu->resolu_ren : nu->resolu;
resolv = cu->resolv_ren ? cu->resolv_ren : nu->resolv;
sizeu = nu->pntsu * resolu;
sizev = nu->pntsv * resolv;
if (nu->flagu & CU_NURB_CYCLIC) {
sizeu++;
}
if (nu->flagv & CU_NURB_CYCLIC) {
sizev++;
}
if (nu->pntsv > 1) {
tot += sizeu * sizev;
}
nu = nu->next;
}
/* makeNurbfaces wants zeros */
fp = coord_array = MEM_calloc_arrayN(tot, 3 * sizeof(float), "make_orco");
nu = cu->nurb.first;
while (nu) {
resolu = cu->resolu_ren ? cu->resolu_ren : nu->resolu;
resolv = cu->resolv_ren ? cu->resolv_ren : nu->resolv;
if (nu->pntsv > 1) {
sizeu = nu->pntsu * resolu;
sizev = nu->pntsv * resolv;
if (nu->flagu & CU_NURB_CYCLIC) {
sizeu++;
}
if (nu->flagv & CU_NURB_CYCLIC) {
sizev++;
}
if (cu->flag & CU_UV_ORCO) {
for (b = 0; b < sizeu; b++) {
for (a = 0; a < sizev; a++) {
if (sizev < 2) {
fp[0] = 0.0f;
}
else {
fp[0] = -1.0f + 2.0f * ((float)a) / (sizev - 1);
}
if (sizeu < 2) {
fp[1] = 0.0f;
}
else {
fp[1] = -1.0f + 2.0f * ((float)b) / (sizeu - 1);
}
fp[2] = 0.0;
fp += 3;
}
}
}
else {
int size = (nu->pntsu * resolu) * (nu->pntsv * resolv) * 3 * sizeof(float);
float *_tdata = MEM_mallocN(size, "temp data");
float *tdata = _tdata;
BKE_nurb_makeFaces(nu, tdata, 0, resolu, resolv);
for (b = 0; b < sizeu; b++) {
int use_b = b;
if (b == sizeu - 1 && (nu->flagu & CU_NURB_CYCLIC)) {
use_b = false;
}
for (a = 0; a < sizev; a++) {
int use_a = a;
if (a == sizev - 1 && (nu->flagv & CU_NURB_CYCLIC)) {
use_a = false;
}
tdata = _tdata + 3 * (use_b * (nu->pntsv * resolv) + use_a);
fp[0] = (tdata[0] - cu->loc[0]) / cu->size[0];
fp[1] = (tdata[1] - cu->loc[1]) / cu->size[1];
fp[2] = (tdata[2] - cu->loc[2]) / cu->size[2];
fp += 3;
}
}
MEM_freeN(_tdata);
}
}
nu = nu->next;
}
return coord_array;
}
/* NOTE: This routine is tied to the order of vertex
* built by displist and as passed to the renderer.
*/
float *BKE_curve_make_orco(Depsgraph *depsgraph, Scene *scene, Object *ob, int *r_numVerts)
{
Curve *cu = ob->data;
DispList *dl;
int u, v, numVerts;
float *fp, *coord_array;
ListBase disp = {NULL, NULL};
BKE_displist_make_curveTypes_forOrco(depsgraph, scene, ob, &disp, NULL);
numVerts = 0;
for (dl = disp.first; dl; dl = dl->next) {
if (dl->type == DL_INDEX3) {
numVerts += dl->nr;
}
else if (dl->type == DL_SURF) {
/* convertblender.c uses the Surface code for creating renderfaces when cyclic U only
* (closed circle beveling)
*/
if (dl->flag & DL_CYCL_U) {
if (dl->flag & DL_CYCL_V) {
numVerts += (dl->parts + 1) * (dl->nr + 1);
}
else {
numVerts += dl->parts * (dl->nr + 1);
}
}
else if (dl->flag & DL_CYCL_V) {
numVerts += (dl->parts + 1) * dl->nr;
}
else {
numVerts += dl->parts * dl->nr;
}
}
}
if (r_numVerts) {
*r_numVerts = numVerts;
}
fp = coord_array = MEM_malloc_arrayN(numVerts, 3 * sizeof(float), "cu_orco");
for (dl = disp.first; dl; dl = dl->next) {
if (dl->type == DL_INDEX3) {
for (u = 0; u < dl->nr; u++, fp += 3) {
if (cu->flag & CU_UV_ORCO) {
fp[0] = 2.0f * u / (dl->nr - 1) - 1.0f;
fp[1] = 0.0;
fp[2] = 0.0;
}
else {
copy_v3_v3(fp, &dl->verts[u * 3]);
fp[0] = (fp[0] - cu->loc[0]) / cu->size[0];
fp[1] = (fp[1] - cu->loc[1]) / cu->size[1];
fp[2] = (fp[2] - cu->loc[2]) / cu->size[2];
}
}
}
else if (dl->type == DL_SURF) {
int sizeu = dl->nr, sizev = dl->parts;
/* exception as handled in convertblender.c too */
if (dl->flag & DL_CYCL_U) {
sizeu++;
if (dl->flag & DL_CYCL_V) {
sizev++;
}
}
else if (dl->flag & DL_CYCL_V) {
sizev++;
}
for (u = 0; u < sizev; u++) {
for (v = 0; v < sizeu; v++, fp += 3) {
if (cu->flag & CU_UV_ORCO) {
fp[0] = 2.0f * u / (sizev - 1) - 1.0f;
fp[1] = 2.0f * v / (sizeu - 1) - 1.0f;
fp[2] = 0.0;
}
else {
const float *vert;
int realv = v % dl->nr;
int realu = u % dl->parts;
vert = dl->verts + 3 * (dl->nr * realu + realv);
copy_v3_v3(fp, vert);
fp[0] = (fp[0] - cu->loc[0]) / cu->size[0];
fp[1] = (fp[1] - cu->loc[1]) / cu->size[1];
fp[2] = (fp[2] - cu->loc[2]) / cu->size[2];
}
}
}
}
}
BKE_displist_free(&disp);
return coord_array;
}
/* ***************** BEVEL ****************** */
void BKE_curve_bevel_make(Depsgraph *depsgraph,

View File

@ -1859,16 +1859,6 @@ void BKE_displist_make_curveTypes_forRender(Depsgraph *depsgraph,
r_final);
}
void BKE_displist_make_curveTypes_forOrco(
Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase, LinkNode *ob_cyclic_list)
{
if (ob->runtime.curve_cache == NULL) {
ob->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve");
}
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, 1, 1, 1, ob_cyclic_list, NULL);
}
void BKE_displist_minmax(ListBase *dispbase, float min[3], float max[3])
{
DispList *dl;