Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/compositor/realtime_compositor/intern/context.cc')
-rw-r--r--source/blender/compositor/realtime_compositor/intern/context.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/compositor/realtime_compositor/intern/context.cc b/source/blender/compositor/realtime_compositor/intern/context.cc
new file mode 100644
index 00000000000..64ac29af3d1
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/intern/context.cc
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "COM_context.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)
+{
+}
+
+int Context::get_frame_number() const
+{
+ return get_scene()->r.cfra;
+}
+
+float Context::get_time() const
+{
+ const float frame_number = static_cast<float>(get_frame_number());
+ const float frame_rate = static_cast<float>(get_scene()->r.frs_sec) /
+ static_cast<float>(get_scene()->r.frs_sec_base);
+ return frame_number / frame_rate;
+}
+
+TexturePool &Context::texture_pool()
+{
+ return texture_pool_;
+}
+
+StaticShaderManager &Context::shader_manager()
+{
+ return shader_manager_;
+}
+
+} // namespace blender::realtime_compositor