This commit is contained in:
bart
2026-11-08 15:42:54 +01:00
parent dfd497d728
commit 5af4581182
80 changed files with 4494 additions and 437 deletions
+30 -3
View File
@@ -16,7 +16,7 @@ class Tile
public:
Tile();
void init(QSceneRenderer* s,int x, int y);
void paint(QMatrix4x4 p,QVector3D& cameraPosition,QVector3D& cameraUpDirection,QMatrix4x4& vMatrix, float zRot);
void paint(QMatrix4x4 p,QVector3D& cameraPosition,QVector3D& cameraUpDirection,QMatrix4x4& vMatrix, float time);
void buildVertices();
void buildNormals();
bool isInitialized() const { return m_initialized; }
@@ -24,6 +24,14 @@ public:
void ensureInitialized(QSceneRenderer* s, int x, int y);
void ensureNormalsBuilt();
void findFaces(std::vector<Face *> &vec, QVector2D s);
QVector2D getWorldPosition() const {
return QVector2D(m_x * (LOD_0_SIZE * 0.75f), m_y * (LOD_0_SIZE_Y * 2.0f) + (m_x % 2 == 0 ? 0.0f : LOD_0_SIZE_Y));
}
void addRiverEdge(int edge) { m_riverMask |= (1 << ((edge % 6 + 6) % 6)); }
void setRiverMask(unsigned char mask) { m_riverMask = mask; }
unsigned char getRiverMask() const { return m_riverMask; }
bool hasRiver() const { return m_riverMask != 0; }
static float getRiverDistance(QVector2D p, unsigned char mask);
protected:
void addTriangleVertices(int &cnt, QVector2D t1, QVector2D t2, QVector2D t3,int level, int hex, int l1);
void drawSubTriangleVertices(int &cnt, QVector2D t1, QVector2D t2, QVector2D t3, int hex, int l1, int l2);
@@ -47,13 +55,32 @@ protected:
float m_startpoint_y;
bool m_initialized;
bool m_normalsBuilt;
unsigned char m_riverMask;
static Vertex * m_vertices;
static QOpenGLTexture * m_texture;
static QOpenGLTexture * m_texture_grass;
static QOpenGLTexture * m_texture_border;
static QOpenGLTexture * m_texture_rock;
static QImage * m_image;
static QOpenGLTexture * m_texture_sand;
static QOpenGLTexture * m_texture_water;
static QOpenGLTexture * m_texture_snow;
static QOpenGLTexture * m_texture_typemap;
static QOpenGLTexture * m_texture_sahara;
static QOpenGLTexture * m_texture_tundra;
static QOpenGLTexture * m_texture_redsand;
static QOpenGLTexture * m_texture_redrock;
static QOpenGLTexture * m_texture_forest;
static QImage * m_image_grass;
static QImage * m_image_rock;
static QImage * m_image_border;
static QImage * m_image_sand;
static QImage * m_image_water;
static QImage * m_image_snow;
static QImage * m_image_typemap;
static QImage * m_image_sahara;
static QImage * m_image_tundra;
static QImage * m_image_redsand;
static QImage * m_image_redrock;
static QImage * m_image_forest;
};
#endif // TILE_H