1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 22:39:53 +00:00

fixed the bug with black creatures in 3D

This commit is contained in:
Zeno Rogue 2019-08-20 12:57:05 +02:00
parent fe266d3485
commit 62214a26e1
4 changed files with 10 additions and 7 deletions

View File

@ -113,8 +113,6 @@ void geometry_information::shift_shape_orthogonally(hpcshape& sh, ld z) {
extern renderbuffer *floor_textures; extern renderbuffer *floor_textures;
basic_textureinfo models_texture;
void geometry_information::add_texture(hpcshape& sh) { void geometry_information::add_texture(hpcshape& sh) {
if(!floor_textures) return; if(!floor_textures) return;
auto& utt = models_texture; auto& utt = models_texture;

View File

@ -1045,6 +1045,8 @@ EX void make_floor_textures() {
dynamicval<int> vgp(global_projection, 0); dynamicval<int> vgp(global_projection, 0);
check_cgi(); check_cgi();
cgi.make_floor_textures_here(); cgi.make_floor_textures_here();
/* update texture ID in existing cgi's */
for(auto& c: cgis) c.second.models_texture.texture_id = floor_textures->renderedTexture;
} }

View File

@ -79,6 +79,11 @@ struct escher_floorshape : floorshape {
ld scale; ld scale;
}; };
struct basic_textureinfo {
int texture_id;
vector<glvertex> tvertices;
};
/** basic geometry parameters */ /** basic geometry parameters */
struct geometry_information { struct geometry_information {
@ -376,6 +381,9 @@ hpcshape
int state; int state;
int usershape_state; int usershape_state;
/** contains the texture point coordinates for 3D models */
basic_textureinfo models_texture;
geometry_information() { last = NULL; state = usershape_state = 0; gpdata = NULL; } geometry_information() { last = NULL; state = usershape_state = 0; gpdata = NULL; }
void require_basics() { if(state & 1) return; state |= 1; prepare_basics(); } void require_basics() { if(state & 1) return; state |= 1; prepare_basics(); }

View File

@ -15,11 +15,6 @@ struct texture_triangle {
texture_triangle(array<hyperpoint, 3> _v, array<hyperpoint, 3> _tv) : v(_v), tv(_tv) {} texture_triangle(array<hyperpoint, 3> _v, array<hyperpoint, 3> _tv) : v(_v), tv(_tv) {}
}; };
struct basic_textureinfo {
int texture_id;
vector<glvertex> tvertices;
};
struct textureinfo : basic_textureinfo { struct textureinfo : basic_textureinfo {
transmatrix M; transmatrix M;
vector<texture_triangle> triangles; vector<texture_triangle> triangles;