1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-22 01:17:39 +00:00

header cleanup: rug

This commit is contained in:
Zeno Rogue
2019-08-10 01:07:39 +02:00
parent 5ea055b39e
commit 4422b910c0
5 changed files with 125 additions and 185 deletions

112
hyper.h
View File

@@ -952,118 +952,6 @@ namespace mapeditor {
void map_settings();
}
struct renderbuffer;
namespace rug {
extern bool display_warning;
extern bool rugged;
extern bool spatial_rug;
extern bool computed;
extern bool renderonce;
extern bool rendernogl;
extern int texturesize;
extern ld model_distance;
extern ld modelscale;
extern transmatrix currentrot;
#if CAP_RUG
void show();
// initialize both the texture and the model
void init();
// initialize only the texture (assume model already initialized)
void reopen();
// close the rug mode, remove the texture
void close();
// clear the model
void clear_model();
void actDraw();
void select();
void buildVertexInfo(cell *c, transmatrix V);
void drawRugScene();
void prepareTexture();
void drawRugScene();
void push_all_points(int coord, ld val);
void apply_rotation(const transmatrix& t);
string makehelp();
struct edge {
struct rugpoint *target;
ld len;
};
struct dexp_data {
hyperpoint params;
hyperpoint cont;
ld remaining_distance;
};
struct rugpoint {
double x1, y1;
bool valid;
bool inqueue;
double dist;
hyperpoint h; // point in the represented space
hyperpoint flat; // point in the native space, in azeq
hyperpoint precompute;
vector<edge> edges;
vector<edge> anticusp_edges;
// Find-Union algorithm
rugpoint *glue;
rugpoint *getglue() {
return glue ? (glue = glue->getglue()) : this;
}
hyperpoint& glueflat() {
return glue->flat;
}
rugpoint() { glue = NULL; }
void glueto(rugpoint *x) {
x = x->getglue();
auto y = getglue();
if(x != y) y->glue = x;
}
int dexp_id;
dexp_data surface_point;
};
struct triangle {
rugpoint *m[3];
triangle(rugpoint *m1, rugpoint *m2, rugpoint *m3) {
m[0] = m1; m[1] = m2; m[2] = m3;
}
};
extern vector<rugpoint*> points;
extern vector<triangle> triangles;
extern int qvalid;
extern bool subdivide_further();
extern void subdivide();
extern bool good_shape;
extern int vertex_limit;
extern void enqueue(rugpoint *p);
void sort_rug_points();
extern bool rug_perspective;
bool handlekeys(int sym, int uni);
void addTriangle(rugpoint *t1, rugpoint *t2, rugpoint *t3, ld len = 1);
rugpoint *addRugpoint(hyperpoint h, double dist);
void buildRug();
bool in_crystal();
void physics();
extern renderbuffer *glbuf;
extern eGeometry gwhere;
extern bool no_fog;
extern ld lowrug, hirug, ruggospeed;
extern GLuint alternate_texture;
extern bool invert_depth;
extern ld ruggo;
#endif
}
#define HASLINEVIEW
// passable flags
#define SAGEMELT .1