mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-23 15:36:59 +00:00
rogueviz::objmodels:: using gi_extension
This commit is contained in:
parent
d3bb52749f
commit
51b73ecd6e
@ -24,7 +24,8 @@ model city("rogueviz/models/", "emilejohansson_p2.obj");
|
||||
hyperpoint low, high;
|
||||
|
||||
void prepare_tf() {
|
||||
if(!city.models.empty()) return;
|
||||
if(!city.prepared) return;
|
||||
city.prepared = true;
|
||||
|
||||
prec = 40;
|
||||
|
||||
|
@ -21,7 +21,8 @@ bool model::available() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void model::load_obj(model_type& objects) {
|
||||
void model::load_obj(model_data& md) {
|
||||
auto& objects = md.objs;
|
||||
fhstream fs(path+fname, "rt");
|
||||
|
||||
if(!fs.f)
|
||||
@ -235,12 +236,19 @@ void model::load_obj(model_type& objects) {
|
||||
cgi.extra_vertices();
|
||||
}
|
||||
|
||||
void model::render(const shiftmatrix& V) {
|
||||
model_data& model::get() {
|
||||
|
||||
auto& objs = models[cgi_string()];
|
||||
auto& md = (unique_ptr<model_data>&) cgi.ext[fname];
|
||||
|
||||
if(objs.empty()) load_obj(objs);
|
||||
if(!md) {
|
||||
md = std::make_unique<model_data>();
|
||||
load_obj(*md);
|
||||
}
|
||||
|
||||
return *md;
|
||||
}
|
||||
|
||||
void model_data::render(const shiftmatrix& V) {
|
||||
for(auto& obj: objs) {
|
||||
queuepoly(V, obj->sh, obj->color);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user