Esempio n. 1
0
bool BaseGroup::create_optimized_osl_shader_groups(
    OSL::ShadingSystem& shading_system,
    IAbortSwitch*       abort_switch)
{
    bool success = true;

    for (each<AssemblyContainer> i = assemblies(); i; ++i)
    {
        if (is_aborted(abort_switch))
            return true;

        success = success && i->create_optimized_osl_shader_groups(
            shading_system,
            abort_switch);
    }

    for (each<ShaderGroupContainer> i = shader_groups(); i; ++i)
    {
        if (is_aborted(abort_switch))
            return true;

        success = success && i->create_optimized_osl_shader_group(
            shading_system,
            abort_switch);
    }

    return success;
}
Esempio n. 2
0
bool Assembly::on_frame_begin(
    const Project&      project,
#ifdef WITH_OSL
    OSL::ShadingSystem& shading_system,
#endif
    AbortSwitch*        abort_switch)
{
    bool success = true;

    success = success && invoke_on_frame_begin(project, texture_instances(), abort_switch);
    success = success && invoke_on_frame_begin(project, *this, surface_shaders(), abort_switch);
    success = success && invoke_on_frame_begin(project, *this, bsdfs(), abort_switch);
    success = success && invoke_on_frame_begin(project, *this, edfs(), abort_switch);

#ifdef WITH_OSL
    success = success && invoke_on_frame_begin(project, *this, shading_system, shader_groups(), abort_switch);
#endif

    success = success && invoke_on_frame_begin(project, *this, materials(), abort_switch);
    success = success && invoke_on_frame_begin(project, *this, lights(), abort_switch);

    success = success && invoke_on_frame_begin(project, *this, object_instances(), abort_switch);

#ifdef WITH_OSL
    success = success && invoke_on_frame_begin(project, assemblies(), shading_system, abort_switch);
#else
    success = success && invoke_on_frame_begin(project, assemblies(), abort_switch);
#endif

    success = success && invoke_on_frame_begin(project, assembly_instances(), abort_switch);

    return success;
}
Esempio n. 3
0
void BaseGroup::release_optimized_osl_shader_groups()
{
    for (each<AssemblyContainer> i = assemblies(); i; ++i)
        i->release_optimized_osl_shader_groups();

    for (each<ShaderGroupContainer> i = shader_groups(); i; ++i)
        i->release_optimized_osl_shader_group();
}
Esempio n. 4
0
void BaseGroup::update_asset_paths(const StringDictionary& mappings)
{
    do_update_asset_paths(mappings, colors());
    do_update_asset_paths(mappings, textures());
    do_update_asset_paths(mappings, texture_instances());
#ifdef APPLESEED_WITH_OSL
    do_update_asset_paths(mappings, shader_groups());
#endif
    do_update_asset_paths(mappings, assemblies());
    do_update_asset_paths(mappings, assembly_instances());
}
Esempio n. 5
0
void BaseGroup::collect_asset_paths(StringArray& paths) const
{
    do_collect_asset_paths(paths, colors());
    do_collect_asset_paths(paths, textures());
    do_collect_asset_paths(paths, texture_instances());
#ifdef APPLESEED_WITH_OSL
    do_collect_asset_paths(paths, shader_groups());
#endif
    do_collect_asset_paths(paths, assemblies());
    do_collect_asset_paths(paths, assembly_instances());
}
Esempio n. 6
0
void Assembly::on_frame_end(const Project& project)
{
    invoke_on_frame_end(project, assembly_instances());
    invoke_on_frame_end(project, assemblies());
    invoke_on_frame_end(project, object_instances());
    invoke_on_frame_end(project, *this, lights());
    invoke_on_frame_end(project, *this, materials());
#ifdef WITH_OSL
    invoke_on_frame_end(project, *this, shader_groups());
#endif
    invoke_on_frame_end(project, *this, edfs());
    invoke_on_frame_end(project, *this, bsdfs());
    invoke_on_frame_end(project, *this, surface_shaders());
    invoke_on_frame_end(project, texture_instances());
}
Esempio n. 7
0
bool Scene::on_frame_begin(
    const Project&          project,
    const BaseGroup*        parent,
    OnFrameBeginRecorder&   recorder,
    IAbortSwitch*           abort_switch)
{
    if (!Entity::on_frame_begin(project, parent, recorder, abort_switch))
        return false;

    m_camera = project.get_uncached_active_camera();

    // Fail if we don't have a camera.
    if (m_camera == 0)
    {
        RENDERER_LOG_ERROR("no cameras in scene or no camera specified in the frame entity.");
        return false;
    }

    bool success = true;

    success = success && impl->m_default_surface_shader->on_frame_begin(project, this, recorder, abort_switch);

    success = success && invoke_on_frame_begin(project, this, colors(), recorder, abort_switch);
    success = success && invoke_on_frame_begin(project, this, textures(), recorder, abort_switch);
    success = success && invoke_on_frame_begin(project, this, texture_instances(), recorder, abort_switch);
    success = success && invoke_on_frame_begin(project, this, shader_groups(), recorder, abort_switch);

    success = success && invoke_on_frame_begin(project, this, cameras(), recorder, abort_switch);
    success = success && invoke_on_frame_begin(project, this, environment_edfs(), recorder, abort_switch);
    success = success && invoke_on_frame_begin(project, this, environment_shaders(), recorder, abort_switch);

    if (!is_aborted(abort_switch) && impl->m_environment.get())
        success = success && impl->m_environment->on_frame_begin(project, this, recorder, abort_switch);

    success = success && invoke_on_frame_begin(project, this, assemblies(), recorder, abort_switch);
    success = success && invoke_on_frame_begin(project, this, assembly_instances(), recorder, abort_switch);

    return success;
}