Skip to content

Commit

Permalink
🧼 [Particles] Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesFouchy committed Jan 12, 2024
1 parent b1e1e6d commit 927cbae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
12 changes: 3 additions & 9 deletions src/Module/ShaderBased/set_uniforms_for_shader_based_module.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
#include "set_uniforms_for_shader_based_module.h"
#include <variant>
#include "Cool/Camera/CameraShaderU.h"
#include "Cool/ColorSpaces/ColorAndAlphaSpace.h"
#include "Cool/ColorSpaces/ColorSpace.h"
#include "Cool/Dependencies/Input.h"
#include "Cool/Gpu/TextureLibrary_FromFile.h"
#include "Cool/StrongTypes/set_uniform.h"
#include "Nodes/Node.h"

namespace Lab {

auto valid_property_name(
std::string const& name,
reg::AnyId const& property_default_variable_id
) -> std::string;
auto valid_property_name(std::string const& name, reg::AnyId const& property_default_variable_id) -> std::string;

template<typename T>
static void send_uniform(Cool::Input<T> const& input, Cool::OpenGL::Shader const& shader, Cool::InputProvider_Ref input_provider)
static void set_uniform(Cool::OpenGL::Shader const& shader, Cool::Input<T> const& input, Cool::InputProvider_Ref input_provider)
{
auto const value = [&] {
if constexpr (std::is_same_v<T, Cool::Color>)
Expand Down Expand Up @@ -91,7 +86,6 @@ auto set_uniforms_for_shader_based_module(
shader.set_uniform("_aspect_ratio", provider(Cool::Input_AspectRatio{}));
shader.set_uniform("_inverse_aspect_ratio", 1.f / provider(Cool::Input_AspectRatio{}));
shader.set_uniform_texture("mixbox_lut", Cool::TextureLibrary_FromFile::instance().get(Cool::Path::root() / "res/mixbox/mixbox_lut.png")->id());

shader.set_uniform("_time", provider(Cool::Input_Time{}));
shader.set_uniform("_delta_time", provider(Cool::Input_DeltaTime{}));

Expand All @@ -116,7 +110,7 @@ auto set_uniforms_for_shader_based_module(
for (auto const& value_input : node.value_inputs())
{
std::visit([&](auto&& value_input) {
send_uniform(value_input, shader, provider);
set_uniform(shader, value_input, provider);
},
value_input);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#pragma once

#include "Cool/Dependencies/InputProvider_Ref.h"
#include "Cool/Gpu/DoubleBufferedRenderTarget.h"
#include "Cool/Gpu/OpenGL/Shader.h"
#include "Cool/Nodes/NodesGraph.h"
#include "Module/Module.h"
#include "shader_dependency.h"

namespace Lab {
Expand Down

0 comments on commit 927cbae

Please sign in to comment.