From 0511c6ca1e565cd9d53a52259dd2a04409ca7bb1 Mon Sep 17 00:00:00 2001 From: "re.kovalev" Date: Tue, 2 Jan 2024 20:15:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B0=20=D1=80?= =?UTF-8?q?=D0=B5=D0=BD=D0=B4=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/Scene.h | 2 +- src/Scene.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/Scene.h b/include/Scene.h index cd27a6f..2d59f7e 100644 --- a/include/Scene.h +++ b/include/Scene.h @@ -24,7 +24,7 @@ class Scene Scene(const Scene ©); // Конструктор копирования Scene& operator=(const Scene& other); // Оператор присваивания - void render(ShaderProgram &shaderProgram, UBO &material_buffer); // Рендер сцены + void render(ShaderProgram &shaderProgram, UBO &material_buffer, bool recalc_animations = false); // Рендер сцены void set_group_id(GLuint64 id, GLuint etc = 0); // Изменение флага записи идентификатора для всех моделей diff --git a/src/Scene.cpp b/src/Scene.cpp index ab6d81c..a58e576 100644 --- a/src/Scene.cpp +++ b/src/Scene.cpp @@ -30,9 +30,16 @@ Scene& Scene::operator=(const Scene& other) } // Рендер сцены -void Scene::render(ShaderProgram &shaderProgram, UBO &material_buffer) +void Scene::render(ShaderProgram &shaderProgram, UBO &material_buffer, bool recalc_animations) { - for (auto & model : models) + // Если требуется пересчитаем анимации + if (recalc_animations) + for (auto & animation : animations) + if (animation.isEnabled()) + animation.process(); + + // Рендер моделей + for (auto & model : models) model.render(shaderProgram, material_buffer); }