Ejemplo n.º 1
0
float Quad::approximateRadiance(uint32 /*threadIndex*/, const Vec3f &p) const
{
    if (!isEmissive())
        return 0.0f;
    Vec3f R0 = _base - p;

    if (R0.dot(_frame.normal) >= 0.0f)
        return 0.0f;

    Vec3f R1 = R0 + _edge0;
    Vec3f R2 = R1 + _edge1;
    Vec3f R3 = R0 + _edge1;
    Vec3f n0 = R0.cross(R1).normalized();
    Vec3f n1 = R1.cross(R2).normalized();
    Vec3f n2 = R2.cross(R3).normalized();
    Vec3f n3 = R3.cross(R0).normalized();
    float Q =
          std::acos(n0.dot(n1))
        + std::acos(n1.dot(n2))
        + std::acos(n2.dot(n3))
        + std::acos(n3.dot(n0));

    return (TWO_PI - std::abs(Q))*_emission->average().max();
}
Ejemplo n.º 2
0
float Sphere::approximateRadiance(uint32 /*threadIndex*/, const Vec3f &p) const
{
    if (!isEmissive())
        return 0.0f;
    return solidAngle(p)*_emission->average().max();
}