Files
egutierrez b557433388 feat(viz): mesh_viewer — componente 3D con FBO + Lambert headlight
Compila/cachea por id un programa GLSL (vertex+fragment) con
iluminacion Lambert (luz=camara), gestiona Framebuffer cacheado por
id, dibuja MeshGpu con orbit camera, muestra via ImGui::Image y
maneja drag (mouse) + wheel (zoom). Wireframe opcional via
glPolygonMode.

gl_loader: añade glUniformMatrix4fv (proc requerido en Windows para
subir las matrices view/proj del mesh_viewer).

issue 0029
2026-04-25 21:51:22 +02:00

25 lines
742 B
C++

#pragma once
#include "core/orbit_camera.h"
#include "gfx/mesh_gpu.h"
#include "imgui.h"
namespace fn::viz {
struct MeshViewerConfig {
const fn::gfx::MeshGpu* mesh = nullptr;
fn::core::OrbitCamera* cam = nullptr; // mutable: drag/wheel handler
ImVec2 size = {-1.0f, 400.0f}; // -1 = stretch X
ImU32 color = IM_COL32(180, 180, 200, 255);
bool wireframe = false;
};
// Renderiza un MeshGpu en un FBO interno (cacheado por id) y muestra
// la textura via ImGui::Image. Maneja drag/wheel sobre el panel.
//
// El `id` debe ser estable para reusar el mismo FBO entre frames.
void mesh_viewer(const char* id, const MeshViewerConfig& cfg);
} // namespace fn::viz