mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-23 15:36:59 +00:00
texture:: option original
This commit is contained in:
parent
d7d29d8827
commit
864e7e3ec3
15
textures.cpp
15
textures.cpp
@ -39,12 +39,12 @@ struct texture_data {
|
|||||||
GLuint textureid;
|
GLuint textureid;
|
||||||
|
|
||||||
int twidth, theight;
|
int twidth, theight;
|
||||||
bool stretched;
|
bool stretched, original;
|
||||||
int tx, ty, origdim;
|
int tx, ty, origdim;
|
||||||
|
|
||||||
int strx, stry, base_x, base_y;
|
int strx, stry, base_x, base_y;
|
||||||
|
|
||||||
texture_data() { textureid = 0; twidth = 2048; theight = 0; stretched = false; }
|
texture_data() { textureid = 0; twidth = 2048; theight = 0; stretched = false; original = false; }
|
||||||
|
|
||||||
vector<color_t> texture_pixels;
|
vector<color_t> texture_pixels;
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ bool texture_data::readtexture(string tn) {
|
|||||||
|
|
||||||
if(twidth == 0)
|
if(twidth == 0)
|
||||||
twidth = next_p2(tx);
|
twidth = next_p2(tx);
|
||||||
if(theight == 0) theight = stretched ? next_p2(ty) : twidth;
|
if(theight == 0) theight = (stretched || original) ? next_p2(ty) : twidth;
|
||||||
|
|
||||||
texture_pixels.resize(twidth * theight);
|
texture_pixels.resize(twidth * theight);
|
||||||
|
|
||||||
@ -324,6 +324,15 @@ bool texture_data::readtexture(string tn) {
|
|||||||
texture_pixels[i++] = pix(x, y);
|
texture_pixels[i++] = pix(x, y);
|
||||||
strx = twidth; stry = theight; base_x = base_y = 0;
|
strx = twidth; stry = theight; base_x = base_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(original) {
|
||||||
|
base_x = 0;
|
||||||
|
base_y = 0;
|
||||||
|
strx = tx; stry = ty;
|
||||||
|
for(int y=0; y<ty; y++)
|
||||||
|
for(int x=0; x<tx; x++)
|
||||||
|
get_texture_pixel(x, y) = pix(x,y);
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user