4610bb4a99
- cpp/functions/gfx/uniform_parser: regex-based parser of @slider/@color/@toggle/@xy annotations (+ inline tests) - cpp/functions/gfx/uniform_panel: ImGui widgets + value store + glUniform* apply - shader_canvas: optional uniforms callback invoked per-frame - gl_loader: +glUniform1i/3f/4f - seed plasma: demo uniforms u_speed + u_color - rebuild Windows .exe Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
863 B
C++
29 lines
863 B
C++
#pragma once
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace fn::gfx {
|
|
|
|
enum class GLSLType { Float, Int, Bool, Vec2, Vec3, Vec4 };
|
|
enum class WidgetKind { Slider, Color, Toggle, XY };
|
|
|
|
struct UniformDescriptor {
|
|
std::string name;
|
|
GLSLType glsl_type = GLSLType::Float;
|
|
WidgetKind widget = WidgetKind::Slider;
|
|
float min[4] = {0, 0, 0, 0};
|
|
float max[4] = {1, 1, 1, 1};
|
|
float defaults[4] = {0, 0, 0, 0};
|
|
float step = 0.0f;
|
|
bool log_scale = false;
|
|
bool default_bool = false;
|
|
};
|
|
|
|
// Parsea líneas `uniform <type> <name>; // @<widget> key=value ...`
|
|
// Ignora u_resolution, u_time, u_mouse (reservados).
|
|
// Ignora sampler2D silenciosamente.
|
|
// Sin anotación: defaults por tipo.
|
|
std::vector<UniformDescriptor> parse_uniforms(const std::string& glsl_source);
|
|
|
|
} // namespace fn::gfx
|