[Bf-blender-cvs] [df6d0aa] temp-derivedmesh-looptri: Use loop-data for subsurf normals
Campbell Barton
noreply at git.blender.org
Thu Jul 16 13:16:48 CEST 2015
Commit: df6d0aacb3a485d6ef35907e9009cf6b80b6dbb4
Author: Campbell Barton
Date: Thu Jul 16 21:10:42 2015 +1000
Branches: temp-derivedmesh-looptri
https://developer.blender.org/rBdf6d0aacb3a485d6ef35907e9009cf6b80b6dbb4
Use loop-data for subsurf normals
===================================================================
M source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index b6894a8..4c05367 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1769,7 +1769,7 @@ static void ccgDM_buffer_copy_normal(
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
CCGSubSurf *ss = ccgdm->ss;
CCGKey key;
- const short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL);
+ const float (*lnors)[3] = dm->getLoopDataArray(dm, CD_NORMAL);
int gridSize = ccgSubSurf_getGridSize(ss);
int gridFaces = gridSize - 1;
DMFlagMat *faceFlags = ccgdm->faceFlags;
@@ -1784,7 +1784,7 @@ static void ccgDM_buffer_copy_normal(
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
- const short (*ln)[3] = NULL;
+ const float (*ln)[3] = NULL;
if (faceFlags) {
shademodel = (lnors || (faceFlags[index].flag & ME_SMOOTH)) ? GL_SMOOTH : GL_FLAT;
@@ -1794,8 +1794,8 @@ static void ccgDM_buffer_copy_normal(
}
if (lnors) {
- ln = *lnors;
- lnors += gridFaces * gridFaces * numVerts;
+ ln = lnors;
+ lnors += gridFaces * gridFaces * numVerts * 4;
}
for (S = 0; S < numVerts; S++) {
@@ -1805,10 +1805,10 @@ static void ccgDM_buffer_copy_normal(
/* Can't use quad strips here... */
for (y = 0; y < gridFaces; y ++) {
for (x = 0; x < gridFaces; x ++) {
- copy_v3_v3_short(&varray[start], ln[0]);
- copy_v3_v3_short(&varray[start + 4], ln[3]);
- copy_v3_v3_short(&varray[start + 8], ln[2]);
- copy_v3_v3_short(&varray[start + 12], ln[1]);
+ normal_float_to_short_v3(&varray[start + 0], ln[0]);
+ normal_float_to_short_v3(&varray[start + 4], ln[3]);
+ normal_float_to_short_v3(&varray[start + 8], ln[2]);
+ normal_float_to_short_v3(&varray[start + 12], ln[1]);
start += 16;
ln += 4;
More information about the Bf-blender-cvs
mailing list