diff options
Diffstat (limited to 'source/blender/render/intern/raytrace/rayobject.cpp')
-rw-r--r-- | source/blender/render/intern/raytrace/rayobject.cpp | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp index a85a3255a7b..84ec56e131a 100644 --- a/source/blender/render/intern/raytrace/rayobject.cpp +++ b/source/blender/render/intern/raytrace/rayobject.cpp @@ -165,6 +165,11 @@ static inline int vlr_check_intersect_solid(Isect *is, ObjectInstanceRen* obi, V return 0; } +static inline int vlr_check_bake(Isect *is, ObjectInstanceRen* obi, VlakRen *vlr) +{ + return (obi->obr->ob != is->userdata); +} + static inline int rayface_check_cullface(RayFace *face, Isect *is) { float nor[3]; @@ -189,17 +194,24 @@ static int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *is) if(is->orig.ob == face->ob && is->orig.face == face->face) return 0; - + /* check if we should intersect this face */ if(is->skip & RE_SKIP_VLR_RENDER_CHECK) { if(vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face ) == 0) return 0; } - if(is->skip & RE_SKIP_VLR_NON_SOLID_MATERIAL) + else if(is->skip & RE_SKIP_VLR_NON_SOLID_MATERIAL) { + if(vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face ) == 0) + return 0; if(vlr_check_intersect_solid(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0) return 0; } + else if(is->skip & RE_SKIP_VLR_BAKE_CHECK) { + if(vlr_check_bake(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face ) == 0) + return 0; + } + if(is->skip & RE_SKIP_CULLFACE) { if(rayface_check_cullface(face, is) == 0) @@ -321,7 +333,7 @@ static int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *is) RE_RC_COUNT(is->raycounter->faces.hit); - is->isect= ok; // wich half of the quad + is->isect= ok; // which half of the quad is->labda= labda; is->u= u; is->v= v; @@ -450,6 +462,7 @@ int RE_rayobject_intersect(RayObject *r, Isect *i) return r->api->raycast( r, i ); } else assert(0); + return 0; /* wont reach this, quiet compilers */ } void RE_rayobject_add(RayObject *r, RayObject *o) @@ -484,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)) { |