@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; }
@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); }