@Override
    public boolean hit(Ray ray, ShadeRec sr, FloatRef tmin) {
        if (bounds != null && !bounds.hit(ray))
            return false;

        Vector3 normal = null;
        Vector3 worldHitPoint = null;
        Vector3 localHitPoint = null;
        float tMin = Float.MAX_VALUE;
        boolean hit = false;

        for (GeometricObject obj : objects) {
            FloatRef fr = new FloatRef();
            if (obj.hit(ray, sr, fr) && fr.value < tMin) {
                hit = true;
                tMin = fr.value;
                //sr.material = obj.getMaterial();
                normal = sr.normal;
                worldHitPoint = sr.worldHitPoint;
                localHitPoint = sr.localHitPoint;
            }
        }

        if (hit) {
            tmin.value = tMin;
            sr.normal = normal;
            sr.worldHitPoint = worldHitPoint;
            sr.localHitPoint = localHitPoint;
        }
        return hit;
    }