diff --git a/floorshapes.cpp b/floorshapes.cpp index b9c53152..57b95da8 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -674,6 +674,7 @@ void draw_qfi(cell *c, const transmatrix& V, color_t col, PPR prio = PPR::DEFAUL else if(qfi.tinf) { auto& poly = queuetable(V * qfi.spin, qfi.tinf->vertices, isize(qfi.tinf->vertices), texture::config.mesh_color, texture::config.recolor(col), prio == PPR::DEFAULT ? PPR::FLOOR : prio); poly.tinf = qfi.tinf; + poly.offset_texture = 0; poly.flags = POLY_INVERSE; } #endif diff --git a/graph.cpp b/graph.cpp index 8379b907..47ae34e6 100644 --- a/graph.cpp +++ b/graph.cpp @@ -4813,6 +4813,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(qfi.fshape && wmescher) { auto& poly = queuepoly(V, shWall3D[a], darkena(wcol - d * get_darkval(a), 0, 0xFF)); poly.tinf = &qfi.fshape->tinf3; + poly.offset_texture = 0; } else queuepoly(V, shPlainWall3D[a], darkena(wcol - d * get_darkval(a), 0, 0xFF)); diff --git a/hyper.h b/hyper.h index 399fdd48..eaa30ccf 100644 --- a/hyper.h +++ b/hyper.h @@ -2858,7 +2858,7 @@ struct dqi_poly : drawqueueitem { ld band_shift; transmatrix V; const vector *tab; - int offset, cnt; + int offset, cnt, offset_texture; color_t outline; double linewidth; int flags; diff --git a/polygons.cpp b/polygons.cpp index e00c521b..7edb458d 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -568,7 +568,7 @@ void dqi_poly::gldraw() { glhr::be_textured(); glBindTexture(GL_TEXTURE_2D, tinf->texture_id); current_display->set_projection(0, true); - glhr::vertices_texture(v, tinf->tvertices, offset); + glhr::vertices_texture(v, tinf->tvertices, offset, offset_texture); ioffset = 0; #endif } @@ -905,11 +905,13 @@ void dqi_poly::draw() { int i = cnt; cnt = 3; for(int j=0; j tv; - if(tinf) { - for(int i=0; itvertices[offset+i]); - swap(tinf->tvertices, tv); - } dynamicval d1(pmodel, mdUnchanged); dynamicval d2(V, Id); dynamicval d3(offset, 0); @@ -991,7 +987,6 @@ void dqi_poly::draw() { tab = &phases[j]; draw(); } - if(tinf) swap(tinf->tvertices, tv); return; } @@ -1145,17 +1140,7 @@ void dqi_poly::draw() { npoly.cnt = isize(glcoords); if(nofill) npoly.color = 0, npoly.tinf = NULL; npoly.flags = poly_flags; - if(npoly.tinf && offset) { - vector tv; - for(int i=0; itvertices[offset+i]); - swap(tinf->tvertices, tv); - npoly.gldraw(); - swap(tinf->tvertices, tv); - } - else { - npoly.gldraw(); - } + npoly.gldraw(); continue; } #endif @@ -1181,7 +1166,7 @@ void dqi_poly::draw() { #if CAP_TEXTURE if(!(poly_flags & POLY_INVERSE)) for(int i=0; itvertices[offset + i], color); + drawTexturedTriangle(s, polyx+i, polyy+i, &tinf->tvertices[offset_texture + i], color); #endif } else if(poly_flags & POLY_INVERSE) { diff --git a/shaders.cpp b/shaders.cpp index 9d943792..212b0fb4 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -661,15 +661,15 @@ void vertices(const vector& v, int vshift = 0) { #endif } -void vertices_texture(const vector& v, const vector& t, int vshift = 0) { +void vertices_texture(const vector& v, const vector& t, int vshift = 0, int tshift = 0) { #if CAP_VERTEXBUFFER // not implemented! #else vertices(v, vshift); #if CAP_SHADER - glVertexAttribPointer(aTexture, SHDIM, GL_FLOAT, GL_FALSE, sizeof(glvertex), &t[0]); + glVertexAttribPointer(aTexture, SHDIM, GL_FLOAT, GL_FALSE, sizeof(glvertex), &t[tshift]); #else - glTexCoordPointer(SHDIM, GL_FLOAT, 0, &v[0]); + glTexCoordPointer(SHDIM, GL_FLOAT, 0, &t[tshift]); #endif #endif }