-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathearth_renderer.h
More file actions
59 lines (46 loc) · 1.84 KB
/
earth_renderer.h
File metadata and controls
59 lines (46 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// earth_renderer.h
#ifndef EARTH_RENDERER_H
#define EARTH_RENDERER_H
#include "renderer.h"
#include "tile_texture_manager.h"
#include "atmosphere_renderer.h"
#include <QOpenGLBuffer>
#include <QMatrix4x4>
class EarthRenderer : public Renderer {
public:
explicit EarthRenderer(float radius);
~EarthRenderer() override;
void initialize() override;
void render(const QMatrix4x4& projection, const QMatrix4x4& view, const QMatrix4x4& model) override;
private:
void initShaders();
void initTextures();
void initGeometry();
void createSphere();
void updateVisibleTiles(const QMatrix4x4& viewProjection);
static constexpr int RINGS = 128; // Увеличено для лучшей детализации
static constexpr int SEGMENTS = 128; // Увеличено для лучшей детализации
std::unique_ptr<TileTextureManager> earthTextureTiles;
std::unique_ptr<TileTextureManager> heightMapTiles;
std::unique_ptr<TileTextureManager> normalMapTiles;
std::unique_ptr<TileTextureManager> nightLightsTiles;
std::unique_ptr<TileTextureManager> cloudTiles;
std::unique_ptr<TileTextureManager> specularTiles;
std::unique_ptr<TileTextureManager> temperatureTiles;
std::unique_ptr<TileTextureManager> snowTiles;
std::unique_ptr<AtmosphereRenderer> atmosphereRenderer;
float radius;
struct Vertex {
QVector3D position;
QVector2D texCoord;
QVector3D normal;
QVector2D tileCoord; // Координаты тайла (ring, segment)
};
QOpenGLVertexArrayObject vao;
QOpenGLBuffer vbo{QOpenGLBuffer::VertexBuffer};
QOpenGLBuffer ibo{QOpenGLBuffer::IndexBuffer};
QVector<Vertex> vertices;
QVector<GLuint> indices;
QVector3D sphericalToCartesian(float radius, float phi, float theta) const;
};
#endif // EARTH_RENDERER_H