mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-01 03:46:16 +00:00
magic texture adjustment: fixed the names of parameters; added texture position X/Y
This commit is contained in:
parent
6ef98ddc0a
commit
1b3de574a9
24
textures.cpp
24
textures.cpp
@ -496,16 +496,20 @@ enum eMagicParameter {
|
|||||||
mpRotate,
|
mpRotate,
|
||||||
mpSlant,
|
mpSlant,
|
||||||
mpStretch,
|
mpStretch,
|
||||||
|
mpTexPosX,
|
||||||
|
mpTexPosY,
|
||||||
mpMAX
|
mpMAX
|
||||||
};
|
};
|
||||||
|
|
||||||
vector<string> mpnames = {
|
vector<string> mpnames = {
|
||||||
"affect model scale",
|
"affect model scale",
|
||||||
"affect model projection",
|
"affect model projection",
|
||||||
|
"affect model central point",
|
||||||
"affect model rotation",
|
"affect model rotation",
|
||||||
"affect model position",
|
|
||||||
"affect texture slanting",
|
"affect texture slanting",
|
||||||
"affect texture stretching"
|
"affect texture stretching",
|
||||||
|
"affect texture position X",
|
||||||
|
"affect texture position Y"
|
||||||
};
|
};
|
||||||
|
|
||||||
flagtype current_magic = 15;
|
flagtype current_magic = 15;
|
||||||
@ -513,8 +517,9 @@ flagtype current_magic = 15;
|
|||||||
bool have_mp(eMagicParameter i) { return (current_magic >> i) & 1; }
|
bool have_mp(eMagicParameter i) { return (current_magic >> i) & 1; }
|
||||||
|
|
||||||
struct magic_param {
|
struct magic_param {
|
||||||
bool do_spin, do_stretch;
|
bool do_spin;
|
||||||
ld spinangle, scale, proj, moveangle, shift, slant, stretch;
|
int texmode;
|
||||||
|
ld spinangle, scale, proj, moveangle, shift, slant, stretch, tx, ty;
|
||||||
|
|
||||||
void shuffle() {
|
void shuffle() {
|
||||||
do_spin = hrand(2);
|
do_spin = hrand(2);
|
||||||
@ -523,9 +528,11 @@ struct magic_param {
|
|||||||
shift = hrandf() - hrandf();
|
shift = hrandf() - hrandf();
|
||||||
scale = hrandf() - hrandf();
|
scale = hrandf() - hrandf();
|
||||||
proj = hrandf() - hrandf();
|
proj = hrandf() - hrandf();
|
||||||
do_stretch = hrand(2);
|
texmode = hrand(3);
|
||||||
slant = have_mp(mpSlant) ? hrandf() - hrandf() : 0;
|
slant = have_mp(mpSlant) ? hrandf() - hrandf() : 0;
|
||||||
stretch = have_mp(mpStretch) ? hrandf() - hrandf() : 0;
|
stretch = have_mp(mpStretch) ? hrandf() - hrandf() : 0;
|
||||||
|
tx = have_mp(mpTexPosX) ? hrandf() - hrandf() : 0;
|
||||||
|
ty = have_mp(mpTexPosY) ? hrandf() - hrandf() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void affect_itt(const transmatrix& T) {
|
void affect_itt(const transmatrix& T) {
|
||||||
@ -550,12 +557,15 @@ struct magic_param {
|
|||||||
View = spin(moveangle) * xpush(delta*shift) * spin(-moveangle) * View;
|
View = spin(moveangle) * xpush(delta*shift) * spin(-moveangle) * View;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(do_stretch && have_mp(mpStretch))
|
if(texmode == 0 && have_mp(mpStretch))
|
||||||
affect_itt(euaffine(hpxyz(0, delta * stretch, 0)));
|
affect_itt(euaffine(hpxyz(0, delta * stretch, 0)));
|
||||||
|
|
||||||
if(!do_stretch && have_mp(mpSlant))
|
if(texmode == 1 && have_mp(mpSlant))
|
||||||
affect_itt(euaffine(hpxyz(delta * slant, 0, 0)));
|
affect_itt(euaffine(hpxyz(delta * slant, 0, 0)));
|
||||||
|
|
||||||
|
if(texmode == 2 && (have_mp(mpTexPosX) || have_mp(mpTexPosY)))
|
||||||
|
affect_itt(eupush(delta * tx, delta * ty));
|
||||||
|
|
||||||
fixmatrix(View);
|
fixmatrix(View);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user