mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-17 06:34:07 +00:00
gldraw:: offset and texture_offset are now separate
This commit is contained in:
parent
eed92c5b96
commit
5116d745c4
@ -674,6 +674,7 @@ void draw_qfi(cell *c, const transmatrix& V, color_t col, PPR prio = PPR::DEFAUL
|
|||||||
else if(qfi.tinf) {
|
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);
|
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.tinf = qfi.tinf;
|
||||||
|
poly.offset_texture = 0;
|
||||||
poly.flags = POLY_INVERSE;
|
poly.flags = POLY_INVERSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -4813,6 +4813,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
|||||||
if(qfi.fshape && wmescher) {
|
if(qfi.fshape && wmescher) {
|
||||||
auto& poly = queuepoly(V, shWall3D[a], darkena(wcol - d * get_darkval(a), 0, 0xFF));
|
auto& poly = queuepoly(V, shWall3D[a], darkena(wcol - d * get_darkval(a), 0, 0xFF));
|
||||||
poly.tinf = &qfi.fshape->tinf3;
|
poly.tinf = &qfi.fshape->tinf3;
|
||||||
|
poly.offset_texture = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
queuepoly(V, shPlainWall3D[a], darkena(wcol - d * get_darkval(a), 0, 0xFF));
|
queuepoly(V, shPlainWall3D[a], darkena(wcol - d * get_darkval(a), 0, 0xFF));
|
||||||
|
2
hyper.h
2
hyper.h
@ -2858,7 +2858,7 @@ struct dqi_poly : drawqueueitem {
|
|||||||
ld band_shift;
|
ld band_shift;
|
||||||
transmatrix V;
|
transmatrix V;
|
||||||
const vector<glvertex> *tab;
|
const vector<glvertex> *tab;
|
||||||
int offset, cnt;
|
int offset, cnt, offset_texture;
|
||||||
color_t outline;
|
color_t outline;
|
||||||
double linewidth;
|
double linewidth;
|
||||||
int flags;
|
int flags;
|
||||||
|
27
polygons.cpp
27
polygons.cpp
@ -568,7 +568,7 @@ void dqi_poly::gldraw() {
|
|||||||
glhr::be_textured();
|
glhr::be_textured();
|
||||||
glBindTexture(GL_TEXTURE_2D, tinf->texture_id);
|
glBindTexture(GL_TEXTURE_2D, tinf->texture_id);
|
||||||
current_display->set_projection(0, true);
|
current_display->set_projection(0, true);
|
||||||
glhr::vertices_texture(v, tinf->tvertices, offset);
|
glhr::vertices_texture(v, tinf->tvertices, offset, offset_texture);
|
||||||
ioffset = 0;
|
ioffset = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -905,11 +905,13 @@ void dqi_poly::draw() {
|
|||||||
int i = cnt;
|
int i = cnt;
|
||||||
cnt = 3;
|
cnt = 3;
|
||||||
for(int j=0; j<i; j+=3) {
|
for(int j=0; j<i; j+=3) {
|
||||||
offset = j;
|
offset += j;
|
||||||
|
offset_texture += j;
|
||||||
draw();
|
draw();
|
||||||
|
offset -= j;
|
||||||
|
offset_texture -= j;
|
||||||
}
|
}
|
||||||
cnt = i;
|
cnt = i;
|
||||||
offset = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -976,12 +978,6 @@ void dqi_poly::draw() {
|
|||||||
if(cpha == 1) pha = 0;
|
if(cpha == 1) pha = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vector<glvertex> tv;
|
|
||||||
if(tinf) {
|
|
||||||
for(int i=0; i<cnt; i++)
|
|
||||||
tv.push_back(tinf->tvertices[offset+i]);
|
|
||||||
swap(tinf->tvertices, tv);
|
|
||||||
}
|
|
||||||
dynamicval<eModel> d1(pmodel, mdUnchanged);
|
dynamicval<eModel> d1(pmodel, mdUnchanged);
|
||||||
dynamicval<transmatrix> d2(V, Id);
|
dynamicval<transmatrix> d2(V, Id);
|
||||||
dynamicval<int> d3(offset, 0);
|
dynamicval<int> d3(offset, 0);
|
||||||
@ -991,7 +987,6 @@ void dqi_poly::draw() {
|
|||||||
tab = &phases[j];
|
tab = &phases[j];
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
if(tinf) swap(tinf->tvertices, tv);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1145,17 +1140,7 @@ void dqi_poly::draw() {
|
|||||||
npoly.cnt = isize(glcoords);
|
npoly.cnt = isize(glcoords);
|
||||||
if(nofill) npoly.color = 0, npoly.tinf = NULL;
|
if(nofill) npoly.color = 0, npoly.tinf = NULL;
|
||||||
npoly.flags = poly_flags;
|
npoly.flags = poly_flags;
|
||||||
if(npoly.tinf && offset) {
|
|
||||||
vector<glvertex> tv;
|
|
||||||
for(int i=0; i<cnt; i++)
|
|
||||||
tv.push_back(tinf->tvertices[offset+i]);
|
|
||||||
swap(tinf->tvertices, tv);
|
|
||||||
npoly.gldraw();
|
npoly.gldraw();
|
||||||
swap(tinf->tvertices, tv);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
npoly.gldraw();
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1181,7 +1166,7 @@ void dqi_poly::draw() {
|
|||||||
#if CAP_TEXTURE
|
#if CAP_TEXTURE
|
||||||
if(!(poly_flags & POLY_INVERSE))
|
if(!(poly_flags & POLY_INVERSE))
|
||||||
for(int i=0; i<polyi; i += 3)
|
for(int i=0; i<polyi; i += 3)
|
||||||
drawTexturedTriangle(s, polyx+i, polyy+i, &tinf->tvertices[offset + i], color);
|
drawTexturedTriangle(s, polyx+i, polyy+i, &tinf->tvertices[offset_texture + i], color);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if(poly_flags & POLY_INVERSE) {
|
else if(poly_flags & POLY_INVERSE) {
|
||||||
|
@ -661,15 +661,15 @@ void vertices(const vector<glvertex>& v, int vshift = 0) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void vertices_texture(const vector<glvertex>& v, const vector<glvertex>& t, int vshift = 0) {
|
void vertices_texture(const vector<glvertex>& v, const vector<glvertex>& t, int vshift = 0, int tshift = 0) {
|
||||||
#if CAP_VERTEXBUFFER
|
#if CAP_VERTEXBUFFER
|
||||||
// not implemented!
|
// not implemented!
|
||||||
#else
|
#else
|
||||||
vertices(v, vshift);
|
vertices(v, vshift);
|
||||||
#if CAP_SHADER
|
#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
|
#else
|
||||||
glTexCoordPointer(SHDIM, GL_FLOAT, 0, &v[0]);
|
glTexCoordPointer(SHDIM, GL_FLOAT, 0, &t[tshift]);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user