Subversion Repositories gelsvn

Rev

Rev 313 | Rev 319 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 313 Rev 314
Line 371... Line 371...
371
    // don’t prefetch here, assume data has already been prefetched
371
    // don’t prefetch here, assume data has already been prefetched
372
    // start high-latency division as early as possible
372
    // start high-latency division as early as possible
373
    const double nd = 1.0/((double)ray.direction[acc.k]	+ (double)acc.n_u * (double)ray.direction[ku] + (double)acc.n_v * (double)ray.direction[kv]);
373
    const double nd = 1.0/((double)ray.direction[acc.k]	+ (double)acc.n_u * (double)ray.direction[ku] + (double)acc.n_v * (double)ray.direction[kv]);
374
    const double f = ((double)acc.n_d - (double)ray.origin[acc.k]	- (double)acc.n_u * (double)ray.origin[ku] - (double)acc.n_v * (double)ray.origin[kv]) * nd;
374
    const double f = ((double)acc.n_d - (double)ray.origin[acc.k]	- (double)acc.n_u * (double)ray.origin[ku] - (double)acc.n_v * (double)ray.origin[kv]) * nd;
375
    // check for valid distance.
375
    // check for valid distance.
376
    if (!(t_max > f && f > f_eps)||ray.dist<f) return false;
376
    if (!(t_max > f && f > 0.001)||ray.dist<f) return false;
377
    // compute hitpoint positions on uv plane
377
    // compute hitpoint positions on uv plane
378
    const double hu = (ray.origin[ku] + f * ray.direction[ku]);
378
    const double hu = (ray.origin[ku] + f * ray.direction[ku]);
379
    const double hv = (ray.origin[kv] + f * ray.direction[kv]);
379
    const double hv = (ray.origin[kv] + f * ray.direction[kv]);
380
    // check first barycentric coordinate
380
    // check first barycentric coordinate
381
    const double lambda = (hu * (double)acc.b_nu + hv * (double)acc.b_nv + (double)acc.b_d);
381
    const double lambda = (hu * (double)acc.b_nu + hv * (double)acc.b_nv + (double)acc.b_d);