From: havoc Date: Tue, 2 Mar 2004 02:27:59 +0000 (+0000) Subject: fix the inverted bumps on some surfaces (no longer uses CrossProduct to get the svector) X-Git-Tag: xonotic-v0.1.0preview~6049 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=3906ee88f870a0d0f8cd95eac2c7f80c624aea86 fix the inverted bumps on some surfaces (no longer uses CrossProduct to get the svector) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3953 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_shared.c b/model_shared.c index 766ab18f..1eb8d34e 100644 --- a/model_shared.c +++ b/model_shared.c @@ -625,7 +625,13 @@ void Mod_BuildBumpVectors(const float *v0, const float *v1, const float *v2, con f = -DotProduct(tvector3f, normal3f); VectorMA(tvector3f, f, normal3f, tvector3f); VectorNormalize(tvector3f); - CrossProduct(normal3f, tvector3f, svector3f); + // note: can't be a CrossProduct as that sometimes flips the texture + svector3f[0] = ((tc1[1] - tc0[1]) * (v2[0] - v0[0]) - (tc2[1] - tc0[1]) * (v1[0] - v0[0])); + svector3f[1] = ((tc1[1] - tc0[1]) * (v2[1] - v0[1]) - (tc2[1] - tc0[1]) * (v1[1] - v0[1])); + svector3f[2] = ((tc1[1] - tc0[1]) * (v2[2] - v0[2]) - (tc2[1] - tc0[1]) * (v1[2] - v0[2])); + f = -DotProduct(svector3f, normal3f); + VectorMA(svector3f, f, normal3f, svector3f); + VectorNormalize(svector3f); } // warning: this is an expensive function!