1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-07-21 02:12:49 +00:00

3d:: 3D models are now centered correctly instead of on legs

This commit is contained in:
? 2019-02-27 18:59:21 +01:00 committed by Zeno Rogue
parent a9a02e0f8f
commit 1a8f164572
2 changed files with 31 additions and 23 deletions

View File

@ -274,9 +274,9 @@ namespace geom3 {
ld INFDEEP, BOTTOM, HELLSPIKE, LAKE, WALL, ld INFDEEP, BOTTOM, HELLSPIKE, LAKE, WALL,
SLEV[4], FLATEYE, SLEV[4], FLATEYE,
LEG1, LEG, LEG3, GROIN, GROIN1, GHOST, LEG0, LEG1, LEG, LEG3, GROIN, GROIN1, GHOST,
BODY, NECK1, NECK, NECK3, HEAD, HEAD1, HEAD2, BODY, NECK1, NECK, NECK3, HEAD, HEAD1, HEAD2,
ALEG, ABODY, AHEAD, BIRD; ALEG0, ALEG, ABODY, AHEAD, BIRD;
string invalid; string invalid;
@ -341,25 +341,32 @@ namespace geom3 {
WALL = lev_to_factor(wh); WALL = lev_to_factor(wh);
human_height = human_wall_ratio * wh; human_height = human_wall_ratio * wh;
if(DIM == 3) human_height *= 1.5;
LEG1 = lev_to_factor(human_height * .1); ld reduce = (DIM == 3 ? human_height / 2 : 0);
LEG = lev_to_factor(human_height * .2);
LEG3 = lev_to_factor(human_height * .3); LEG0 = lev_to_factor(human_height * .0 - reduce);
GROIN = lev_to_factor(human_height * .4); LEG1 = lev_to_factor(human_height * .1 - reduce);
GROIN1= lev_to_factor(human_height * .5); LEG = lev_to_factor(human_height * .2 - reduce);
BODY = lev_to_factor(human_height * .6); LEG3 = lev_to_factor(human_height * .3 - reduce);
NECK1 = lev_to_factor(human_height * .7); GROIN = lev_to_factor(human_height * .4 - reduce);
NECK = lev_to_factor(human_height * .8); GROIN1= lev_to_factor(human_height * .5 - reduce);
NECK3 = lev_to_factor(human_height * .9); BODY = lev_to_factor(human_height * .6 - reduce);
HEAD = lev_to_factor(human_height * .98); NECK1 = lev_to_factor(human_height * .7 - reduce);
HEAD1 = lev_to_factor(human_height * .99); NECK = lev_to_factor(human_height * .8 - reduce);
NECK3 = lev_to_factor(human_height * .9 - reduce);
HEAD = lev_to_factor(human_height * .98 - reduce);
HEAD1 = lev_to_factor(human_height * .99 - reduce);
HEAD2 = lev_to_factor(human_height); HEAD2 = lev_to_factor(human_height);
ABODY = lev_to_factor(human_height * .4); reduce = (DIM == 3 ? human_height * .3 : 0);
ALEG = lev_to_factor(human_height * .2);
AHEAD = lev_to_factor(human_height * .6); ABODY = lev_to_factor(human_height * .4 - reduce);
BIRD = lev_to_factor((human_wall_ratio+1)/2 * wh * .8); ALEG0 = lev_to_factor(human_height * .0 - reduce);
GHOST = lev_to_factor(human_height * .5); ALEG = lev_to_factor(human_height * .2 - reduce);
AHEAD = lev_to_factor(human_height * .6 - reduce);
BIRD = lev_to_factor(DIM == 3 ? 0 : (human_wall_ratio+1)/2 * wh * .8);
GHOST = lev_to_factor(DIM == 3 ? 0 : human_height * .5);
FLATEYE = lev_to_factor(human_height * .15); FLATEYE = lev_to_factor(human_height * .15);
slev = rock_wall_ratio * wh / 3; slev = rock_wall_ratio * wh / 3;

View File

@ -496,11 +496,12 @@ void animallegs(const transmatrix& V, eMonster mo, color_t col, double footphase
hpcshape **x = sh[mo == moRagingBull ? 5 : mo == moBug0 ? 3 : mo == moMetalBeast ? 4 : mo == moRunDog ? 0 : mo == moReptile ? 2 : 1]; hpcshape **x = sh[mo == moRagingBull ? 5 : mo == moBug0 ? 3 : mo == moMetalBeast ? 4 : mo == moRunDog ? 0 : mo == moReptile ? 2 : 1];
if(x[0]) queuepolyat(V * xpush(rightfoot), *x[0], col, PPR::MONSTER_FOOT); static const transmatrix VL = (DIM == 2 ? V : mmscale(V, geom3::ALEG0));
if(x[0]) queuepolyat(V * Mirror * xpush(leftfoot), *x[0], col, PPR::MONSTER_FOOT);
if(x[1]) queuepolyat(V * xpush(-rightfoot), *x[1], col, PPR::MONSTER_FOOT);
if(x[1]) queuepolyat(V * Mirror * xpush(-leftfoot), *x[1], col, PPR::MONSTER_FOOT);
if(x[0]) queuepolyat(VL * xpush(rightfoot), *x[0], col, PPR::MONSTER_FOOT);
if(x[0]) queuepolyat(VL * Mirror * xpush(leftfoot), *x[0], col, PPR::MONSTER_FOOT);
if(x[1]) queuepolyat(VL * xpush(-rightfoot), *x[1], col, PPR::MONSTER_FOOT);
if(x[1]) queuepolyat(VL * Mirror * xpush(-leftfoot), *x[1], col, PPR::MONSTER_FOOT);
if(x[2]) queuepolyat(VAML * xpush(rightfoot/2), *x[2], col, PPR::MONSTER_FOOT); if(x[2]) queuepolyat(VAML * xpush(rightfoot/2), *x[2], col, PPR::MONSTER_FOOT);
if(x[2]) queuepolyat(VAML * Mirror * xpush(leftfoot/2), *x[2], col, PPR::MONSTER_FOOT); if(x[2]) queuepolyat(VAML * Mirror * xpush(leftfoot/2), *x[2], col, PPR::MONSTER_FOOT);
@ -526,7 +527,7 @@ void ShadowV(const transmatrix& V, const hpcshape& bp, PPR prio) {
#if CAP_SHAPES #if CAP_SHAPES
transmatrix otherbodyparts(const transmatrix& V, color_t col, eMonster who, double footphase) { transmatrix otherbodyparts(const transmatrix& V, color_t col, eMonster who, double footphase) {
#define VFOOT V #define VFOOT (DIM == 2 ? V : mmscale(V, geom3::LEG0))
#define VLEG mmscale(V, geom3::LEG) #define VLEG mmscale(V, geom3::LEG)
#define VGROIN mmscale(V, geom3::GROIN) #define VGROIN mmscale(V, geom3::GROIN)
#define VBODY mmscale(V, geom3::BODY) #define VBODY mmscale(V, geom3::BODY)