Listing the "Blender Foundation" as copyright holder implied the Blender Foundation holds copyright to files which may include work from many developers. While keeping copyright on headers makes sense for isolated libraries, Blender's own code may be refactored or moved between files in a way that makes the per file copyright holders less meaningful. Copyright references to the "Blender Foundation" have been replaced with "Blender Authors", with the exception of `./extern/` since these this contains libraries which are more isolated, any changed to license headers there can be handled on a case-by-case basis. Some directories in `./intern/` have also been excluded: - `./intern/cycles/` it's own `AUTHORS` file is planned. - `./intern/opensubdiv/`. An "AUTHORS" file has been added, using the chromium projects authors file as a template. Design task: #110784 Ref !110783.
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#include "BLI_rect.h"
|
|
|
|
#include "DNA_vec_types.h"
|
|
|
|
#include "COM_context.hh"
|
|
#include "COM_static_cache_manager.hh"
|
|
#include "COM_static_shader_manager.hh"
|
|
#include "COM_texture_pool.hh"
|
|
|
|
namespace blender::realtime_compositor {
|
|
|
|
Context::Context(TexturePool &texture_pool) : texture_pool_(texture_pool) {}
|
|
|
|
int2 Context::get_compositing_region_size() const
|
|
{
|
|
const rcti compositing_region = get_compositing_region();
|
|
return int2(BLI_rcti_size_x(&compositing_region), BLI_rcti_size_y(&compositing_region));
|
|
}
|
|
|
|
float Context::get_render_percentage() const
|
|
{
|
|
return get_render_data().size / 100.0f;
|
|
}
|
|
|
|
int Context::get_frame_number() const
|
|
{
|
|
return get_render_data().cfra;
|
|
}
|
|
|
|
float Context::get_time() const
|
|
{
|
|
const float frame_number = float(get_frame_number());
|
|
const float frame_rate = float(get_render_data().frs_sec) /
|
|
float(get_render_data().frs_sec_base);
|
|
return frame_number / frame_rate;
|
|
}
|
|
|
|
TexturePool &Context::texture_pool()
|
|
{
|
|
return texture_pool_;
|
|
}
|
|
|
|
StaticShaderManager &Context::shader_manager()
|
|
{
|
|
return shader_manager_;
|
|
}
|
|
|
|
StaticCacheManager &Context::cache_manager()
|
|
{
|
|
return cache_manager_;
|
|
}
|
|
|
|
} // namespace blender::realtime_compositor
|