[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23040] branches/soc-2009-jaguarandi/ source/blender/render: Bug fix (layers and some other checks were disabled)
Andre Susano Pinto
andresusanopinto at gmail.com
Mon Sep 7 02:58:17 CEST 2009
Revision: 23040
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23040
Author: jaguarandi
Date: 2009-09-07 02:58:17 +0200 (Mon, 07 Sep 2009)
Log Message:
-----------
Bug fix (layers and some other checks were disabled)
*bug found and isolated by ZanQdo (Daniel Salazar)
Modified Paths:
--------------
branches/soc-2009-jaguarandi/source/blender/render/extern/include/RE_raytrace.h
branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayobject.c
branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayshade.c
Modified: branches/soc-2009-jaguarandi/source/blender/render/extern/include/RE_raytrace.h
===================================================================
--- branches/soc-2009-jaguarandi/source/blender/render/extern/include/RE_raytrace.h 2009-09-06 23:15:43 UTC (rev 23039)
+++ branches/soc-2009-jaguarandi/source/blender/render/extern/include/RE_raytrace.h 2009-09-07 00:58:17 UTC (rev 23040)
@@ -178,7 +178,8 @@
#define RE_SKIP_CULLFACE (1 << 0)
/* if using this flag then *face should be a pointer to a VlakRen */
-#define RE_SKIP_VLR_NEIGHBOUR (1 << 1)
+#define RE_SKIP_VLR_NEIGHBOUR (1 << 1)
+#define RE_SKIP_VLR_RENDER_CHECK (1 << 2)
/* TODO use: FLT_MAX? */
#define RE_RAYTRACE_MAXDIST 1e33
Modified: branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayobject.c
===================================================================
--- branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayobject.c 2009-09-06 23:15:43 UTC (rev 23039)
+++ branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayobject.c 2009-09-07 00:58:17 UTC (rev 23040)
@@ -141,7 +141,21 @@
return 0;
}
+#include "DNA_material_types.h"
+static int vlr_check_intersect(Isect *is, ObjectInstanceRen *obi, VlakRen *vlr)
+{
+ /* for baking selected to active non-traceable materials might still
+ * be in the raytree */
+ if(!(vlr->mat->mode & MA_TRACEBLE))
+ return 0;
+ /* I know... cpu cycle waste, might do smarter once */
+ if(is->mode==RE_RAY_MIRROR)
+ return !(vlr->mat->mode & MA_ONLYCAST);
+ else
+ return (is->lay & obi->lay);
+}
+
/* ray - triangle or quad intersection */
/* this function shall only modify Isect if it detects an hit */
static int intersect_rayface(RayFace *face, Isect *is)
@@ -154,6 +168,12 @@
if(is->orig.ob == face->ob && is->orig.face == face->face)
return 0;
+
+ if(is->skip & RE_SKIP_VLR_RENDER_CHECK)
+ {
+ if(vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face ) == 0)
+ return 0;
+ }
RE_RC_COUNT(is->raycounter->faces.test);
Modified: branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayshade.c
===================================================================
--- branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayshade.c 2009-09-06 23:15:43 UTC (rev 23039)
+++ branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayshade.c 2009-09-07 00:58:17 UTC (rev 23040)
@@ -116,25 +116,6 @@
RayCounter re_rc_counter[BLENDER_MAX_THREADS] = {};
#endif
-#if 0
-static int vlr_check_intersect(Isect *is, int ob, RayFace *face)
-{
- ObjectInstanceRen *obi= RAY_OBJECT_GET((Render*)is->userdata, ob);
- VlakRen *vlr = (VlakRen*)face;
-
- /* for baking selected to active non-traceable materials might still
- * be in the raytree */
- if(!(vlr->mat->mode & MA_TRACEBLE))
- return 0;
-
- /* I know... cpu cycle waste, might do smarter once */
- if(is->mode==RE_RAY_MIRROR)
- return !(vlr->mat->mode & MA_ONLYCAST);
- else
- return (is->lay & obi->lay);
-}
-#endif
-
void freeraytree(Render *re)
{
ObjectInstanceRen *obi;
@@ -602,7 +583,7 @@
VECCOPY(isec.vec, vec );
isec.labda = dist_mir > 0 ? dist_mir : RE_RAYTRACE_MAXDIST;
isec.mode= RE_RAY_MIRROR;
- isec.skip = RE_SKIP_VLR_NEIGHBOUR;
+ isec.skip = RE_SKIP_VLR_NEIGHBOUR | RE_SKIP_VLR_RENDER_CHECK;
isec.hint = 0;
isec.orig.ob = obi;
@@ -1725,7 +1706,7 @@
RE_RC_INIT(isec, *shi);
isec.orig.ob = shi->obi;
isec.orig.face = shi->vlr;
- isec.skip = RE_SKIP_VLR_NEIGHBOUR;
+ isec.skip = RE_SKIP_VLR_NEIGHBOUR | RE_SKIP_VLR_RENDER_CHECK;
isec.hint = 0;
isec.hit.ob = 0;
@@ -1866,7 +1847,7 @@
RE_RC_INIT(isec, *shi);
isec.orig.ob = shi->obi;
isec.orig.face = shi->vlr;
- isec.skip = RE_SKIP_VLR_NEIGHBOUR;
+ isec.skip = RE_SKIP_VLR_NEIGHBOUR | RE_SKIP_VLR_RENDER_CHECK;
isec.hint = 0;
isec.hit.ob = 0;
@@ -2087,7 +2068,7 @@
RE_rayobject_hint_bb( R.raytree, &bb_hint, min, max);
isec->hint = &bb_hint;
- isec->skip = RE_SKIP_VLR_NEIGHBOUR;
+ isec->skip = RE_SKIP_VLR_NEIGHBOUR | RE_SKIP_VLR_RENDER_CHECK;
VECCOPY(vec, lampco);
while (samples < max_samples) {
@@ -2256,7 +2237,7 @@
isec->vec[1] = vec[1]+lampco[1]-isec->start[1];
isec->vec[2] = vec[2]+lampco[2]-isec->start[2];
isec->labda = 1.0f;
- isec->skip = RE_SKIP_VLR_NEIGHBOUR;
+ isec->skip = RE_SKIP_VLR_NEIGHBOUR | RE_SKIP_VLR_RENDER_CHECK;
if(isec->mode==RE_RAY_SHADOW_TRA) {
/* isec.col is like shadfac, so defines amount of light (0.0 is full shadow) */
More information about the Bf-blender-cvs
mailing list