From ca6a789b589a985f3d0d0fb368ed7a1882d5db7e Mon Sep 17 00:00:00 2001 From: malc Date: Sun, 9 Nov 2008 01:01:15 +0300 Subject: [PATCH] Hack for negative weights present in most head models --- skin.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/skin.c b/skin.c index 6d1a66b..30eb3c2 100644 --- a/skin.c +++ b/skin.c @@ -172,12 +172,14 @@ static void translate (State *s, float *vdst, float *ndst) for (i = 0; i < s->num_vertices; ++i, vsrc += 3, nsrc += 3, vdst += 3, ndst += 3, ++skin) { + int z = 0; float v[3] = {0,0,0}, n[3] = {0,0,0}, v0[3], v1[3], v2[3], w, m[12]; for (j = 0; j < skin->num_bones; ++j) { w = skin->weights[j] + 0.000011; b = &s->bones[skin->boneindices[j]]; + if (w < 0.0) z = 1; vsub (v0, vsrc, b->mv); mapply_to_vector (v1, b->im, v0); @@ -190,6 +192,8 @@ static void translate (State *s, float *vdst, float *ndst) vaddto (n, v1); } + /* hack hack */ + if (z) vcopy (v, vsrc); vcopy (vdst, v); vcopy (ndst, n); } -- 2.11.4.GIT