mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-11-11 11:13:01 +00:00
spherical textures in cylindrical projections are now read in a better way
This commit is contained in:
12
textures.cpp
12
textures.cpp
@@ -237,6 +237,18 @@ void texture_config::mapTextureTriangle(textureinfo &mi, const array<hyperpoint,
|
|||||||
inmodel[1] *= vid.radius * 1. / vid.scrsize;
|
inmodel[1] *= vid.radius * 1. / vid.scrsize;
|
||||||
mi.tvertices.push_back(make_array<GLfloat>((inmodel[0]+1)/2, (inmodel[1]+1)/2, 0));
|
mi.tvertices.push_back(make_array<GLfloat>((inmodel[0]+1)/2, (inmodel[1]+1)/2, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// when reading a spherical band in a cylindrical projection,
|
||||||
|
// take care that texture vertices are mapped not around the sphere
|
||||||
|
if(sphere && mdBandAny()) {
|
||||||
|
int s = size(mi.tvertices)-3;
|
||||||
|
ld xmin = min(mi.tvertices[s][0], min(mi.tvertices[s+1][0], mi.tvertices[s+2][0]));
|
||||||
|
ld xmax = max(mi.tvertices[s][0], max(mi.tvertices[s+1][0], mi.tvertices[s+2][0]));
|
||||||
|
if(xmax - xmin > .5) {
|
||||||
|
for(int ss=s; ss<s+3; ss++)
|
||||||
|
if(mi.tvertices[ss][0] < .5) mi.tvertices[ss][0] += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
texture_triangle *edited_triangle;
|
texture_triangle *edited_triangle;
|
||||||
|
|||||||
Reference in New Issue
Block a user