diff options
Diffstat (limited to 'source/blender/render/intern/raytrace')
8 files changed, 38 insertions, 18 deletions
diff --git a/source/blender/render/intern/raytrace/Makefile b/source/blender/render/intern/raytrace/Makefile index 6e40c544c6f..2da8038c610 100644 --- a/source/blender/render/intern/raytrace/Makefile +++ b/source/blender/render/intern/raytrace/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. @@ -63,3 +63,7 @@ endif ifeq ($(WITH_OPENEXR),true) CPPFLAGS += -DWITH_OPENEXR endif + +ifeq ($(WITH_BF_RAYOPTIMIZATION), true) + CPPFLAGS += -D__SSE__ +endif diff --git a/source/blender/render/intern/raytrace/bvh.h b/source/blender/render/intern/raytrace/bvh.h index e3efb90ec04..133a3d4a005 100644 --- a/source/blender/render/intern/raytrace/bvh.h +++ b/source/blender/render/intern/raytrace/bvh.h @@ -28,7 +28,6 @@ */ #include "rayobject.h" #include "raycounter.h" -#include "MEM_guardedalloc.h" #include "rayobject_rtbuild.h" #include "rayobject_hint.h" diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp index b9e9a46b1a9..84ec56e131a 100644 --- a/source/blender/render/intern/raytrace/rayobject.cpp +++ b/source/blender/render/intern/raytrace/rayobject.cpp @@ -497,12 +497,22 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max) else if(RE_rayobject_isVlakPrimitive(r)) { VlakPrimitive *face = (VlakPrimitive*) RE_rayobject_align(r); - VlakRen *vlr = face->face; + RayFace nface; + RE_rayface_from_vlak(&nface, face->ob, face->face); + + if(face->ob->transform_primitives) + { + mul_m4_v3(face->ob->mat, nface.v1); + mul_m4_v3(face->ob->mat, nface.v2); + mul_m4_v3(face->ob->mat, nface.v3); + if(RE_rayface_isQuad(&nface)) + mul_m4_v3(face->ob->mat, nface.v4); + } - DO_MINMAX( vlr->v1->co, min, max ); - DO_MINMAX( vlr->v2->co, min, max ); - DO_MINMAX( vlr->v3->co, min, max ); - if(vlr->v4) DO_MINMAX( vlr->v4->co, min, max ); + DO_MINMAX( nface.v1, min, max ); + DO_MINMAX( nface.v2, min, max ); + DO_MINMAX( nface.v3, min, max ); + if(RE_rayface_isQuad(&nface)) DO_MINMAX( nface.v4, min, max ); } else if(RE_rayobject_isRayAPI(r)) { diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp index cdc3be4c521..c510af540db 100644 --- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp @@ -26,6 +26,7 @@ * * ***** END GPL LICENSE BLOCK ***** */ +#include "MEM_guardedalloc.h" #include "vbvh.h" #include "svbvh.h" #include "reorganize.h" @@ -52,10 +53,10 @@ void bvh_done<QBVHTree>(QBVHTree *obj) rtbuild_done(obj->builder, &obj->rayobj.control); //TODO find a away to exactly calculate the needed memory - MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE); + MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "qbvh arena"); BLI_memarena_use_malloc(arena1); - MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE); + MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "qbvh arena 2"); BLI_memarena_use_malloc(arena2); BLI_memarena_use_align(arena2, 16); diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp index dcefb2072b8..1c3cdd5919f 100644 --- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp +++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp @@ -386,7 +386,9 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds) // right_cost -= obj[i]->cost; if(right_cost < 0) right_cost = 0; } - assert(baxis >= 0 && baxis < 3); + //assert(baxis >= 0 && baxis < 3); + if (!(baxis >= 0 && baxis < 3)) + baxis = 0; } @@ -456,8 +458,10 @@ float bb_area(float *min, float *max) sub[2] = max[2]-min[2]; a = (sub[0]*sub[1] + sub[0]*sub[2] + sub[1]*sub[2])*2; - assert(a >= 0.0); - return a; + /* used to have an assert() here on negative results + * however, in this case its likely some overflow or ffast math error. + * so just return 0.0f instead. */ + return a < 0.0f ? 0.0f : a; } int bb_largest_axis(float *min, float *max) diff --git a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp index 67af596e301..647c5771e4f 100644 --- a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp @@ -26,6 +26,8 @@ * * ***** END GPL LICENSE BLOCK ***** */ +#include "MEM_guardedalloc.h" + #include "vbvh.h" #include "svbvh.h" #include "reorganize.h" @@ -63,10 +65,10 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj) rtbuild_done(obj->builder, &obj->rayobj.control); //TODO find a away to exactly calculate the needed memory - MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE); + MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "svbvh arena"); BLI_memarena_use_malloc(arena1); - MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE); + MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "svbvh arena2"); BLI_memarena_use_malloc(arena2); BLI_memarena_use_align(arena2, 16); diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp index 0190b971d84..de1e6d349be 100644 --- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp @@ -76,7 +76,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj) rtbuild_done(obj->builder, &obj->rayobj.control); //TODO find a away to exactly calculate the needed memory - MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE); + MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "vbvh arena"); BLI_memarena_use_malloc(arena1); //Build and optimize the tree @@ -101,7 +101,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj) { /* TODO - MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE); + MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "vbvh arena2"); BLI_memarena_use_malloc(arena2); //Finds the optimal packing of this tree using a given cost model diff --git a/source/blender/render/intern/raytrace/reorganize.h b/source/blender/render/intern/raytrace/reorganize.h index 92667d8de62..7ef7296945c 100644 --- a/source/blender/render/intern/raytrace/reorganize.h +++ b/source/blender/render/intern/raytrace/reorganize.h @@ -269,7 +269,7 @@ void pushdown(Node *parent) /* * BVH refit - * reajust nodes BB (useful if nodes childs where modified) + * readjust nodes BB (useful if nodes childs where modified) */ template<class Node> float bvh_refit(Node *node) @@ -295,7 +295,7 @@ float bvh_refit(Node *node) /* - * this finds the best way to packing a tree acording to a given test cost function + * this finds the best way to packing a tree according to a given test cost function * with the purpose to reduce the expected cost (eg.: number of BB tests). */ #include <vector> |