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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-04-10 16:52:48 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-04-10 16:52:48 +0400
commit8b2b470d44d90997eccb1a357118cef057978ff2 (patch)
tree3923f21cce11a8ac698b906e969c0bb9f5c1aa71 /source/blender/blenlib
parent1fe5302cce8de1bad875ad29a3fcff06d0c59654 (diff)
Fix for bug #8898: QMC AO not working correct on objects pointing
directly at the camera in some cases.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/arithb.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c
index d4a1b3a8bfc..c2cb9c30b7b 100644
--- a/source/blender/blenlib/intern/arithb.c
+++ b/source/blender/blenlib/intern/arithb.c
@@ -2116,8 +2116,9 @@ void VecMulf(float *v1, float f)
void VecOrthoBasisf(float *v, float *v1, float *v2)
{
- if (v[0] == 0.0f && v[1] == 0.0f)
- {
+ float f = sqrt(v[0]*v[0] + v[1]*v[1]);
+
+ if (f < 1e-35f) {
// degenerate case
v1[0] = 0.0f; v1[1] = 1.0f; v1[2] = 0.0f;
if (v[2] > 0.0f) {
@@ -2127,9 +2128,8 @@ void VecOrthoBasisf(float *v, float *v1, float *v2)
v2[0] = -1.0f; v2[1] = v2[2] = 0.0f;
}
}
- else
- {
- float f = 1.0f/sqrt(v[0]*v[0] + v[1]*v[1]);
+ else {
+ f = 1.0f/f;
v1[0] = v[1]*f;
v1[1] = -v[0]*f;
v1[2] = 0.0f;