mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
texture:: vid.stretch parameter applied correctly
This commit is contained in:
parent
dc1efea3e6
commit
dac4f6fc75
1
hyper.h
1
hyper.h
@ -2866,6 +2866,7 @@ namespace texture {
|
|||||||
void mapTexture2(textureinfo& mi);
|
void mapTexture2(textureinfo& mi);
|
||||||
void finish_mapping();
|
void finish_mapping();
|
||||||
void remap(eTextureState old_tstate, eTextureState old_tstate_max);
|
void remap(eTextureState old_tstate, eTextureState old_tstate_max);
|
||||||
|
hyperpoint texture_coordinates(hyperpoint);
|
||||||
|
|
||||||
void drawRawTexture();
|
void drawRawTexture();
|
||||||
void saveFullTexture(string tn);
|
void saveFullTexture(string tn);
|
||||||
|
32
textures.cpp
32
textures.cpp
@ -216,6 +216,18 @@ void texture_data::saveRawTexture(string tn) {
|
|||||||
addMessage(XLAT("Saved the raw texture to %1", tn));
|
addMessage(XLAT("Saved the raw texture to %1", tn));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hyperpoint texture_config::texture_coordinates(hyperpoint h) {
|
||||||
|
hyperpoint inmodel;
|
||||||
|
applymodel(h, inmodel);
|
||||||
|
inmodel[0] *= vid.radius * 1. / vid.scrsize;
|
||||||
|
inmodel[1] *= vid.radius * vid.stretch / vid.scrsize;
|
||||||
|
inmodel[2] = 1;
|
||||||
|
inmodel = itt * inmodel;
|
||||||
|
inmodel[0] = (inmodel[0] + 1) / 2;
|
||||||
|
inmodel[1] = (inmodel[1] + 1) / 2;
|
||||||
|
return inmodel;
|
||||||
|
}
|
||||||
|
|
||||||
void texture_config::mapTextureTriangle(textureinfo &mi, const array<hyperpoint, 3>& v, const array<hyperpoint, 3>& tv, int splits) {
|
void texture_config::mapTextureTriangle(textureinfo &mi, const array<hyperpoint, 3>& v, const array<hyperpoint, 3>& tv, int splits) {
|
||||||
|
|
||||||
if(splits) {
|
if(splits) {
|
||||||
@ -231,11 +243,7 @@ void texture_config::mapTextureTriangle(textureinfo &mi, const array<hyperpoint,
|
|||||||
for(int i=0; i<3; i++) {
|
for(int i=0; i<3; i++) {
|
||||||
mi.vertices.push_back(glhr::pointtogl(v[i]));
|
mi.vertices.push_back(glhr::pointtogl(v[i]));
|
||||||
hyperpoint inmodel;
|
hyperpoint inmodel;
|
||||||
applymodel(tv[i], inmodel);
|
mi.tvertices.push_back(glhr::pointtogl(texture_coordinates(tv[i])));
|
||||||
inmodel = itt * inmodel;
|
|
||||||
inmodel[0] *= 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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// when reading a spherical band in a cylindrical projection,
|
// when reading a spherical band in a cylindrical projection,
|
||||||
@ -857,6 +865,7 @@ void init_textureconfig() {
|
|||||||
|
|
||||||
addsaver(vid.alpha, "projection", 1);
|
addsaver(vid.alpha, "projection", 1);
|
||||||
addsaver(vid.scale, "scale", 1);
|
addsaver(vid.scale, "scale", 1);
|
||||||
|
addsaver(vid.stretch, "stretch", 1);
|
||||||
|
|
||||||
addsaver(config.texturename, "texture filename", "");
|
addsaver(config.texturename, "texture filename", "");
|
||||||
addsaver(config.texture_tuner, "texture tuning", "");
|
addsaver(config.texture_tuner, "texture tuning", "");
|
||||||
@ -1020,13 +1029,14 @@ void showMagicMenu() {
|
|||||||
char letter = 'A';
|
char letter = 'A';
|
||||||
for(auto& am: amp) {
|
for(auto& am: amp) {
|
||||||
hyperpoint h = shmup::ggmatrix(am.c) * am.cell_relative;
|
hyperpoint h = shmup::ggmatrix(am.c) * am.cell_relative;
|
||||||
display(h);
|
|
||||||
queuechr(h, vid.fsize, letter, 0xC00000, 1);
|
queuechr(h, vid.fsize, letter, 0xC00000, 1);
|
||||||
|
|
||||||
|
/*
|
||||||
hyperpoint inmodel;
|
hyperpoint inmodel;
|
||||||
applymodel(h, inmodel);
|
applymodel(h, inmodel);
|
||||||
inmodel[0] *= vid.radius * 1. / vid.scrsize;
|
inmodel[0] *= vid.radius * 1. / vid.scrsize;
|
||||||
inmodel[1] *= vid.radius * 1. / vid.scrsize;
|
inmodel[1] *= vid.radius * 1. / vid.scrsize;
|
||||||
|
*/
|
||||||
|
|
||||||
queuechr(
|
queuechr(
|
||||||
vid.xcenter + vid.scrsize * am.texture_coords[0],
|
vid.xcenter + vid.scrsize * am.texture_coords[0],
|
||||||
@ -1288,14 +1298,8 @@ void showMenu() {
|
|||||||
typedef pair<int,int> point;
|
typedef pair<int,int> point;
|
||||||
|
|
||||||
point ptc(hyperpoint h) {
|
point ptc(hyperpoint h) {
|
||||||
hyperpoint inmodel;
|
hyperpoint inmodel = config.texture_coordinates(h);
|
||||||
applymodel(h, inmodel);
|
return make_pair(int(inmodel[0] * config.data.twidth), int(inmodel[1] * config.data.twidth));
|
||||||
inmodel = config.itt * inmodel;
|
|
||||||
inmodel[0] *= vid.radius * 1. / vid.scrsize;
|
|
||||||
inmodel[1] *= vid.radius * 1. / vid.scrsize;
|
|
||||||
int x = (1 + inmodel[0]) * config.data.twidth / 2;
|
|
||||||
int y = (1 + inmodel[1]) * config.data.twidth / 2;
|
|
||||||
return make_pair(x,y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
array<point, 3> ptc(const array<hyperpoint, 3>& h) {
|
array<point, 3> ptc(const array<hyperpoint, 3>& h) {
|
||||||
|
Loading…
Reference in New Issue
Block a user