Beispiel #1
0
void
Scene::preCalc()
{
    Objects::iterator it;
    for (it = m_objects.begin(); it != m_objects.end(); it++)
    {
        Object* pObject = *it;
        pObject->preCalc();
    }
    Lights::iterator lit;
    float total_wattage = 0.f;
    for (lit = m_lights.begin(); lit != m_lights.end(); lit++)
    {
        PointLight* pLight = *lit;
        pLight->preCalc();
        total_wattage += pLight->wattage();
    }

    m_bvh.build(&m_objects);

    delete g_global_illum_map;
    g_global_illum_map = new Photon_map(m_global_photons);
    delete g_caustics_map;
    g_caustics_map = new Photon_map(m_caustics_photons);
    g_caustics_map->setCaustics(true);

    printf("Caustics map:\n");
    sampleMap(g_caustics_map, m_caustics_photons, total_wattage);
    printf("Global illum map:\n");
    sampleMap(g_global_illum_map, m_global_photons, total_wattage);
}
Beispiel #2
0
void
Scene::preCalc()
{
    Objects::iterator it;
    for (it = m_objects.begin(); it != m_objects.end(); it++)
    {
        Object* pObject = *it;
        pObject->preCalc();
    }
    Lights::iterator lit;
    for (lit = m_lights.begin(); lit != m_lights.end(); lit++)
    {
        PointLight* pLight = *lit;
        pLight->preCalc();
    }

    m_bvh.build(&m_objects);
}