Move app command state mapping to renderer gl

This commit is contained in:
2026-06-02 06:58:30 +02:00
parent 19f815e3d2
commit 3930f39b14
4 changed files with 53 additions and 11 deletions

View File

@@ -1,16 +1,46 @@
#include "pch.h"
#include "app.h"
#include "canvas.h"
#include "renderer_gl/opengl_capabilities.h"
namespace {
[[nodiscard]] GLenum depth_test_state() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::depth_test_state());
}
[[nodiscard]] GLenum program_point_size_state() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::program_point_size_state());
}
[[nodiscard]] GLenum source_alpha_blend_factor() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::source_alpha_blend_factor());
}
[[nodiscard]] GLenum one_minus_source_alpha_blend_factor() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::one_minus_source_alpha_blend_factor());
}
[[nodiscard]] GLenum add_blend_equation() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::add_blend_equation());
}
}
void App::cmd_convert(std::string pano_path, std::string out_path)
{
glDisable(GL_DEPTH_TEST);
glEnable(GL_PROGRAM_POINT_SIZE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquation(GL_FUNC_ADD);
glDisable(depth_test_state());
glEnable(program_point_size_state());
glBlendFunc(source_alpha_blend_factor(), one_minus_source_alpha_blend_factor());
glBlendEquation(add_blend_equation());
Canvas* canvas = new Canvas;
canvas->create(CANVAS_RES, CANVAS_RES);
canvas->project_open_thread(pano_path);
canvas->export_equirectangular_thread(out_path);
Canvas* command_canvas = new Canvas;
command_canvas->create(CANVAS_RES, CANVAS_RES);
command_canvas->project_open_thread(pano_path);
command_canvas->export_equirectangular_thread(out_path);
}