示例#1
0
  @Override
  public boolean shadow_hit(Ray ray, FloatRef tmin) {
    Ray inv_ray =
        new Ray(
            invTransform.transformPoint(ray.getOrigin()),
            invTransform.transformDirection(ray.getDirection()));

    return object.shadow_hit(inv_ray, tmin);
  }
示例#2
0
  @Override
  public boolean hit(Ray ray, ShadeRec sr, FloatRef tmin) {
    Ray inv_ray =
        new Ray(
            invTransform.transformPoint(ray.getOrigin()),
            invTransform.transformDirection(ray.getDirection()));

    if (object.hit(inv_ray, sr, tmin)) {
      Matrix4 transform = Matrix4.inverse(invTransform);
      sr.worldHitPoint = transform.transformPoint(sr.worldHitPoint);
      sr.normal = invTransform.transformNormal(sr.normal);
      return true;
    }

    return false;
  }