update
This commit is contained in:
38
main.cpp
38
main.cpp
@@ -1,6 +1,7 @@
|
||||
#include "lopenglprogram.h"
|
||||
#include "camera.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <glm/ext/matrix_clip_space.hpp>
|
||||
#include <glm/ext/matrix_transform.hpp>
|
||||
@@ -10,9 +11,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <print>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class GLWidget {
|
||||
|
||||
@@ -55,6 +54,9 @@ public:
|
||||
if (heatmapVbo_) {
|
||||
glDeleteBuffers(1, &heatmapVbo_);
|
||||
}
|
||||
if (heatmapIbo_) {
|
||||
glDeleteBuffers(1, &heatmapIbo_);
|
||||
}
|
||||
deinit_ = true;
|
||||
}
|
||||
|
||||
@@ -224,7 +226,30 @@ private:
|
||||
}
|
||||
|
||||
void initHeatmapGeometry_() {
|
||||
if (heatmapIbo_) {
|
||||
glDeleteBuffers(1, &heatmapIbo_);
|
||||
heatmapIbo_ = 0;
|
||||
}
|
||||
if (heatmapVbo_) {
|
||||
glDeleteBuffers(1, &heatmapVbo_);
|
||||
heatmapVbo_ = 0;
|
||||
}
|
||||
if (heatmapVao_) {
|
||||
glDeleteVertexArrays(1, &heatmapVao_);
|
||||
heatmapVao_ = 0;
|
||||
}
|
||||
|
||||
const float aspect = (panelWidth_ > 1e-6F) ? (panelHeight_ / panelWidth_) : 1.0F;
|
||||
const int max_res = 512;
|
||||
const int cols = std::max(2, std::min(dotcols_ * dotupscale_, max_res));
|
||||
int rows = std::max(2, int(cols * aspect + 0.5F));
|
||||
rows = std::max(2, std::min(rows, max_res));
|
||||
heatmapcols_ = cols;
|
||||
heatmaprows_ = rows;
|
||||
|
||||
const int vertex_count = cols * rows;
|
||||
std::vector<float> verts;
|
||||
|
||||
}
|
||||
|
||||
bool initBgProgram() {
|
||||
@@ -483,6 +508,7 @@ private:
|
||||
std::string heatmapFragShaderPath_;
|
||||
unsigned int heatmapVao_ = 0;
|
||||
unsigned int heatmapVbo_ = 0;
|
||||
unsigned int heatmapIbo_ = 0;
|
||||
|
||||
ViewPort viewport_{800, 600};
|
||||
Camera camera_{glm::vec3(0.0F, 0.0F, 2.0F)};
|
||||
@@ -493,6 +519,12 @@ private:
|
||||
float lastFrame_ = 0.0f;
|
||||
bool lightMode_ = false;
|
||||
|
||||
int dotcols_ = 8;
|
||||
int dotrows_ = 12;
|
||||
int dotupscale_ = 100;
|
||||
int heatmapcols_;
|
||||
int heatmaprows_;
|
||||
|
||||
bool deinit_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user