* Fixed a crash with using light cache on a plane (which doesn't really make sense, but shouldn't crash at least)

This commit is contained in:
Matt Ebb
2008-10-22 00:09:12 +00:00
parent b12d9bfa9c
commit 094fda8cd9
2 changed files with 6 additions and 3 deletions

View File

@@ -245,7 +245,7 @@ static float D(ShadeInput *shi, int rgb, int x, int y, int z)
const int res = shi->mat->vol_precache_resolution;
CLAMP(x, 0, res-1);
CLAMP(y, 0, res-1);
CLAMP(y, 0, res-1);
CLAMP(z, 0, res-1);
return shi->obi->volume_precache[rgb*res*res*res + x*res*res + y*res + z];
}
@@ -864,12 +864,13 @@ void vol_precache_objectinstance(Render *re, ObjectInstanceRen *obi, Material *m
float i = 1.0f;
double time, lasttime= PIL_check_seconds_timer();
const int res = ma->vol_precache_resolution;
RayTree *tree;
R = *re;
/* create a raytree with just the faces of the instanced ObjectRen,
* used for checking if the cached point is inside or outside. */
RayTree *tree = create_raytree_obi(obi, bbmin, bbmax);
tree = create_raytree_obi(obi, bbmin, bbmax);
if (!tree) return;
/* Need a shadeinput to calculate scattering */
@@ -893,6 +894,8 @@ void vol_precache_objectinstance(Render *re, ObjectInstanceRen *obi, Material *m
res_3f = (float)res_3;
VecSubf(voxel, bbmax, bbmin);
if ((voxel[0] < FLT_EPSILON) || (voxel[1] < FLT_EPSILON) || (voxel[2] < FLT_EPSILON))
return;
VecMulf(voxel, 1.0f/res);
obi->volume_precache = MEM_callocN(sizeof(float)*res_3*3, "volume light cache");

View File

@@ -1550,7 +1550,7 @@ static int node_composit_buts_vecblur(uiBlock *block, bNodeTree *ntree, bNode *n
&nbd->maxspeed, 0, 1024, 0, 0, "If not zero, maximum speed in pixels");
uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "BlurFac:",
butr->xmin, dy+19, dx, 19,
&nbd->fac, 0.0f, 2.0f, 10, 2, "Scaling factor for motion vectors, actually 'shutter speed' in frames");
&nbd->fac, 0.0f, 10.0f, 10, 2, "Scaling factor for motion vectors, actually 'shutter speed' in frames");
uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Curved",
butr->xmin, dy, dx, 19,
&nbd->curved, 0.0f, 2.0f, 10, 2, "Interpolate between frames in a bezier curve, rather than linearly");