mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-09-01 02:07:57 +00:00
rogueviz:: objmodels:: OO design of the model class
This commit is contained in:
@@ -21,20 +21,22 @@ using namespace rogueviz::objmodels;
|
||||
|
||||
void prepare_tf();
|
||||
|
||||
model city("rogueviz/models/", "emilejohansson_p2.obj", default_transformer, prepare_tf);
|
||||
struct citymodel : model {
|
||||
citymodel() : model("rogueviz/models/", "emilejohansson_p2.obj") {}
|
||||
|
||||
hyperpoint low, high;
|
||||
hyperpoint low, high;
|
||||
ld t;
|
||||
|
||||
void prepare_tf() {
|
||||
|
||||
for(int i=0; i<4; i++) low[i] = 100, high[i] = -100;
|
||||
void prepare() override {
|
||||
for(int i=0; i<4; i++) low[i] = 100, high[i] = -100;
|
||||
|
||||
cgi.require_basics();
|
||||
hyperpoint corner = get_corner_position(cwt.at, 0);
|
||||
|
||||
ld t = abs(corner[0] / corner[3]);
|
||||
cgi.require_basics();
|
||||
hyperpoint corner = get_corner_position(cwt.at, 0);
|
||||
|
||||
t = abs(corner[0] / corner[3]);
|
||||
}
|
||||
|
||||
city.tf = [=] (hyperpoint h) -> pair<int, hyperpoint> {
|
||||
hyperpoint transform(hyperpoint h) override {
|
||||
swap(h[1], h[2]);
|
||||
h[2] = -h[2];
|
||||
h[2] += 0.063;
|
||||
@@ -59,7 +61,7 @@ void prepare_tf() {
|
||||
hx = normalize(hx);
|
||||
hx = orthogonal_move(hx, h[2]*(t*(sphere ? 3 : 7)));
|
||||
|
||||
return {0, hx};
|
||||
return hx;
|
||||
}
|
||||
|
||||
if(nil || sol) {
|
||||
@@ -68,14 +70,19 @@ void prepare_tf() {
|
||||
if(sol) h *= vid.binary_width;
|
||||
if(nil) h *= nilv::nilwidth;
|
||||
h[3] = 1;
|
||||
return {0, h};
|
||||
return h;
|
||||
}
|
||||
|
||||
return {0, h};
|
||||
};
|
||||
println(hlog, "low = ", low);
|
||||
println(hlog, "high = ", high);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
void postprocess() {
|
||||
println(hlog, "low = ", low);
|
||||
println(hlog, "high = ", high);
|
||||
}
|
||||
};
|
||||
|
||||
citymodel city;
|
||||
|
||||
bool draw_city_at(cell *c, const shiftmatrix& V) {
|
||||
if(nil) {
|
||||
|
Reference in New Issue
Block a user