- BGE crash fix when casting a ray to the same location as the object from python.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 27 Aug 2009 06:55:54 +0000 (06:55 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 27 Aug 2009 06:55:54 +0000 (06:55 +0000)
- Incorrect Mathutils vector docstrings.
- last rayshade commit had an incomplete comment.

source/blender/python/api2_2x/vector.c
source/blender/render/intern/source/rayshade.c
source/gameengine/Ketsji/KX_GameObject.cpp

index cb20636..a7e00e2 100644 (file)
@@ -58,8 +58,8 @@ struct PyMethodDef Vector_methods[] = {
        {"normalize", (PyCFunction) Vector_Normalize, METH_NOARGS, Vector_Normalize_doc},
        {"negate", (PyCFunction) Vector_Negate, METH_NOARGS, Vector_Negate_doc},
        {"resize2D", (PyCFunction) Vector_Resize2D, METH_NOARGS, Vector_Resize2D_doc},
-       {"resize3D", (PyCFunction) Vector_Resize3D, METH_NOARGS, Vector_Resize2D_doc},
-       {"resize4D", (PyCFunction) Vector_Resize4D, METH_NOARGS, Vector_Resize2D_doc},
+       {"resize3D", (PyCFunction) Vector_Resize3D, METH_NOARGS, Vector_Resize3D_doc},
+       {"resize4D", (PyCFunction) Vector_Resize4D, METH_NOARGS, Vector_Resize4D_doc},
        {"toTrackQuat", ( PyCFunction ) Vector_ToTrackQuat, METH_VARARGS, Vector_ToTrackQuat_doc},
        {"reflect", ( PyCFunction ) Vector_Reflect, METH_O, Vector_Reflect_doc},
        {"cross", ( PyCFunction ) Vector_Cross, METH_O, Vector_Dot_doc},
index 182e603..e683a49 100644 (file)
@@ -1240,7 +1240,9 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
                        
                        if(shi->combinedflag & SCE_PASS_REFLECT) {
                                /* values in shr->spec can be greater then 1.0.
-                                * in the case when it is 1.0 diff */
+                                * In this case the mircol uses a zero blending factor, so ignoring it is ok.
+                                * Fixes bug #18837 - when the spec is higher then 1.0,
+                                * diff can become a negative color - Campbell  */
                                
                                f1= 1.0f-i;
                                
index d04174a..ba89059 100644 (file)
@@ -2597,12 +2597,10 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
                }
        }
        MT_Point3 fromPoint = NodeGetWorldPosition();
+       
        if (dist != 0.0f)
-       {
-               MT_Vector3 toDir = toPoint-fromPoint;
-               toDir.normalize();
-               toPoint = fromPoint + (dist) * toDir;
-       }
+               toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized();
+       
        PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
        KX_IPhysicsController *spc = GetPhysicsController();
        KX_GameObject *parent = GetParent();