Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-09-19 05:14:36 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-19 05:14:36 +0300
commitf35e9f047a0381732a41ec331945b7a0654ee578 (patch)
tree5be3c632483cf2bc2960b21789849af27c9b2b59 /source/blender/blenkernel/intern/subsurf_ccg.c
parent0ad183bf0289c3b9b1af0cd581bc30435cae3800 (diff)
parentbb3ec3ebafbc2c0e5d8530148a433242e0adad30 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenkernel/intern/subsurf_ccg.c')
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 6db306854f4..139952c4cb4 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -284,7 +284,7 @@ static void get_face_uv_map_vert(UvVertMap *vmap, struct MPoly *mpoly, struct ML
break;
}
- fverts[j] = SET_UINT_IN_POINTER(mpoly[nv->poly_index].loopstart + nv->loop_of_poly_index);
+ fverts[j] = POINTER_FROM_UINT(mpoly[nv->poly_index].loopstart + nv->loop_of_poly_index);
}
}
@@ -331,7 +331,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
if (v->separate) {
CCGVert *ssv;
int loopid = mpoly[v->poly_index].loopstart + v->loop_of_poly_index;
- CCGVertHDL vhdl = SET_INT_IN_POINTER(loopid);
+ CCGVertHDL vhdl = POINTER_FROM_INT(loopid);
copy_v2_v2(uv, mloopuv[loopid].uv);
@@ -347,7 +347,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
MPoly *mp = &mpoly[i];
int nverts = mp->totloop;
int j, j_next;
- CCGFace *origf = ccgSubSurf_getFace(origss, SET_INT_IN_POINTER(i));
+ CCGFace *origf = ccgSubSurf_getFace(origss, POINTER_FROM_INT(i));
/* unsigned int *fv = &mp->v1; */
MLoop *ml = mloop + mp->loopstart;
@@ -361,12 +361,12 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
get_face_uv_map_vert(vmap, mpoly, ml, i, fverts);
for (j = 0, j_next = nverts - 1; j < nverts; j_next = j++) {
- unsigned int v0 = GET_UINT_FROM_POINTER(fverts[j_next]);
- unsigned int v1 = GET_UINT_FROM_POINTER(fverts[j]);
+ unsigned int v0 = POINTER_AS_UINT(fverts[j_next]);
+ unsigned int v1 = POINTER_AS_UINT(fverts[j]);
if (BLI_edgeset_add(eset, v0, v1)) {
CCGEdge *e, *orige = ccgSubSurf_getFaceEdge(origf, j_next);
- CCGEdgeHDL ehdl = SET_INT_IN_POINTER(mp->loopstart + j_next);
+ CCGEdgeHDL ehdl = POINTER_FROM_INT(mp->loopstart + j_next);
float crease = ccgSubSurf_getEdgeCrease(orige);
ccgSubSurf_syncEdge(ss, ehdl, fverts[j_next], fverts[j], crease, &e);
@@ -391,7 +391,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
#endif
get_face_uv_map_vert(vmap, mpoly, ml, i, fverts);
- ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), nverts, fverts, &f);
+ ccgSubSurf_syncFace(ss, POINTER_FROM_INT(i), nverts, fverts, &f);
}
#ifndef USE_DYNSIZE
@@ -436,7 +436,7 @@ static void UNUSED_FUNCTION(set_subsurf_osd_ccg_uv)(CCGSubSurf *ss,
faceMap = MEM_mallocN(totface * sizeof(*faceMap), "facemapuv");
for (ccgSubSurf_initFaceIterator(ss, &fi); !ccgFaceIterator_isStopped(&fi); ccgFaceIterator_next(&fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(&fi);
- faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f;
+ faceMap[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))] = f;
}
/* load coordinates from uvss into tface */
@@ -522,7 +522,7 @@ static void set_subsurf_legacy_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *
faceMap = MEM_mallocN(totface * sizeof(*faceMap), "facemapuv");
for (ccgSubSurf_initFaceIterator(uvss, &fi); !ccgFaceIterator_isStopped(&fi); ccgFaceIterator_next(&fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(&fi);
- faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f;
+ faceMap[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))] = f;
}
/* load coordinates from uvss into tface */
@@ -698,10 +698,10 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss,
CCGVert *v;
if (vertexCos) {
- ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), vertexCos[i], 0, &v);
+ ccgSubSurf_syncVert(ss, POINTER_FROM_INT(i), vertexCos[i], 0, &v);
}
else {
- ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), mv->co, 0, &v);
+ ccgSubSurf_syncVert(ss, POINTER_FROM_INT(i), mv->co, 0, &v);
}
((int *)ccgSubSurf_getVertUserData(ss, v))[1] = (index) ? *index++ : i;
@@ -716,8 +716,8 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss,
crease = useFlatSubdiv ? creaseFactor :
me->crease * creaseFactor / 255.0f;
- ccgSubSurf_syncEdge(ss, SET_INT_IN_POINTER(i), SET_UINT_IN_POINTER(me->v1),
- SET_UINT_IN_POINTER(me->v2), crease, &e);
+ ccgSubSurf_syncEdge(ss, POINTER_FROM_INT(i), POINTER_FROM_UINT(me->v1),
+ POINTER_FROM_UINT(me->v2), crease, &e);
((int *)ccgSubSurf_getEdgeUserData(ss, e))[1] = (index) ? *index++ : i;
}
@@ -736,14 +736,14 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss,
ml = mloop + mp->loopstart;
for (j = 0; j < mp->totloop; j++, ml++) {
- fVerts[j] = SET_UINT_IN_POINTER(ml->v);
+ fVerts[j] = POINTER_FROM_UINT(ml->v);
}
/* this is very bad, means mesh is internally inconsistent.
* it is not really possible to continue without modifying
* other parts of code significantly to handle missing faces.
* since this really shouldn't even be possible we just bail.*/
- if (ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), mp->totloop,
+ if (ccgSubSurf_syncFace(ss, POINTER_FROM_INT(i), mp->totloop,
fVerts, &f) == eCCGError_InvalidValue)
{
static int hasGivenError = 0;
@@ -1398,7 +1398,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
CCGEdge *e = ccgdm->edgeMap[index].edge;
short ed_flag = 0;
int x;
- int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
+ int edgeIdx = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e));
if (!ccgSubSurf_getEdgeNumFaces(e)) {
ed_flag |= ME_LOOSEEDGE;
@@ -1502,19 +1502,19 @@ static void copyFinalLoopArray_task_cb(
edge_size, grid_size);
ml->v = v1;
- ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v1, v2));
+ ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v1, v2));
ml++;
ml->v = v2;
- ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v2, v3));
+ ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v2, v3));
ml++;
ml->v = v3;
- ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v3, v4));
+ ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v3, v4));
ml++;
ml->v = v4;
- ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v4, v1));
+ ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v4, v1));
ml++;
}
}
@@ -1536,7 +1536,7 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, MLoop *mloop)
medge = ccgdm->dm.getEdgeArray((DerivedMesh *)ccgdm);
for (int i = 0; i < ccgdm->dm.numEdgeData; i++) {
- BLI_edgehash_insert(ehash, medge[i].v1, medge[i].v2, SET_INT_IN_POINTER(i));
+ BLI_edgehash_insert(ehash, medge[i].v1, medge[i].v2, POINTER_FROM_INT(i));
}
atomic_cas_ptr((void **)&ccgdm->ehash, ccgdm->ehash, ehash);
@@ -1623,7 +1623,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3])
for (ccgSubSurf_initVertIterator(ss, &vi); !ccgVertIterator_isStopped(&vi); ccgVertIterator_next(&vi)) {
CCGVert *v = ccgVertIterator_getCurrent(&vi);
- vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))] = v;
+ vertMap2[POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v))] = v;
}
totedge = ccgSubSurf_getNumEdges(ss);
@@ -1631,7 +1631,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3])
for (ccgSubSurf_initEdgeIterator(ss, &ei), i = 0; !ccgEdgeIterator_isStopped(&ei); i++, ccgEdgeIterator_next(&ei)) {
CCGEdge *e = ccgEdgeIterator_getCurrent(&ei);
- edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))] = e;
+ edgeMap2[POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e))] = e;
}
totface = ccgSubSurf_getNumFaces(ss);
@@ -1639,7 +1639,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3])
for (ccgSubSurf_initFaceIterator(ss, &fi); !ccgFaceIterator_isStopped(&fi); ccgFaceIterator_next(&fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(&fi);
- faceMap2[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f;
+ faceMap2[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))] = f;
}
i = 0;
@@ -2472,7 +2472,7 @@ static void create_ccgdm_maps(CCGDerivedMesh *ccgdm,
{
CCGVert *v = ccgVertIterator_getCurrent(&vi);
- ccgdm->vertMap[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))].vert = v;
+ ccgdm->vertMap[POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v))].vert = v;
}
totedge = ccgSubSurf_getNumEdges(ss);
@@ -2483,7 +2483,7 @@ static void create_ccgdm_maps(CCGDerivedMesh *ccgdm,
{
CCGEdge *e = ccgEdgeIterator_getCurrent(&ei);
- ccgdm->edgeMap[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))].edge = e;
+ ccgdm->edgeMap[POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e))].edge = e;
}
totface = ccgSubSurf_getNumFaces(ss);
@@ -2494,7 +2494,7 @@ static void create_ccgdm_maps(CCGDerivedMesh *ccgdm,
{
CCGFace *f = ccgFaceIterator_getCurrent(&fi);
- ccgdm->faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))].face = f;
+ ccgdm->faceMap[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))].face = f;
}
}
@@ -2568,7 +2568,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm,
CCGFace *f = ccgdm->faceMap[index].face;
int numVerts = ccgSubSurf_getFaceNumVerts(f);
int numFinalEdges = numVerts * (gridSideEdges + gridInternalEdges);
- int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ int origIndex = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
int g2_wid = gridCuts + 2;
float *w, *w2;
int s, x, y;
@@ -2602,7 +2602,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm,
#endif
for (s = 0; s < numVerts; s++) {
CCGVert *v = ccgSubSurf_getFaceVert(f, s);
- vertidx[s] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ vertidx[s] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v));
}
/*I think this is for interpolating the center vert?*/
@@ -2715,13 +2715,13 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm,
int mapIndex = ccgDM_getEdgeMapIndex(ss, e);
int x;
int vertIdx[2];
- int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
+ int edgeIdx = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e));
CCGVert *v;
v = ccgSubSurf_getEdgeVert0(e);
- vertIdx[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ vertIdx[0] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v));
v = ccgSubSurf_getEdgeVert1(e);
- vertIdx[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ vertIdx[1] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v));
ccgdm->edgeMap[index].startVert = vertNum;
ccgdm->edgeMap[index].startEdge = edgeNum;
@@ -2775,7 +2775,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm,
int mapIndex = ccgDM_getVertMapIndex(ccgdm->ss, v);
int vertIdx;
- vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ vertIdx = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v));
ccgdm->vertMap[index].startVert = vertNum;
@@ -3060,7 +3060,7 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*r_positions)[3])
for (ccgSubSurf_initVertIterator(ss, &vi); !ccgVertIterator_isStopped(&vi); ccgVertIterator_next(&vi)) {
CCGVert *v = ccgVertIterator_getCurrent(&vi);
- int idx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ int idx = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v));
int N = ccgSubSurf_getVertNumEdges(v);
int numFaces = ccgSubSurf_getVertNumFaces(v);
float *co;