mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:10:06 +00:00
Namespace cleanup
This commit is contained in:
parent
c22db501b3
commit
5a97d99a34
20 changed files with 88 additions and 46 deletions
|
|
@ -52,8 +52,11 @@ set(HDR_MAIN source/scwx/qt/main/main_window.hpp)
|
||||||
set(SRC_MAIN source/scwx/qt/main/main.cpp
|
set(SRC_MAIN source/scwx/qt/main/main.cpp
|
||||||
source/scwx/qt/main/main_window.cpp)
|
source/scwx/qt/main/main_window.cpp)
|
||||||
set(UI_MAIN source/scwx/qt/main/main_window.ui)
|
set(UI_MAIN source/scwx/qt/main/main_window.ui)
|
||||||
set(HDR_GL source/scwx/qt/gl/text_shader.hpp)
|
set(HDR_GL source/scwx/qt/gl/gl.hpp
|
||||||
set(SRC_GL source/scwx/qt/gl/text_shader.cpp)
|
source/scwx/qt/gl/shader_program.hpp
|
||||||
|
source/scwx/qt/gl/text_shader.hpp)
|
||||||
|
set(SRC_GL source/scwx/qt/gl/shader_program.cpp
|
||||||
|
source/scwx/qt/gl/text_shader.cpp)
|
||||||
set(HDR_MANAGER source/scwx/qt/manager/radar_manager.hpp)
|
set(HDR_MANAGER source/scwx/qt/manager/radar_manager.hpp)
|
||||||
set(SRC_MANAGER source/scwx/qt/manager/radar_manager.cpp)
|
set(SRC_MANAGER source/scwx/qt/manager/radar_manager.cpp)
|
||||||
set(HDR_MAP source/scwx/qt/map/map_widget.hpp
|
set(HDR_MAP source/scwx/qt/map/map_widget.hpp
|
||||||
|
|
@ -65,12 +68,9 @@ set(SRC_MAP source/scwx/qt/map/map_widget.cpp
|
||||||
source/scwx/qt/map/radar_range_layer.cpp
|
source/scwx/qt/map/radar_range_layer.cpp
|
||||||
source/scwx/qt/map/triangle_layer.cpp)
|
source/scwx/qt/map/triangle_layer.cpp)
|
||||||
set(HDR_UTIL source/scwx/qt/util/font.hpp
|
set(HDR_UTIL source/scwx/qt/util/font.hpp
|
||||||
source/scwx/qt/util/font_buffer.hpp
|
source/scwx/qt/util/font_buffer.hpp)
|
||||||
source/scwx/qt/util/gl.hpp
|
|
||||||
source/scwx/qt/util/shader_program.hpp)
|
|
||||||
set(SRC_UTIL source/scwx/qt/util/font.cpp
|
set(SRC_UTIL source/scwx/qt/util/font.cpp
|
||||||
source/scwx/qt/util/font_buffer.cpp
|
source/scwx/qt/util/font_buffer.cpp)
|
||||||
source/scwx/qt/util/shader_program.cpp)
|
|
||||||
set(HDR_VIEW source/scwx/qt/view/radar_view.hpp)
|
set(HDR_VIEW source/scwx/qt/view/radar_view.hpp)
|
||||||
set(SRC_VIEW source/scwx/qt/view/radar_view.cpp)
|
set(SRC_VIEW source/scwx/qt/view/radar_view.cpp)
|
||||||
|
|
||||||
|
|
@ -85,6 +85,8 @@ set(TS_FILES ts/scwx_en_US.ts)
|
||||||
|
|
||||||
set(PROJECT_SOURCES ${HDR_MAIN}
|
set(PROJECT_SOURCES ${HDR_MAIN}
|
||||||
${SRC_MAIN}
|
${SRC_MAIN}
|
||||||
|
${HDR_GL}
|
||||||
|
${SRC_GL}
|
||||||
${HDR_MANAGER}
|
${HDR_MANAGER}
|
||||||
${SRC_MANAGER}
|
${SRC_MANAGER}
|
||||||
${UI_MAIN}
|
${UI_MAIN}
|
||||||
|
|
@ -100,6 +102,8 @@ set(PROJECT_SOURCES ${HDR_MAIN}
|
||||||
|
|
||||||
source_group("Header Files\\main" FILES ${HDR_MAIN})
|
source_group("Header Files\\main" FILES ${HDR_MAIN})
|
||||||
source_group("Source Files\\main" FILES ${SRC_MAIN})
|
source_group("Source Files\\main" FILES ${SRC_MAIN})
|
||||||
|
source_group("Header Files\\gl" FILES ${HDR_GL})
|
||||||
|
source_group("Source Files\\gl" FILES ${SRC_GL})
|
||||||
source_group("Header Files\\manager" FILES ${HDR_MANAGER})
|
source_group("Header Files\\manager" FILES ${HDR_MANAGER})
|
||||||
source_group("Source Files\\manager" FILES ${SRC_MANAGER})
|
source_group("Source Files\\manager" FILES ${SRC_MANAGER})
|
||||||
source_group("UI Files\\main" FILES ${UI_MAIN})
|
source_group("UI Files\\main" FILES ${UI_MAIN})
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,11 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace gl
|
||||||
|
{
|
||||||
|
|
||||||
using OpenGLFunctions = QOpenGLFunctions_3_3_Core;
|
using OpenGLFunctions = QOpenGLFunctions_3_3_Core;
|
||||||
|
|
||||||
|
}
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include <scwx/qt/util/shader_program.hpp>
|
#include <scwx/qt/gl/shader_program.hpp>
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
|
@ -8,8 +8,10 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace gl
|
||||||
|
{
|
||||||
|
|
||||||
static const std::string logPrefix_ = "[scwx::qt::util::shader_program] ";
|
static const std::string logPrefix_ = "[scwx::qt::gl::shader_program] ";
|
||||||
|
|
||||||
static constexpr GLsizei INFO_LOG_BUF_SIZE = 512;
|
static constexpr GLsizei INFO_LOG_BUF_SIZE = 512;
|
||||||
|
|
||||||
|
|
@ -173,5 +175,6 @@ void ShaderProgram::Use() const
|
||||||
p->gl_.glUseProgram(p->id_);
|
p->gl_.glUseProgram(p->id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace gl
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <scwx/qt/util/gl.hpp>
|
#include <scwx/qt/gl/gl.hpp>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include <Windows.h>
|
# include <Windows.h>
|
||||||
|
|
@ -13,6 +13,8 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace gl
|
||||||
|
{
|
||||||
|
|
||||||
class ShaderProgramImpl;
|
class ShaderProgramImpl;
|
||||||
|
|
||||||
|
|
@ -38,5 +40,6 @@ private:
|
||||||
std::unique_ptr<ShaderProgramImpl> p;
|
std::unique_ptr<ShaderProgramImpl> p;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace gl
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <scwx/qt/util/shader_program.hpp>
|
#include <scwx/qt/gl/shader_program.hpp>
|
||||||
#include <scwx/qt/util/font.hpp>
|
#include <scwx/qt/util/font.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ int main(int argc, char* argv[])
|
||||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >=
|
boost::log::core::get()->set_filter(boost::log::trivial::severity >=
|
||||||
boost::log::trivial::debug);
|
boost::log::trivial::debug);
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
scwx::qt::MainWindow w;
|
scwx::qt::main::MainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace main
|
||||||
|
{
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget* parent) :
|
MainWindow::MainWindow(QWidget* parent) :
|
||||||
QMainWindow(parent), ui(new Ui::MainWindow)
|
QMainWindow(parent), ui(new Ui::MainWindow)
|
||||||
|
|
@ -17,7 +19,7 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||||
settings.setCacheDatabasePath("/tmp/mbgl-cache.db");
|
settings.setCacheDatabasePath("/tmp/mbgl-cache.db");
|
||||||
settings.setCacheDatabaseMaximumSize(20 * 1024 * 1024);
|
settings.setCacheDatabaseMaximumSize(20 * 1024 * 1024);
|
||||||
|
|
||||||
ui->centralwidget->layout()->addWidget(new MapWidget(settings));
|
ui->centralwidget->layout()->addWidget(new map::MapWidget(settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
|
@ -25,5 +27,6 @@ MainWindow::~MainWindow()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace main
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace main
|
||||||
|
{
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
|
|
@ -26,5 +28,6 @@ private:
|
||||||
Ui::MainWindow* ui;
|
Ui::MainWindow* ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace main
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
#include "map_widget.hpp"
|
#include <scwx/qt/map/map_widget.hpp>
|
||||||
|
#include <scwx/qt/gl/gl.hpp>
|
||||||
#include <scwx/qt/map/radar_layer.hpp>
|
#include <scwx/qt/map/radar_layer.hpp>
|
||||||
#include <scwx/qt/map/radar_range_layer.hpp>
|
#include <scwx/qt/map/radar_range_layer.hpp>
|
||||||
#include <scwx/qt/util/gl.hpp>
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
@ -17,6 +16,8 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace map
|
||||||
|
{
|
||||||
|
|
||||||
typedef std::pair<std::string, std::string> MapStyle;
|
typedef std::pair<std::string, std::string> MapStyle;
|
||||||
|
|
||||||
|
|
@ -46,7 +47,7 @@ public:
|
||||||
}
|
}
|
||||||
~MapWidgetImpl() = default;
|
~MapWidgetImpl() = default;
|
||||||
|
|
||||||
OpenGLFunctions gl_;
|
gl::OpenGLFunctions gl_;
|
||||||
|
|
||||||
QMapboxGLSettings settings_;
|
QMapboxGLSettings settings_;
|
||||||
std::shared_ptr<QMapboxGL> map_;
|
std::shared_ptr<QMapboxGL> map_;
|
||||||
|
|
@ -266,5 +267,6 @@ void MapWidget::mapChanged(QMapboxGL::MapChange mapChange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace map
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace map
|
||||||
|
{
|
||||||
|
|
||||||
class MapWidgetImpl;
|
class MapWidgetImpl;
|
||||||
|
|
||||||
|
|
@ -49,5 +51,6 @@ private slots:
|
||||||
void mapChanged(QMapboxGL::MapChange);
|
void mapChanged(QMapboxGL::MapChange);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace map
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include <scwx/qt/map/radar_layer.hpp>
|
#include <scwx/qt/map/radar_layer.hpp>
|
||||||
#include <scwx/qt/util/shader_program.hpp>
|
#include <scwx/qt/gl/shader_program.hpp>
|
||||||
|
|
||||||
#include <execution>
|
#include <execution>
|
||||||
|
|
||||||
|
|
@ -15,6 +15,8 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace map
|
||||||
|
{
|
||||||
|
|
||||||
static constexpr uint32_t MAX_RADIALS = 720;
|
static constexpr uint32_t MAX_RADIALS = 720;
|
||||||
static constexpr uint32_t MAX_DATA_MOMENT_GATES = 1840;
|
static constexpr uint32_t MAX_DATA_MOMENT_GATES = 1840;
|
||||||
|
|
@ -28,7 +30,7 @@ class RadarLayerImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit RadarLayerImpl(std::shared_ptr<view::RadarView> radarView,
|
explicit RadarLayerImpl(std::shared_ptr<view::RadarView> radarView,
|
||||||
OpenGLFunctions& gl) :
|
gl::OpenGLFunctions& gl) :
|
||||||
radarView_(radarView),
|
radarView_(radarView),
|
||||||
gl_(gl),
|
gl_(gl),
|
||||||
shaderProgram_(gl),
|
shaderProgram_(gl),
|
||||||
|
|
@ -45,9 +47,9 @@ public:
|
||||||
~RadarLayerImpl() = default;
|
~RadarLayerImpl() = default;
|
||||||
|
|
||||||
std::shared_ptr<view::RadarView> radarView_;
|
std::shared_ptr<view::RadarView> radarView_;
|
||||||
OpenGLFunctions& gl_;
|
gl::OpenGLFunctions& gl_;
|
||||||
|
|
||||||
ShaderProgram shaderProgram_;
|
gl::ShaderProgram shaderProgram_;
|
||||||
GLint uMVPMatrixLocation_;
|
GLint uMVPMatrixLocation_;
|
||||||
GLint uMapScreenCoordLocation_;
|
GLint uMapScreenCoordLocation_;
|
||||||
std::array<GLuint, 2> vbo_;
|
std::array<GLuint, 2> vbo_;
|
||||||
|
|
@ -61,7 +63,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
RadarLayer::RadarLayer(std::shared_ptr<view::RadarView> radarView,
|
RadarLayer::RadarLayer(std::shared_ptr<view::RadarView> radarView,
|
||||||
OpenGLFunctions& gl) :
|
gl::OpenGLFunctions& gl) :
|
||||||
p(std::make_unique<RadarLayerImpl>(radarView, gl))
|
p(std::make_unique<RadarLayerImpl>(radarView, gl))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +73,7 @@ void RadarLayer::initialize()
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "initialize()";
|
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "initialize()";
|
||||||
|
|
||||||
OpenGLFunctions& gl = p->gl_;
|
gl::OpenGLFunctions& gl = p->gl_;
|
||||||
|
|
||||||
// Load and configure radar shader
|
// Load and configure radar shader
|
||||||
p->shaderProgram_.Load(":/gl/radar.vert", ":/gl/radar.frag");
|
p->shaderProgram_.Load(":/gl/radar.vert", ":/gl/radar.frag");
|
||||||
|
|
@ -121,7 +123,7 @@ void RadarLayer::UpdatePlot()
|
||||||
|
|
||||||
p->plotUpdated_ = false;
|
p->plotUpdated_ = false;
|
||||||
|
|
||||||
OpenGLFunctions& gl = p->gl_;
|
gl::OpenGLFunctions& gl = p->gl_;
|
||||||
|
|
||||||
boost::timer::cpu_timer timer;
|
boost::timer::cpu_timer timer;
|
||||||
|
|
||||||
|
|
@ -182,7 +184,7 @@ void RadarLayer::UpdatePlot()
|
||||||
|
|
||||||
void RadarLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
void RadarLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
OpenGLFunctions& gl = p->gl_;
|
gl::OpenGLFunctions& gl = p->gl_;
|
||||||
|
|
||||||
if (p->colorTableUpdated_)
|
if (p->colorTableUpdated_)
|
||||||
{
|
{
|
||||||
|
|
@ -223,7 +225,7 @@ void RadarLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
||||||
|
|
||||||
void RadarLayer::deinitialize()
|
void RadarLayer::deinitialize()
|
||||||
{
|
{
|
||||||
OpenGLFunctions& gl = p->gl_;
|
gl::OpenGLFunctions& gl = p->gl_;
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "deinitialize()";
|
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "deinitialize()";
|
||||||
|
|
||||||
|
|
@ -251,7 +253,7 @@ void RadarLayer::UpdateColorTable()
|
||||||
|
|
||||||
p->colorTableUpdated_ = false;
|
p->colorTableUpdated_ = false;
|
||||||
|
|
||||||
OpenGLFunctions& gl = p->gl_;
|
gl::OpenGLFunctions& gl = p->gl_;
|
||||||
|
|
||||||
const std::vector<boost::gil::rgba8_pixel_t>& colorTable =
|
const std::vector<boost::gil::rgba8_pixel_t>& colorTable =
|
||||||
p->radarView_->color_table();
|
p->radarView_->color_table();
|
||||||
|
|
@ -293,5 +295,6 @@ LatLongToScreenCoordinate(const QMapbox::Coordinate& coordinate)
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace map
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <scwx/qt/util/gl.hpp>
|
#include <scwx/qt/gl/gl.hpp>
|
||||||
#include <scwx/qt/view/radar_view.hpp>
|
#include <scwx/qt/view/radar_view.hpp>
|
||||||
|
|
||||||
#include <QMapboxGL>
|
#include <QMapboxGL>
|
||||||
|
|
@ -9,6 +9,8 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace map
|
||||||
|
{
|
||||||
|
|
||||||
class RadarLayerImpl;
|
class RadarLayerImpl;
|
||||||
|
|
||||||
|
|
@ -18,7 +20,7 @@ class RadarLayer : public QObject, public QMapbox::CustomLayerHostInterface
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit RadarLayer(std::shared_ptr<view::RadarView> radarView,
|
explicit RadarLayer(std::shared_ptr<view::RadarView> radarView,
|
||||||
OpenGLFunctions& gl);
|
gl::OpenGLFunctions& gl);
|
||||||
~RadarLayer();
|
~RadarLayer();
|
||||||
|
|
||||||
void initialize() override final;
|
void initialize() override final;
|
||||||
|
|
@ -36,5 +38,6 @@ private:
|
||||||
std::unique_ptr<RadarLayerImpl> p;
|
std::unique_ptr<RadarLayerImpl> p;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace map
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace map
|
||||||
|
{
|
||||||
|
|
||||||
static const std::string logPrefix_ = "[scwx::qt::map::radar_range_layer] ";
|
static const std::string logPrefix_ = "[scwx::qt::map::radar_range_layer] ";
|
||||||
|
|
||||||
|
|
@ -56,5 +58,6 @@ void RadarRangeLayer::Add(std::shared_ptr<QMapboxGL> map, const QString& before)
|
||||||
"rangeCircleLayer", "line-color", "rgba(128, 128, 128, 128)");
|
"rangeCircleLayer", "line-color", "rgba(128, 128, 128, 128)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace map
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,14 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace map
|
||||||
|
{
|
||||||
|
|
||||||
namespace RadarRangeLayer
|
namespace RadarRangeLayer
|
||||||
{
|
{
|
||||||
void Add(std::shared_ptr<QMapboxGL> map, const QString& before = QString());
|
void Add(std::shared_ptr<QMapboxGL> map, const QString& before = QString());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace map
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,15 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace map
|
||||||
|
{
|
||||||
|
|
||||||
static const std::string logPrefix_ = "[scwx::qt::map::triangle_layer] ";
|
static const std::string logPrefix_ = "[scwx::qt::map::triangle_layer] ";
|
||||||
|
|
||||||
class TriangleLayerImpl
|
class TriangleLayerImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TriangleLayerImpl(OpenGLFunctions& gl) :
|
explicit TriangleLayerImpl(gl::OpenGLFunctions& gl) :
|
||||||
gl_(gl),
|
gl_(gl),
|
||||||
shaderProgram_ {GL_INVALID_INDEX},
|
shaderProgram_ {GL_INVALID_INDEX},
|
||||||
vbo_ {GL_INVALID_INDEX},
|
vbo_ {GL_INVALID_INDEX},
|
||||||
|
|
@ -22,14 +24,14 @@ public:
|
||||||
}
|
}
|
||||||
~TriangleLayerImpl() = default;
|
~TriangleLayerImpl() = default;
|
||||||
|
|
||||||
OpenGLFunctions& gl_;
|
gl::OpenGLFunctions& gl_;
|
||||||
|
|
||||||
GLuint shaderProgram_;
|
GLuint shaderProgram_;
|
||||||
GLuint vbo_;
|
GLuint vbo_;
|
||||||
GLuint vao_;
|
GLuint vao_;
|
||||||
};
|
};
|
||||||
|
|
||||||
TriangleLayer::TriangleLayer(OpenGLFunctions& gl) :
|
TriangleLayer::TriangleLayer(gl::OpenGLFunctions& gl) :
|
||||||
p(std::make_unique<TriangleLayerImpl>(gl))
|
p(std::make_unique<TriangleLayerImpl>(gl))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -40,7 +42,7 @@ TriangleLayer& TriangleLayer::operator=(TriangleLayer&&) noexcept = default;
|
||||||
|
|
||||||
void TriangleLayer::initialize()
|
void TriangleLayer::initialize()
|
||||||
{
|
{
|
||||||
OpenGLFunctions& gl = p->gl_;
|
gl::OpenGLFunctions& gl = p->gl_;
|
||||||
|
|
||||||
static const char* vertexShaderSource =
|
static const char* vertexShaderSource =
|
||||||
"#version 330 core\n"
|
"#version 330 core\n"
|
||||||
|
|
@ -142,7 +144,7 @@ void TriangleLayer::initialize()
|
||||||
|
|
||||||
void TriangleLayer::render(const QMapbox::CustomLayerRenderParameters&)
|
void TriangleLayer::render(const QMapbox::CustomLayerRenderParameters&)
|
||||||
{
|
{
|
||||||
OpenGLFunctions& gl = p->gl_;
|
gl::OpenGLFunctions& gl = p->gl_;
|
||||||
|
|
||||||
gl.glUseProgram(p->shaderProgram_);
|
gl.glUseProgram(p->shaderProgram_);
|
||||||
gl.glBindVertexArray(p->vao_);
|
gl.glBindVertexArray(p->vao_);
|
||||||
|
|
@ -151,7 +153,7 @@ void TriangleLayer::render(const QMapbox::CustomLayerRenderParameters&)
|
||||||
|
|
||||||
void TriangleLayer::deinitialize()
|
void TriangleLayer::deinitialize()
|
||||||
{
|
{
|
||||||
OpenGLFunctions& gl = p->gl_;
|
gl::OpenGLFunctions& gl = p->gl_;
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "deinitialize()";
|
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "deinitialize()";
|
||||||
|
|
||||||
|
|
@ -164,5 +166,6 @@ void TriangleLayer::deinitialize()
|
||||||
p->vbo_ = GL_INVALID_INDEX;
|
p->vbo_ = GL_INVALID_INDEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace map
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <scwx/qt/util/gl.hpp>
|
#include <scwx/qt/gl/gl.hpp>
|
||||||
|
|
||||||
#include <QMapboxGL>
|
#include <QMapboxGL>
|
||||||
|
|
||||||
|
|
@ -8,13 +8,15 @@ namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
|
namespace map
|
||||||
|
{
|
||||||
|
|
||||||
class TriangleLayerImpl;
|
class TriangleLayerImpl;
|
||||||
|
|
||||||
class TriangleLayer : public QMapbox::CustomLayerHostInterface
|
class TriangleLayer : public QMapbox::CustomLayerHostInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TriangleLayer(OpenGLFunctions& gl);
|
explicit TriangleLayer(gl::OpenGLFunctions& gl);
|
||||||
~TriangleLayer();
|
~TriangleLayer();
|
||||||
|
|
||||||
TriangleLayer(const TriangleLayer&) = delete;
|
TriangleLayer(const TriangleLayer&) = delete;
|
||||||
|
|
@ -31,5 +33,6 @@ private:
|
||||||
std::unique_ptr<TriangleLayerImpl> p;
|
std::unique_ptr<TriangleLayerImpl> p;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace map
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ float Font::TextLength(const std::string& text, float pointSize) const
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint Font::GenerateTexture(OpenGLFunctions& gl)
|
GLuint Font::GenerateTexture(gl::OpenGLFunctions& gl)
|
||||||
{
|
{
|
||||||
gl.glGenTextures(1, &p->atlas_->id);
|
gl.glGenTextures(1, &p->atlas_->id);
|
||||||
gl.glBindTexture(GL_TEXTURE_2D, p->atlas_->id);
|
gl.glBindTexture(GL_TEXTURE_2D, p->atlas_->id);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <scwx/qt/gl/gl.hpp>
|
||||||
#include <scwx/qt/util/font_buffer.hpp>
|
#include <scwx/qt/util/font_buffer.hpp>
|
||||||
#include <scwx/qt/util/gl.hpp>
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
@ -38,7 +38,7 @@ public:
|
||||||
float Kerning(char c1, char c2) const;
|
float Kerning(char c1, char c2) const;
|
||||||
float TextLength(const std::string& text, float pointSize) const;
|
float TextLength(const std::string& text, float pointSize) const;
|
||||||
|
|
||||||
GLuint GenerateTexture(OpenGLFunctions& gl);
|
GLuint GenerateTexture(gl::OpenGLFunctions& gl);
|
||||||
|
|
||||||
static std::shared_ptr<Font> Create(const std::string& resource);
|
static std::shared_ptr<Font> Create(const std::string& resource);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public:
|
||||||
|
|
||||||
~FontBufferImpl() {}
|
~FontBufferImpl() {}
|
||||||
|
|
||||||
void RenderSetup(OpenGLFunctions& gl)
|
void RenderSetup(gl::OpenGLFunctions& gl)
|
||||||
{
|
{
|
||||||
// Generate and setup VAO
|
// Generate and setup VAO
|
||||||
gl.glGenVertexArrays(1, &vaoId_);
|
gl.glGenVertexArrays(1, &vaoId_);
|
||||||
|
|
@ -64,7 +64,7 @@ public:
|
||||||
gl.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indicesId_);
|
gl.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indicesId_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Upload(OpenGLFunctions& gl)
|
void Upload(gl::OpenGLFunctions& gl)
|
||||||
{
|
{
|
||||||
if (verticesId_ == GL_INVALID_INDEX)
|
if (verticesId_ == GL_INVALID_INDEX)
|
||||||
{
|
{
|
||||||
|
|
@ -157,7 +157,7 @@ void FontBuffer::Push(std::initializer_list<GLuint> indices,
|
||||||
p->vertices_.insert(p->vertices_.end(), vertices);
|
p->vertices_.insert(p->vertices_.end(), vertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontBuffer::Render(OpenGLFunctions& gl)
|
void FontBuffer::Render(gl::OpenGLFunctions& gl)
|
||||||
{
|
{
|
||||||
std::scoped_lock lock(p->mutex_);
|
std::scoped_lock lock(p->mutex_);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <scwx/qt/util/gl.hpp>
|
#include <scwx/qt/gl/gl.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ public:
|
||||||
void Clear();
|
void Clear();
|
||||||
void Push(std::initializer_list<GLuint> indices,
|
void Push(std::initializer_list<GLuint> indices,
|
||||||
std::initializer_list<GLfloat> vertices);
|
std::initializer_list<GLfloat> vertices);
|
||||||
void Render(OpenGLFunctions& gl);
|
void Render(gl::OpenGLFunctions& gl);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<FontBufferImpl> p;
|
std::unique_ptr<FontBufferImpl> p;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue