diff options
| author | Johan FitiƩ <jfitie@gmail.com> | 2017-07-26 22:35:39 +0200 |
|---|---|---|
| committer | Johan FitiƩ <jfitie@gmail.com> | 2017-07-26 22:35:39 +0200 |
| commit | 9d6ed2ab90d78ce36e4875a884711f827623abba (patch) | |
| tree | 617fb4497695cb6a316abc5224553e9c07668422 | |
| parent | 30dc09d38d8e36837e01f16c8340fe30ed1acf54 (diff) | |
| download | navit-9d6ed2ab90d78ce36e4875a884711f827623abba.tar.gz | |
Move logic to transform
| -rw-r--r-- | navit/gui/internal/gui_internal.c | 3 | ||||
| -rw-r--r-- | navit/transform.c | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c index 0408cf9ca..7095061f6 100644 --- a/navit/gui/internal/gui_internal.c +++ b/navit/gui/internal/gui_internal.c @@ -3427,8 +3427,7 @@ static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods if( (attr=attr_search(attrs,NULL,attr_pitch))) this->pitch=attr->u.num; else - this->pitch=round(20*sqrt(240*320)/sqrt(this->root.w*this->root.h)); // pitch corrected for window resolution - dbg(lvl_debug,"w=%d h=%d pitch=%d\n", this->root.w, this->root.h, this->pitch); + this->pitch=20 if( (attr=attr_search(attrs,NULL,attr_flags_town))) this->flags_town=attr->u.num; else diff --git a/navit/transform.c b/navit/transform.c index 2f64ced1b..d77ceb3de 100644 --- a/navit/transform.c +++ b/navit/transform.c @@ -42,6 +42,7 @@ struct transformation { int yaw; /* Rotation angle */ int pitch; + double corrpitch; /* Pitch corrected for window resolution */ int ddd; /* 3d mode/isometric view active? (0/1) */ int m00,m01,m02; /* 3d transformation matrix */ int m10,m11,m12; @@ -91,8 +92,8 @@ transform_setup_matrix(struct transformation *t) navit_float fac; navit_float yawc=navit_cos(-M_PI*t->yaw/180); navit_float yaws=navit_sin(-M_PI*t->yaw/180); - navit_float pitchc=navit_cos(-M_PI*t->pitch/180); - navit_float pitchs=navit_sin(-M_PI*t->pitch/180); + navit_float pitchc=navit_cos(-M_PI*t->corrpitch/180); + navit_float pitchs=navit_sin(-M_PI*t->corrpitch/180); #ifdef ENABLE_ROLL navit_float rollc=navit_cos(M_PI*t->roll/180); navit_float rolls=navit_sin(M_PI*t->roll/180); @@ -104,7 +105,7 @@ transform_setup_matrix(struct transformation *t) int scale=t->scale; int order_dir=-1; - dbg(lvl_debug,"yaw=%d pitch=%d center=0x%x,0x%x\n", t->yaw, t->pitch, t->map_center.x, t->map_center.y); + dbg(lvl_debug,"yaw=%d pitch=%d corrpitch=%.3f center=0x%x,0x%x\n", t->yaw, t->pitch, t->corrpitch, t->map_center.x, t->map_center.y); t->znear=1 << POST_SHIFT; t->zfar=300*t->znear; t->scale_shift=0; @@ -136,7 +137,7 @@ transform_setup_matrix(struct transformation *t) t->offx=t->screen_center.x; t->offy=t->screen_center.y; - if (t->pitch) { + if (t->corrpitch) { t->ddd=1; t->offz=t->screen_dist; dbg(lvl_debug,"near %d far %d\n",t->znear,t->zfar); @@ -811,7 +812,10 @@ transform_get_yaw(struct transformation *this_) void transform_set_pitch(struct transformation *this_,int pitch) { + int w = 240; // TODO FIXME + int h = 320; // TODO FIXME this_->pitch=pitch; + this_->corrpitch=round(20*sqrt(240*320)/sqrt(w*h)); // pitch corrected for window resolution transform_setup_matrix(this_); } int |
