Example #1
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;
}
Example #2
0
bool Scene::on_frame_begin(
    const Project&          project, 
#ifdef WITH_OSL
    OSL::ShadingSystem*     shading_system,
#endif            
    AbortSwitch*            abort_switch)
{
    bool success = true;

    if (impl->m_camera.get())
        success = success && impl->m_camera->on_frame_begin(project, abort_switch);

    success = success && invoke_on_frame_begin(project, texture_instances(), abort_switch);
    success = success && invoke_on_frame_begin(project, environment_edfs(), abort_switch);
    success = success && invoke_on_frame_begin(project, environment_shaders(), abort_switch);

    if (is_aborted(abort_switch))
        return success;

    if (impl->m_environment.get())
        success = success && impl->m_environment->on_frame_begin(project, 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;
}
Example #3
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;
}
Example #4
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();
}
Example #5
0
void Scene::on_frame_end(const Project& project)
{
    invoke_on_frame_end(project, assemblies());
    invoke_on_frame_end(project, environment_shaders());
    invoke_on_frame_end(project, environment_edfs());

    impl->m_camera->on_frame_end(project);
}
Example #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, *this, lights());
    invoke_on_frame_end(project, *this, materials());
    invoke_on_frame_end(project, *this, edfs());
    invoke_on_frame_end(project, *this, bsdfs());
    invoke_on_frame_end(project, *this, surface_shaders());
}
Example #7
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());
}
Example #8
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());
}
Example #9
0
bool Scene::expand_procedural_assemblies(
    const Project&          project,
    IAbortSwitch*           abort_switch)
{
    for (each<AssemblyContainer> i = assemblies(); i; ++i)
    {
        if (!invoke_procedural_expand(*i, project, 0, abort_switch))
            return false;
    }

    return true;
}
Example #10
0
bool Scene::uses_alpha_mapping() const
{
    set<UniqueID> visited_assemblies;

    for (const_each<AssemblyContainer> i = assemblies(); i; ++i)
    {
        if (assembly_uses_alpha_mapping(*i, visited_assemblies))
            return true;
    }

    return false;
}
Example #11
0
bool Assembly::on_frame_begin(const Project& project)
{
    bool success = true;

    success = success && invoke_on_frame_begin(project, *this, surface_shaders());
    success = success && invoke_on_frame_begin(project, *this, bsdfs());
    success = success && invoke_on_frame_begin(project, *this, edfs());
    success = success && invoke_on_frame_begin(project, *this, materials());
    success = success && invoke_on_frame_begin(project, *this, lights());
    success = success && invoke_on_frame_begin(project, assemblies());
    success = success && invoke_on_frame_begin(project, assembly_instances());

    return success;
}
Example #12
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());
}
Example #13
0
void Scene::on_frame_end(const Project& project)
{
    invoke_on_frame_end(project, assembly_instances());
    invoke_on_frame_end(project, assemblies());

    if (impl->m_environment.get())
        impl->m_environment->on_frame_end(project);

    invoke_on_frame_end(project, environment_shaders());
    invoke_on_frame_end(project, environment_edfs());
    invoke_on_frame_end(project, texture_instances());

    if (impl->m_camera.get())
        impl->m_camera->on_frame_end(project);
}
Example #14
0
bool Scene::on_frame_begin(
    const Project&          project,
    IAbortSwitch*           abort_switch)
{
    bool success = true;

    if (impl->m_camera.get())
        success = success && impl->m_camera->on_frame_begin(project, abort_switch);

    success = success && invoke_on_frame_begin(project, textures(), abort_switch);
    success = success && invoke_on_frame_begin(project, texture_instances(), abort_switch);
    success = success && invoke_on_frame_begin(project, environment_edfs(), abort_switch);
    success = success && invoke_on_frame_begin(project, environment_shaders(), abort_switch);

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

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

    return success;
}
Example #15
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;
}