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:
authorDaniel Dunbar <daniel@zuster.org>2005-08-03 08:04:05 +0400
committerDaniel Dunbar <daniel@zuster.org>2005-08-03 08:04:05 +0400
commit8a58197cf3f35fe5123721f4a2d8161f1147c3f2 (patch)
tree2ed9c5f310082b99f604bf39c4a3b6b9b85b0477 /source/blender/blenkernel/intern/CCGSubSurf.c
parentd02d09da84475013c36300de18d27e28c4b6b5e2 (diff)
- change modifier applyModifier[EM] function to not free derived argument
- added modifier_supportsMapping function - update CCG to set actual vertex normal (and not just interior face vertex normal, bla bla bla no one knows what this means nevermind). - renamed modifierType_get_info to modifierType_getInfo for consistency and to increase my commit line count. - update EditMeshDerivedMesh to calculate (and use new) normals when given deformed vertices - added - update editmode modifier calculation to also calculate a cage, not working 100% atm, in particular if a deformer follows a modifier that returns a DerivedMesh the cage is not accurate. - added ccg derivedmesh drawMapped{Vert,Face]NormalsEM functions - currently UI for selecting the cage mesh is rather irritating, will be updated
Diffstat (limited to 'source/blender/blenkernel/intern/CCGSubSurf.c')
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index ccc214284ac..e88137bc1c9 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -389,6 +389,9 @@ static int _vert_isBoundary(CCGVert *v) {
static void *_vert_getCo(CCGVert *v, int lvl, int dataSize) {
return &VERT_getLevelData(v)[lvl*dataSize];
}
+static float *_vert_getNo(CCGVert *v, int lvl, int dataSize, int normalDataOffset) {
+ return (float*) &VERT_getLevelData(v)[lvl*dataSize + normalDataOffset];
+}
static void _vert_free(CCGVert *v, CCGSubSurf *ss) {
CCGSUBSURF_free(ss, v->edges);
@@ -1839,15 +1842,29 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
}
}
}
+ // XXX can I reduce the number of normalisations here?
for (ptrIdx=0; ptrIdx<numEffectedV; ptrIdx++) {
CCGVert *v = (CCGVert*) effectedV[ptrIdx];
- float no[3] = {0};
+ float length, *no = _vert_getNo(v, lvl, vertDataSize, normalDataOffset);
+
+ NormZero(no);
for (i=0; i<v->numFaces; i++) {
CCGFace *f = v->faces[i];
NormAdd(no, FACE_getIFNo(f, lvl, _face_getVertIndex(f,v), gridSize-1, gridSize-1));
}
+ length = sqrt(no[0]*no[0] + no[1]*no[1] + no[2]*no[2]);
+
+ if (length>FLT_EPSILON) {
+ float invLength = 1.0f/length;
+ no[0] *= invLength;
+ no[1] *= invLength;
+ no[2] *= invLength;
+ } else {
+ NormZero(no);
+ }
+
for (i=0; i<v->numFaces; i++) {
CCGFace *f = v->faces[i];
NormCopy(FACE_getIFNo(f, lvl, _face_getVertIndex(f,v), gridSize-1, gridSize-1), no);